From aeb42ecc43d98506be4b629b30195888924a0c77 Mon Sep 17 00:00:00 2001 From: Alberto Garcia Date: Fri, 27 Feb 2009 15:36:16 +0000 Subject: [PATCH] 2009-02-27 Alberto Garcia * doc/hildon-sections.txt * src/hildon-app-menu.h * src/hildon-app-menu.c (+hildon_app_menu_popup): New function to pop up a HildonAppMenu * src/hildon-stackable-window.c (hildon_stackable_window_toggle_menu): Use hildon_app_menu_popup() to show the menu. --- ChangeLog | 11 +++++++++++ doc/hildon-sections.txt | 1 + src/hildon-app-menu.c | 21 ++++++++++++++++++++- src/hildon-app-menu.h | 4 ++++ src/hildon-stackable-window.c | 3 +-- 5 files changed, 37 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fff2001..6dfe251 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 2009-02-27 Alberto Garcia + * doc/hildon-sections.txt + * src/hildon-app-menu.h + * src/hildon-app-menu.c (+hildon_app_menu_popup): + New function to pop up a HildonAppMenu + + * src/hildon-stackable-window.c + (hildon_stackable_window_toggle_menu): + Use hildon_app_menu_popup() to show the menu. + +2009-02-27 Alberto Garcia + * src/hildon-app-menu.c (hildon_app_menu_show) (hildon_app_menu_map, +hildon_app_menu_find_intruder): Hide the menu if there's another window between it and its parent window. diff --git a/doc/hildon-sections.txt b/doc/hildon-sections.txt index 6428b03..82e5e6b 100644 --- a/doc/hildon-sections.txt +++ b/doc/hildon-sections.txt @@ -358,6 +358,7 @@ hildon_app_menu_prepend hildon_app_menu_insert hildon_app_menu_reorder_child hildon_app_menu_add_filter +hildon_app_menu_popup HILDON_APP_MENU HILDON_IS_APP_MENU diff --git a/src/hildon-app-menu.c b/src/hildon-app-menu.c index efee3d6..28b09ba 100644 --- a/src/hildon-app-menu.c +++ b/src/hildon-app-menu.c @@ -35,7 +35,7 @@ * To use a #HildonAppMenu, add it to a #HildonStackableWindow using * hildon_stackable_window_set_main_menu(). The menu will appear when * the user presses the window title bar. Alternatively, you can show - * it by hand using gtk_widget_show(). + * it by hand using hildon_app_menu_popup(). * * The menu will be automatically hidden when one of its buttons is * clicked. Use g_signal_connect_after() when connecting callbacks to @@ -875,6 +875,25 @@ hildon_app_menu_repack_items (HildonAppMenu *menu, } } +/** + * hildon_app_menu_popup: + * @menu: a #HildonAppMenu + * @parent_window: a #GtkWindow + * + * Displays a menu on top of a window and makes it available for + * selection. + **/ +void +hildon_app_menu_popup (HildonAppMenu *menu, + GtkWindow *parent_window) +{ + g_return_if_fail (HILDON_IS_APP_MENU (menu)); + g_return_if_fail (GTK_IS_WINDOW (parent_window)); + + hildon_app_menu_set_parent_window (menu, parent_window); + gtk_widget_show (GTK_WIDGET (menu)); +} + static void hildon_app_menu_init (HildonAppMenu *menu) { diff --git a/src/hildon-app-menu.h b/src/hildon-app-menu.h index e59267c..8962817 100644 --- a/src/hildon-app-menu.h +++ b/src/hildon-app-menu.h @@ -88,6 +88,10 @@ void hildon_app_menu_add_filter (HildonAppMenu *menu, GtkButton *filter); +void +hildon_app_menu_popup (HildonAppMenu *menu, + GtkWindow *parent_window); + G_END_DECLS #endif /* __HILDON_APP_MENU_H__ */ diff --git a/src/hildon-stackable-window.c b/src/hildon-stackable-window.c index 7191533..3cfe9da 100644 --- a/src/hildon-stackable-window.c +++ b/src/hildon-stackable-window.c @@ -212,8 +212,7 @@ hildon_stackable_window_toggle_menu (HildonWindow *self, if (GTK_WIDGET_MAPPED (GTK_WIDGET (menu_to_use))) { gtk_widget_hide (GTK_WIDGET (menu_to_use)); } else { - hildon_app_menu_set_parent_window (menu_to_use, GTK_WINDOW (self)); - gtk_widget_show (GTK_WIDGET (menu_to_use)); + hildon_app_menu_popup (menu_to_use, GTK_WINDOW (self)); } return TRUE; -- 1.7.9.5