get rid of local GtkSettings variables by moving gtk_widget_get_settings()
2007-03-29 Michael Natterer <mitch@imendio.com> * 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
This commit is contained in:
committed by
Michael Natterer
parent
0cd6108945
commit
bec19a3f73
@ -1,3 +1,9 @@
|
|||||||
|
2007-03-29 Michael Natterer <mitch@imendio.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2007-03-28 Matthias Clasen <mclasen@redhat.com>
|
2007-03-28 Matthias Clasen <mclasen@redhat.com>
|
||||||
|
|
||||||
* modules/printbackends/cups/gtkcupsutils.[hc]:
|
* modules/printbackends/cups/gtkcupsutils.[hc]:
|
||||||
|
|||||||
@ -2560,10 +2560,9 @@ gtk_menu_button_scroll (GtkMenu *menu,
|
|||||||
{
|
{
|
||||||
if (menu->upper_arrow_prelight || menu->lower_arrow_prelight)
|
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,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -3014,16 +3013,14 @@ gtk_menu_do_timeout_scroll (GtkMenu *menu,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gtk_menu_scroll_timeout (gpointer data)
|
gtk_menu_scroll_timeout (gpointer data)
|
||||||
{
|
{
|
||||||
GtkMenu *menu;
|
GtkMenu *menu;
|
||||||
GtkSettings *settings;
|
gboolean touchscreen_mode;
|
||||||
gboolean touchscreen_mode;
|
|
||||||
|
|
||||||
menu = GTK_MENU (data);
|
menu = GTK_MENU (data);
|
||||||
|
|
||||||
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
|
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
|
||||||
g_object_get (settings,
|
|
||||||
"gtk-touchscreen-mode", &touchscreen_mode,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -3035,15 +3032,13 @@ gtk_menu_scroll_timeout (gpointer data)
|
|||||||
static gboolean
|
static gboolean
|
||||||
gtk_menu_scroll_timeout_initial (gpointer data)
|
gtk_menu_scroll_timeout_initial (gpointer data)
|
||||||
{
|
{
|
||||||
GtkMenu *menu;
|
GtkMenu *menu;
|
||||||
GtkSettings *settings;
|
guint timeout;
|
||||||
guint timeout;
|
gboolean touchscreen_mode;
|
||||||
gboolean touchscreen_mode;
|
|
||||||
|
|
||||||
menu = GTK_MENU (data);
|
menu = GTK_MENU (data);
|
||||||
|
|
||||||
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
|
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
|
||||||
g_object_get (settings,
|
|
||||||
"gtk-timeout-repeat", &timeout,
|
"gtk-timeout-repeat", &timeout,
|
||||||
"gtk-touchscreen-mode", &touchscreen_mode,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
@ -3052,7 +3047,9 @@ gtk_menu_scroll_timeout_initial (gpointer data)
|
|||||||
|
|
||||||
gtk_menu_remove_scroll_timeout (menu);
|
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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -3060,20 +3057,19 @@ gtk_menu_scroll_timeout_initial (gpointer data)
|
|||||||
static void
|
static void
|
||||||
gtk_menu_start_scrolling (GtkMenu *menu)
|
gtk_menu_start_scrolling (GtkMenu *menu)
|
||||||
{
|
{
|
||||||
GtkSettings *settings;
|
guint timeout;
|
||||||
guint timeout;
|
gboolean touchscreen_mode;
|
||||||
gboolean touchscreen_mode;
|
|
||||||
|
|
||||||
settings = gtk_widget_get_settings (GTK_WIDGET (menu));
|
g_object_get (gtk_widget_get_settings (GTK_WIDGET (menu)),
|
||||||
g_object_get (settings,
|
|
||||||
"gtk-timeout-repeat", &timeout,
|
"gtk-timeout-repeat", &timeout,
|
||||||
"gtk-touchscreen-mode", &touchscreen_mode,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
|
gtk_menu_do_timeout_scroll (menu, touchscreen_mode);
|
||||||
|
|
||||||
menu->timeout_id = gdk_threads_add_timeout (timeout, gtk_menu_scroll_timeout_initial,
|
menu->timeout_id = gdk_threads_add_timeout (timeout,
|
||||||
menu);
|
gtk_menu_scroll_timeout_initial,
|
||||||
|
menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -3114,17 +3110,16 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
|||||||
guint vertical_padding;
|
guint vertical_padding;
|
||||||
gint top_x, top_y;
|
gint top_x, top_y;
|
||||||
gint win_x, win_y;
|
gint win_x, win_y;
|
||||||
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu));
|
|
||||||
gboolean touchscreen_mode;
|
gboolean touchscreen_mode;
|
||||||
gint scroll_arrow_height;
|
gint scroll_arrow_height;
|
||||||
|
|
||||||
priv = gtk_menu_get_private (menu);
|
priv = gtk_menu_get_private (menu);
|
||||||
|
|
||||||
menu_shell = GTK_MENU_SHELL (menu);
|
menu_shell = GTK_MENU_SHELL (menu);
|
||||||
|
|
||||||
gdk_drawable_get_size (GTK_WIDGET (menu)->window, &width, &height);
|
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,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -3219,8 +3214,9 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
|||||||
|
|
||||||
menu->timeout_id =
|
menu->timeout_id =
|
||||||
gdk_threads_add_timeout (scroll_fast ?
|
gdk_threads_add_timeout (scroll_fast ?
|
||||||
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
|
MENU_SCROLL_TIMEOUT2 :
|
||||||
gtk_menu_scroll_timeout, menu);
|
MENU_SCROLL_TIMEOUT1,
|
||||||
|
gtk_menu_scroll_timeout, menu);
|
||||||
}
|
}
|
||||||
else if (!enter && !in_arrow && menu->upper_arrow_prelight)
|
else if (!enter && !in_arrow && menu->upper_arrow_prelight)
|
||||||
{
|
{
|
||||||
@ -3313,8 +3309,9 @@ gtk_menu_handle_scrolling (GtkMenu *menu,
|
|||||||
|
|
||||||
menu->timeout_id =
|
menu->timeout_id =
|
||||||
gdk_threads_add_timeout (scroll_fast ?
|
gdk_threads_add_timeout (scroll_fast ?
|
||||||
MENU_SCROLL_TIMEOUT2 : MENU_SCROLL_TIMEOUT1,
|
MENU_SCROLL_TIMEOUT2 :
|
||||||
gtk_menu_scroll_timeout, menu);
|
MENU_SCROLL_TIMEOUT1,
|
||||||
|
gtk_menu_scroll_timeout, menu);
|
||||||
}
|
}
|
||||||
else if (!enter && !in_arrow && menu->lower_arrow_prelight)
|
else if (!enter && !in_arrow && menu->lower_arrow_prelight)
|
||||||
{
|
{
|
||||||
@ -3335,11 +3332,10 @@ static gboolean
|
|||||||
gtk_menu_enter_notify (GtkWidget *widget,
|
gtk_menu_enter_notify (GtkWidget *widget,
|
||||||
GdkEventCrossing *event)
|
GdkEventCrossing *event)
|
||||||
{
|
{
|
||||||
GtkSettings *settings = gtk_widget_get_settings (widget);
|
|
||||||
GtkWidget *menu_item;
|
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,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
@ -3669,7 +3665,8 @@ gtk_menu_set_submenu_navigation_region (GtkMenu *menu,
|
|||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
menu->navigation_timeout = gdk_threads_add_timeout (popdown_delay,
|
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
|
#ifdef DRAW_STAY_UP_TRIANGLE
|
||||||
draw_stay_up_triangle (gdk_get_default_root_window(),
|
draw_stay_up_triangle (gdk_get_default_root_window(),
|
||||||
@ -3941,15 +3938,14 @@ gtk_menu_remove_scroll_timeout (GtkMenu *menu)
|
|||||||
static void
|
static void
|
||||||
gtk_menu_stop_scrolling (GtkMenu *menu)
|
gtk_menu_stop_scrolling (GtkMenu *menu)
|
||||||
{
|
{
|
||||||
GtkSettings *settings = gtk_widget_get_settings (GTK_WIDGET (menu));
|
|
||||||
gboolean touchscreen_mode;
|
gboolean touchscreen_mode;
|
||||||
|
|
||||||
gtk_menu_remove_scroll_timeout (menu);
|
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,
|
"gtk-touchscreen-mode", &touchscreen_mode,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (!touchscreen_mode)
|
if (!touchscreen_mode)
|
||||||
{
|
{
|
||||||
menu->upper_arrow_prelight = FALSE;
|
menu->upper_arrow_prelight = FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user