From 91a9af4e2f57e52573579168180d5694dbb76ab2 Mon Sep 17 00:00:00 2001 From: tamplan Date: Sat, 23 May 2020 11:20:51 +0200 Subject: Add tab scrolling support for GTK3 mate-window-properties and mate-appearance-properties --- capplets/appearance/appearance-main.c | 20 +++++++++++++++----- capplets/windows/mate-window-properties.c | 8 ++++++++ 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/capplets/appearance/appearance-main.c b/capplets/appearance/appearance-main.c index 3d401d4b..031040d8 100644 --- a/capplets/appearance/appearance-main.c +++ b/capplets/appearance/appearance-main.c @@ -138,6 +138,8 @@ main (int argc, char **argv) { AppearanceData *data; GtkWidget *w; + GtkWidget *nb; + GtkWidget *nb_custom_theme; GtkStyleContext *context; gchar *install_filename = NULL; @@ -204,9 +206,9 @@ main (int argc, char **argv) if (wallpaper_files && !install_filename && !start_page) start_page = g_strdup ("background"); - GtkNotebook* nb = GTK_NOTEBOOK(appearance_capplet_get_widget (data, "main_notebook")); - gtk_widget_add_events (GTK_WIDGET (nb), GDK_SCROLL_MASK); - g_signal_connect (GTK_WIDGET (nb), "scroll-event", + nb = appearance_capplet_get_widget (data, "main_notebook"); + gtk_widget_add_events (nb, GDK_SCROLL_MASK); + g_signal_connect (nb, "scroll-event", G_CALLBACK (capplet_dialog_page_scroll_event_cb), GTK_WINDOW (w)); @@ -219,10 +221,12 @@ main (int argc, char **argv) w = appearance_capplet_get_widget (data, page_name); if (w != NULL) { gint pindex; + GtkNotebook *notebook; - pindex = gtk_notebook_page_num (nb, w); + notebook = GTK_NOTEBOOK (nb); + pindex = gtk_notebook_page_num (notebook, w); if (pindex != -1) - gtk_notebook_set_current_page (nb, pindex); + gtk_notebook_set_current_page (notebook, pindex); } g_free (page_name); } @@ -236,6 +240,12 @@ main (int argc, char **argv) g_option_context_free (option_context); + nb_custom_theme = appearance_capplet_get_widget (data, "notebook2"); + gtk_widget_add_events (nb_custom_theme, GDK_SCROLL_MASK); + g_signal_connect (nb_custom_theme, "scroll-event", + G_CALLBACK (capplet_dialog_page_scroll_event_cb), + GTK_WINDOW (w)); + /* start the mainloop */ gtk_main (); diff --git a/capplets/windows/mate-window-properties.c b/capplets/windows/mate-window-properties.c index a4513089..90e0b785 100644 --- a/capplets/windows/mate-window-properties.c +++ b/capplets/windows/mate-window-properties.c @@ -298,6 +298,7 @@ main (int argc, char **argv) GError *error = NULL; GtkBuilder *builder; GdkScreen *screen; + GtkWidget *nb; gchar *str; const char *current_wm; int i; @@ -342,6 +343,13 @@ main (int argc, char **argv) /* Window */ dialog_win = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_win")); + /* Notebook */ + nb = GTK_WIDGET (gtk_builder_get_object (builder, "nb")); + gtk_widget_add_events (nb, GDK_SCROLL_MASK); + g_signal_connect (nb, "scroll-event", + G_CALLBACK (capplet_dialog_page_scroll_event_cb), + GTK_WINDOW (dialog_win)); + /* Compositing manager */ compositing_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "compositing_checkbutton")); compositing_fast_alt_tab_checkbutton = GTK_WIDGET (gtk_builder_get_object (builder, "compositing_fast_alt_tab_checkbutton")); -- cgit v1.2.1