From bec19a3f73aae747bee8c35da243e66e2178c9ab Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Thu, 29 Mar 2007 08:14:22 +0000 Subject: get rid of local GtkSettings variables by moving gtk_widget_get_settings() 2007-03-29 Michael Natterer * gtk/gtkmenu.c: get rid of local GtkSettings variables by moving gtk_widget_get_settings() into the g_object_get() call. Some small indentation fixes. svn path=/trunk/; revision=17570 --- gtk/gtkmenu.c | 72 ++++++++++++++++++++++++++++------------------------------- 1 file changed, 34 insertions(+), 38 deletions(-) (limited to 'gtk/gtkmenu.c') diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c index 02a78a239d..93214ac438 100644 --- a/gtk/gtkmenu.c +++ b/gtk/gtkmenu.c @@ -2560,10 +2560,9 @@ gtk_menu_button_scroll (GtkMenu *menu, { if (menu->upper_arrow_prelight || menu->lower_arrow_prelight) { - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu)); - gboolean touchscreen_mode; + gboolean touchscreen_mode; - g_object_get (G_OBJECT (settings), + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-touchscreen-mode", &touchscreen_mode, NULL); @@ -3014,16 +3013,14 @@ gtk_menu_do_timeout_scroll (GtkMenu *menu, } static gboolean -gtk_menu_scroll_timeout (gpointer data) +gtk_menu_scroll_timeout (gpointer data) { - GtkMenu *menu; - GtkSettings *settings; - gboolean touchscreen_mode; + GtkMenu *menu; + gboolean touchscreen_mode; menu = GTK_MENU (data); - settings = gtk_widget_get_settings (GTK_WIDGET (menu)); - g_object_get (settings, + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-touchscreen-mode", &touchscreen_mode, NULL); @@ -3035,15 +3032,13 @@ gtk_menu_scroll_timeout (gpointer data) static gboolean gtk_menu_scroll_timeout_initial (gpointer data) { - GtkMenu *menu; - GtkSettings *settings; - guint timeout; - gboolean touchscreen_mode; + GtkMenu *menu; + guint timeout; + gboolean touchscreen_mode; menu = GTK_MENU (data); - settings = gtk_widget_get_settings (GTK_WIDGET (menu)); - g_object_get (settings, + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-timeout-repeat", &timeout, "gtk-touchscreen-mode", &touchscreen_mode, NULL); @@ -3052,7 +3047,9 @@ gtk_menu_scroll_timeout_initial (gpointer data) gtk_menu_remove_scroll_timeout (menu); - menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout, menu); + menu->timeout_id = gdk_threads_add_timeout (timeout, + gtk_menu_scroll_timeout, + menu); return FALSE; } @@ -3060,20 +3057,19 @@ gtk_menu_scroll_timeout_initial (gpointer data) static void gtk_menu_start_scrolling (GtkMenu *menu) { - GtkSettings *settings; - guint timeout; - gboolean touchscreen_mode; + guint timeout; + gboolean touchscreen_mode; - settings = gtk_widget_get_settings (GTK_WIDGET (menu)); - g_object_get (settings, + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-timeout-repeat", &timeout, "gtk-touchscreen-mode", &touchscreen_mode, NULL); gtk_menu_do_timeout_scroll (menu, touchscreen_mode); - menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial, - menu); + menu->timeout_id = gdk_threads_add_timeout (timeout, + gtk_menu_scroll_timeout_initial, + menu); } static gboolean @@ -3114,17 +3110,16 @@ gtk_menu_handle_scrolling (GtkMenu *menu, guint vertical_padding; gint top_x, top_y; gint win_x, win_y; - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu)); gboolean touchscreen_mode; gint scroll_arrow_height; - + priv = gtk_menu_get_private (menu); menu_shell = GTK_MENU_SHELL (menu); gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height); - g_object_get (G_OBJECT (settings), + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-touchscreen-mode", &touchscreen_mode, NULL); @@ -3219,8 +3214,9 @@ gtk_menu_handle_scrolling (GtkMenu *menu, menu->timeout_id = gdk_threads_add_timeout (scroll_fast ? - MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1, - gtk_menu_scroll_timeout, menu); + MENU_SCROLL_TIMEOUT2 : + MENU_SCROLL_TIMEOUT1, + gtk_menu_scroll_timeout, menu); } else if (!enter && !in_arrow && menu->upper_arrow_prelight) { @@ -3313,8 +3309,9 @@ gtk_menu_handle_scrolling (GtkMenu *menu, menu->timeout_id = gdk_threads_add_timeout (scroll_fast ? - MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1, - gtk_menu_scroll_timeout, menu); + MENU_SCROLL_TIMEOUT2 : + MENU_SCROLL_TIMEOUT1, + gtk_menu_scroll_timeout, menu); } else if (!enter && !in_arrow && menu->lower_arrow_prelight) { @@ -3335,11 +3332,10 @@ static gboolean gtk_menu_enter_notify (GtkWidget *widget, GdkEventCrossing *event) { - GtkSettings *settings = gtk_widget_get_settings (widget); GtkWidget *menu_item; - gboolean touchscreen_mode; + gboolean touchscreen_mode; - g_object_get (G_OBJECT (settings), + g_object_get (gtk_widget_get_settings (widget), "gtk-touchscreen-mode", &touchscreen_mode, NULL); @@ -3669,7 +3665,8 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu, NULL); menu->navigation_timeout = gdk_threads_add_timeout (popdown_delay, - gtk_menu_stop_navigating_submenu_cb, menu); + gtk_menu_stop_navigating_submenu_cb, + menu); #ifdef DRAW_STAY_UP_TRIANGLE draw_stay_up_triangle (gdk_get_default_root_window(), @@ -3941,15 +3938,14 @@ gtk_menu_remove_scroll_timeout (GtkMenu *menu) static void gtk_menu_stop_scrolling (GtkMenu *menu) { - GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu)); gboolean touchscreen_mode; gtk_menu_remove_scroll_timeout (menu); - - g_object_get (G_OBJECT (settings), + + g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)), "gtk-touchscreen-mode", &touchscreen_mode, NULL); - + if (!touchscreen_mode) { menu->upper_arrow_prelight = FALSE; -- cgit v1.2.1