Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sat, 29 Oct 2016 14:02:32 UTC Commit: d27831fa30998c4404676777469ccac518d17719 https://github.com/geany/geany/commit/d27831fa30998c4404676777469ccac518d177...
Log Message: ----------- VTE: use proper accessor for the vertical adjustment
Use vte_terminal_get_adjustment() to get the adjustment, and provide an appropriate default implementation for use if it isn't available (on VTE < 0.9 or > 0.36).
Modified Paths: -------------- src/vte.c
Modified: src/vte.c 18 lines changed, 17 insertions(+), 1 deletions(-) =================================================================== @@ -120,6 +120,7 @@ struct VteFunctions void (*vte_terminal_select_all) (VteTerminal *terminal); void (*vte_terminal_set_audible_bell) (VteTerminal *terminal, gboolean is_audible); void (*vte_terminal_set_background_image_file) (VteTerminal *terminal, const char *path); + GtkAdjustment* (*vte_terminal_get_adjustment) (VteTerminal *terminal); };
@@ -162,6 +163,18 @@ static const GtkTargetEntry dnd_targets[] = };
+/* replacement for vte_terminal_get_adjustment() when it's not available */ +static GtkAdjustment *default_vte_terminal_get_adjustment(VteTerminal *vte) +{ +#if GTK_CHECK_VERSION(3, 0, 0) + if (GTK_IS_SCROLLABLE(vte)) + return gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(vte)); +#endif + /* this is only valid in < 0.38, 0.38 broke ABI */ + return vte->adjustment; +} + + static gchar **vte_get_child_environment(void) { const gchar *exclude_vars[] = {"COLUMNS", "LINES", "TERM", "TERM_PROGRAM", NULL}; @@ -283,7 +296,7 @@ static void create_vte(void) GtkWidget *vte, *scrollbar, *hbox;
vc->vte = vte = vf->vte_terminal_new(); - scrollbar = gtk_vscrollbar_new(GTK_ADJUSTMENT(VTE_TERMINAL(vte)->adjustment)); + scrollbar = gtk_vscrollbar_new(vf->vte_terminal_get_adjustment(VTE_TERMINAL(vte))); gtk_widget_set_can_focus(scrollbar, FALSE);
/* create menu now so copy/paste shortcuts work */ @@ -517,6 +530,9 @@ static gboolean vte_register_symbols(GModule *mod) BIND_REQUIRED_SYMBOL(vte_terminal_set_cursor_blinks); BIND_REQUIRED_SYMBOL(vte_terminal_select_all); BIND_REQUIRED_SYMBOL(vte_terminal_set_audible_bell); + if (! BIND_SYMBOL(vte_terminal_get_adjustment)) + /* vte_terminal_get_adjustment() is available since 0.9 and removed in 0.38 */ + vf->vte_terminal_get_adjustment = default_vte_terminal_get_adjustment;
#undef BIND_REQUIRED_SYMBOL #undef BIND_SYMBOL
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).