From 6c05a728f9e55db7cf41d9b2c36598a8ecfc8365 Mon Sep 17 00:00:00 2001 From: Iain Lane Date: Fri, 7 Nov 2014 15:04:29 +0000 Subject: [PATCH] Update to work with vte 2.91 as well as 2.90 --- cmake/FindVTE.cmake | 10 ++++++++-- remmina/CMakeLists.txt | 2 +- remmina/src/remmina_ssh_plugin.c | 22 ++++++++++++++++++++++ 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/cmake/FindVTE.cmake b/cmake/FindVTE.cmake index cbbe956819..914bd31068 100644 --- a/cmake/FindVTE.cmake +++ b/cmake/FindVTE.cmake @@ -21,11 +21,17 @@ if(NOT _VTE_VERSION_NUM) set(_VTE_LIB_NAME vte) set(_VTE_VERSION vte) else() - set(_VTE_LIB_NAME vte${_VTE_VERSION_NUM}) + if(${_VTE_VERSION_NUM} VERSION_LESS 2.91) + set(_VTE_LIB_NAME vte${_VTE_VERSION_NUM}) + else() + set(_VTE_LIB_NAME vte-${_VTE_VERSION_NUM}) + endif() set(_VTE_VERSION vte-${_VTE_VERSION_NUM}) endif() -string(REPLACE . _ _VTE_LIB_NAME ${_VTE_LIB_NAME}) +if(${_VTE_VERSION_NUM} VERSION_LESS 2.91) + string(REPLACE . _ _VTE_LIB_NAME ${_VTE_LIB_NAME}) +endif() pkg_check_modules(PC_VTE ${_VTE_VERSION}) diff --git a/remmina/CMakeLists.txt b/remmina/CMakeLists.txt index 42f516acc8..d3da75280b 100644 --- a/remmina/CMakeLists.txt +++ b/remmina/CMakeLists.txt @@ -138,7 +138,7 @@ if(AVAHI_FOUND) endif() if(GTK3_FOUND) - set(_VTE_VERSION_NUM 2.90) + set(_VTE_VERSION_NUM 2.91) else() set(_VTE_VERSION_NUM) endif() diff --git a/remmina/src/remmina_ssh_plugin.c b/remmina/src/remmina_ssh_plugin.c index 43e42d4a64..e1261c65a2 100644 --- a/remmina/src/remmina_ssh_plugin.c +++ b/remmina/src/remmina_ssh_plugin.c @@ -136,9 +136,18 @@ remmina_plugin_ssh_main_thread (gpointer data) THREADS_ENTER if (charset && charset[0] != '\0') { +#if !VTE_CHECK_VERSION(0,38,0) vte_terminal_set_encoding (VTE_TERMINAL (gpdata->vte), charset); +#else + vte_terminal_set_encoding (VTE_TERMINAL (gpdata->vte), charset, NULL); +#endif } +#if !VTE_CHECK_VERSION(0,38,0) vte_terminal_set_pty (VTE_TERMINAL (gpdata->vte), shell->slave); +#else + vte_terminal_set_pty (VTE_TERMINAL (gpdata->vte), + vte_pty_new_foreign_sync (shell->slave, NULL, NULL)); +#endif THREADS_LEAVE remmina_plugin_service->protocol_plugin_emit_signal (gp, "connect"); @@ -183,7 +192,12 @@ remmina_plugin_ssh_set_vte_pref (RemminaProtocolWidget *gp) gpdata = (RemminaPluginSshData*) g_object_get_data (G_OBJECT(gp), "plugin-data"); if (remmina_pref.vte_font && remmina_pref.vte_font[0]) { +#if !VTE_CHECK_VERSION(0,38,0) vte_terminal_set_font_from_string (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_font); +#else + vte_terminal_set_font (VTE_TERMINAL (gpdata->vte), + pango_font_description_from_string (remmina_pref.vte_font)); +#endif } vte_terminal_set_allow_bold (VTE_TERMINAL (gpdata->vte), remmina_pref.vte_allow_bold_text); if (remmina_pref.vte_lines > 0) @@ -224,9 +238,17 @@ remmina_plugin_ssh_init (RemminaProtocolWidget *gp) remmina_plugin_service->protocol_plugin_register_hostkey (gp, vte); #if GTK_VERSION == 3 +#if VTE_CHECK_VERSION(0, 38, 0) + vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, gtk_scrollable_get_vadjustment (GTK_SCROLLABLE (vte))); +#else vscrollbar = gtk_scrollbar_new (GTK_ORIENTATION_VERTICAL, vte_terminal_get_adjustment (VTE_TERMINAL (vte))); +#endif #elif GTK_VERSION == 2 +#if VTE_CHECK_VERSION(0, 38, 0) + vscrollbar = gtk_vscrollbar_new (gtk_scrollable_get_vadjustment (GTK_SCROLLABLE_TERMINAL (vte))); +#else vscrollbar = gtk_vscrollbar_new (vte_terminal_get_adjustment (VTE_TERMINAL (vte))); +#endif #endif gtk_widget_show(vscrollbar); gtk_box_pack_start (GTK_BOX (hbox), vscrollbar, FALSE, TRUE, 0);