From 1f08913e3dea33b4cbc738d38190c232fe808a91 Mon Sep 17 00:00:00 2001 From: rbuj Date: Mon, 29 Jun 2020 19:04:08 +0200 Subject: Remove unused variable from gpm_notebook_scroll_event_cb --- src/gpm-common.c | 55 ++++++++++++++++++++++++++-------------------------- src/gpm-common.h | 5 ++--- src/gpm-prefs-core.c | 9 ++++----- src/gpm-statistics.c | 7 ++++--- 4 files changed, 37 insertions(+), 39 deletions(-) (limited to 'src') diff --git a/src/gpm-common.c b/src/gpm-common.c index fedc594..5a9d964 100644 --- a/src/gpm-common.c +++ b/src/gpm-common.c @@ -157,11 +157,9 @@ gpm_help_display (const gchar *link_id) g_free (uri); } -/** - * gpm_dialog_page_scroll_event_cb: - **/ gboolean -gpm_dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, GtkWindow *window) +gpm_notebook_scroll_event_cb (GtkWidget *widget, + GdkEventScroll *event) { GtkNotebook *notebook = GTK_NOTEBOOK (widget); GtkWidget *child, *event_widget, *action_widget; @@ -180,37 +178,38 @@ gpm_dialog_page_scroll_event_cb (GtkWidget *widget, GdkEventScroll *event, GtkWi action_widget = gtk_notebook_get_action_widget (notebook, GTK_PACK_START); 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; diff --git a/src/gpm-common.h b/src/gpm-common.h index 8aeedbc..b2b0b1a 100644 --- a/src/gpm-common.h +++ b/src/gpm-common.h @@ -161,9 +161,8 @@ guint gpm_discrete_from_percent (guint percentage, guint gpm_discrete_to_percent (guint discrete, guint levels); void gpm_help_display (const gchar *link_id); -gboolean gpm_dialog_page_scroll_event_cb (GtkWidget *widget, - GdkEventScroll *event, - GtkWindow *window); +gboolean gpm_notebook_scroll_event_cb (GtkWidget *widget, + GdkEventScroll *event); #ifdef EGG_TEST void gpm_common_test (gpointer data); #endif diff --git a/src/gpm-prefs-core.c b/src/gpm-prefs-core.c index 93177b6..b43dd12 100644 --- a/src/gpm-prefs-core.c +++ b/src/gpm-prefs-core.c @@ -492,7 +492,6 @@ static void prefs_setup_ups (GpmPrefs *prefs) { GtkWidget *notebook; - GtkWidget *window; gint page; const GpmActionPolicy ups_low_actions[] = @@ -524,12 +523,12 @@ prefs_setup_ups (GpmPrefs *prefs) GPM_SETTINGS_SLEEP_DISPLAY_UPS, display_times); - window = gpm_window (prefs); notebook = GET_WIDGET ("notebook_preferences"); gtk_widget_add_events (notebook, GDK_SCROLL_MASK); - g_signal_connect (GTK_NOTEBOOK (notebook), "scroll-event", - G_CALLBACK (gpm_dialog_page_scroll_event_cb), - window); + g_signal_connect (GTK_NOTEBOOK (notebook), + "scroll-event", + G_CALLBACK (gpm_notebook_scroll_event_cb), + NULL); if (prefs->priv->has_ups == FALSE) { page = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), GET_WIDGET ("box_ups")); diff --git a/src/gpm-statistics.c b/src/gpm-statistics.c index bba4081..70b99f6 100644 --- a/src/gpm-statistics.c +++ b/src/gpm-statistics.c @@ -1304,9 +1304,10 @@ main (int argc, char *argv[]) widget = GTK_WIDGET (gtk_builder_get_object (builder, "notebook1")); gtk_widget_add_events (widget, GDK_SCROLL_MASK); - g_signal_connect (widget, "scroll-event", - G_CALLBACK (gpm_dialog_page_scroll_event_cb), - window); + g_signal_connect (widget, + "scroll-event", + G_CALLBACK (gpm_notebook_scroll_event_cb), + NULL); page = g_settings_get_int (settings, GPM_SETTINGS_INFO_PAGE_NUMBER); gtk_notebook_set_current_page (GTK_NOTEBOOK (widget), page); -- cgit v1.2.1