diff options
author | rbuj <[email protected]> | 2020-06-29 14:03:02 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2020-07-06 15:32:33 +0200 |
commit | f4559021fe2bbb58382b5407a8bf51304aae3580 (patch) | |
tree | 208fefbc99fe05cb3848e0407e3cfb92c5424b5c /mate-dictionary/src | |
parent | 002874662a6b4e9df4087301f902ae2610e041e2 (diff) | |
download | mate-utils-f4559021fe2bbb58382b5407a8bf51304aae3580.tar.bz2 mate-utils-f4559021fe2bbb58382b5407a8bf51304aae3580.tar.xz |
gdict-pref-dialog: Simplify notebook scroll event
Diffstat (limited to 'mate-dictionary/src')
-rw-r--r-- | mate-dictionary/src/gdict-pref-dialog.c | 58 |
1 files changed, 31 insertions, 27 deletions
diff --git a/mate-dictionary/src/gdict-pref-dialog.c b/mate-dictionary/src/gdict-pref-dialog.c index 4267761d..4c2c8e6c 100644 --- a/mate-dictionary/src/gdict-pref-dialog.c +++ b/mate-dictionary/src/gdict-pref-dialog.c @@ -579,7 +579,8 @@ gdict_pref_dialog_get_property (GObject *object, } static gboolean -gdict_dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, GtkWindow *window) +on_preferences_notebook_scroll_event (GtkWidget *widget, + GdkEventScroll *event) { GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkWidget *child, *event_widget, *action_widget; @@ -601,39 +602,40 @@ gdict_dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, Gtk if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) return FALSE; + action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_END); if (event_widget == action_widget || (action_widget != NULL && gtk_widget_is_ancestor (event_widget, action_widget))) return FALSE; switch (event->direction) { - case GDK_SCROLL_RIGHT: - case GDK_SCROLL_DOWN: - gtk_notebook_next_page (notebook); - break; - case GDK_SCROLL_LEFT: - case GDK_SCROLL_UP: - gtk_notebook_prev_page (notebook); - break; - case GDK_SCROLL_SMOOTH: - switch (gtk_notebook_get_tab_pos (notebook)) { - case GTK_POS_LEFT: - case GTK_POS_RIGHT: - if (event->delta_y > 0) - gtk_notebook_next_page (notebook); - else if (event->delta_y < 0) - gtk_notebook_prev_page (notebook); + case GDK_SCROLL_RIGHT: + case GDK_SCROLL_DOWN: + gtk_notebook_next_page (notebook); + break; + case GDK_SCROLL_LEFT: + case GDK_SCROLL_UP: + gtk_notebook_prev_page (notebook); break; - case GTK_POS_TOP: - case GTK_POS_BOTTOM: - if (event->delta_x > 0) - gtk_notebook_next_page (notebook); - else if (event->delta_x < 0) - gtk_notebook_prev_page (notebook); + case GDK_SCROLL_SMOOTH: + switch (gtk_notebook_get_tab_pos (notebook)) { + case GTK_POS_LEFT: + case GTK_POS_RIGHT: + if (event->delta_y > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_y < 0) + gtk_notebook_prev_page (notebook); + break; + case GTK_POS_TOP: + case GTK_POS_BOTTOM: + if (event->delta_x > 0) + gtk_notebook_next_page (notebook); + else if (event->delta_x < 0) + gtk_notebook_prev_page (notebook); + break; + } break; } - break; - } return TRUE; } @@ -697,8 +699,10 @@ gdict_pref_dialog_init (GdictPrefDialog *dialog) dialog->notebook = GET_WIDGET ("preferences_notebook"); gtk_widget_add_events (dialog->notebook, GDK_SCROLL_MASK); - g_signal_connect (dialog->notebook, "scroll-event", - G_CALLBACK (gdict_dialog_page_scroll_event_cb), GTK_WINDOW (dialog)); + g_signal_connect (dialog->notebook, + "scroll-event", + G_CALLBACK (on_preferences_notebook_scroll_event), + NULL); dialog->sources_view = GET_WIDGET ("sources_treeview"); build_sources_view (dialog); |