diff options
author | Paolo Borelli <pborelli@katamail.com> | 2009-01-22 13:12:22 +0000 |
---|---|---|
committer | Paolo Borelli <pborelli@src.gnome.org> | 2009-01-22 13:12:22 +0000 |
commit | 1b6f5b79ff9f2768a1d5e546fedd591d4802b430 (patch) | |
tree | ef1517a7073a753aa893ab3b8fc446870e60bb24 /eel | |
parent | 657283d20a2673d7002f9aa0a2ce38dea45ecb94 (diff) | |
download | nautilus-1b6f5b79ff9f2768a1d5e546fedd591d4802b430.tar.gz |
add utility function to get a GtkMenuToolButton's button
2009-01-22 Paolo Borelli <pborelli@katamail.com>
* eel/eel-gtk-extensions.[ch]: add utility function
to get a GtkMenuToolButton's button
* src/nautilus-window-menus.c:
* src/nautilus-navigation-action.c:
Use the above util function that doesn't leak the children
list.
svn path=/trunk/; revision=14877
Diffstat (limited to 'eel')
-rw-r--r-- | eel/eel-gtk-extensions.c | 20 | ||||
-rw-r--r-- | eel/eel-gtk-extensions.h | 3 |
2 files changed, 23 insertions, 0 deletions
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c index 81b8014a8..8b85ec067 100644 --- a/eel/eel-gtk-extensions.c +++ b/eel/eel-gtk-extensions.c @@ -436,6 +436,26 @@ eel_gtk_menu_set_item_visibility (GtkMenu *menu, int index, gboolean visible) g_list_free (children); } +GtkWidget * +eel_gtk_menu_tool_button_get_button (GtkMenuToolButton *tool_button) +{ + GtkContainer *container; + GList *children; + GtkWidget *button; + + g_return_val_if_fail (GTK_IS_MENU_TOOL_BUTTON (tool_button), NULL); + + /* The menu tool button's button is the first child + * of the child hbox. */ + container = GTK_CONTAINER (gtk_bin_get_child (GTK_BIN (tool_button))); + children = gtk_container_get_children (container); + button = GTK_WIDGET (children->data); + + g_list_free (children); + + return button; +} + gboolean eel_point_in_allocation (const GtkAllocation *allocation, int x, int y) diff --git a/eel/eel-gtk-extensions.h b/eel/eel-gtk-extensions.h index 7bf16024e..f9a662ffe 100644 --- a/eel/eel-gtk-extensions.h +++ b/eel/eel-gtk-extensions.h @@ -111,6 +111,9 @@ void eel_gtk_menu_set_item_visibility (GtkMenu int index, gboolean visible); +/* GtkMenuToolButton */ +GtkWidget * eel_gtk_menu_tool_button_get_button (GtkMenuToolButton *tool_button); + /* GtkLabel */ void eel_gtk_label_make_bold (GtkLabel *label); void eel_gtk_label_set_scale (GtkLabel *label, |