aboutsummaryrefslogtreecommitdiff
path: root/hildon/hildon-program.c
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2009-09-10 20:24:52 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2009-09-11 20:18:03 +0300
commita9a9c6c5c73ba1727b907167026559ceb7208b99 (patch)
treedc277e132b85ff2e8d65c72002a215809d8c22eb /hildon/hildon-program.c
parent6696a0a800310922a4e1511d6e07a4bc75494941 (diff)
Update the application menu flag for application-wise windows
* hildon/hildon-program.c: (+hildon_program_on_common_app_menu_changed), (hildon_program_set_common_app_menu): Also take into account the visibility of its items.
Diffstat (limited to 'hildon/hildon-program.c')
-rw-r--r--hildon/hildon-program.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/hildon/hildon-program.c b/hildon/hildon-program.c
index 0174e16..f2b1906 100644
--- a/hildon/hildon-program.c
+++ b/hildon/hildon-program.c
@@ -696,6 +696,14 @@ hildon_program_get_common_menu (HildonProgram *self)
return priv->common_menu;
}
+static void
+hildon_program_on_common_app_menu_changed (HildonAppMenu *menu,
+ HildonProgram *program)
+{
+ hildon_program_set_common_menu_flag (program,
+ hildon_app_menu_has_visible_children (menu));
+}
+
/**
* hildon_program_set_common_app_menu:
* @self: The #HildonProgram in which the common menu should be used
@@ -730,20 +738,28 @@ hildon_program_set_common_app_menu (HildonProgram *self,
/* Only set the menu flag if there was no common menu and
we are setting one. If we are unsetting the current common menu,
remove the commmon menu flag. Otherwise, nothing to do. */
- if (!priv->common_app_menu && menu) {
+ if (!priv->common_app_menu
+ && menu && hildon_app_menu_has_visible_children (menu)) {
hildon_program_set_common_menu_flag (self, TRUE);
- } else if (priv->common_app_menu && !menu) {
+ } else if (priv->common_app_menu &&
+ (!menu || !hildon_app_menu_has_visible_children (menu))) {
hildon_program_set_common_menu_flag (self, FALSE);
}
/* Set new menu */
priv->common_app_menu = menu;
- if (menu)
+ if (menu) {
+ g_signal_connect (menu, "changed",
+ G_CALLBACK (hildon_program_on_common_app_menu_changed), self);
g_object_ref_sink (menu);
+ }
/* Hide and unref old menu */
if (old_menu) {
hildon_app_menu_set_parent_window (old_menu, NULL);
+ g_signal_handlers_disconnect_by_func (old_menu,
+ hildon_program_on_common_app_menu_changed,
+ self);
g_object_unref (old_menu);
}
}