Skip to content

Commit

Permalink
Update to work with vte 2.91 as well as 2.90
Browse files Browse the repository at this point in the history
  • Loading branch information
iainlane committed Nov 7, 2014
1 parent df57591 commit 6c05a72
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 3 deletions.
10 changes: 8 additions & 2 deletions cmake/FindVTE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand Down
2 changes: 1 addition & 1 deletion remmina/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
22 changes: 22 additions & 0 deletions remmina/src/remmina_ssh_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 6c05a72

Please sign in to comment.