aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Saavedra <csaavedra@igalia.com>2009-09-11 18:18:12 +0300
committerClaudio Saavedra <csaavedra@igalia.com>2009-09-11 20:18:03 +0300
commitb45dddd7902bdd17946a12633d3b29c3a7cab10f (patch)
treef07da12508de77c68571bdce1bd770535693f6f2
parenta9a9c6c5c73ba1727b907167026559ceb7208b99 (diff)
Do not set any flag for empty legacy menus
* hildon/hildon-program.c: (hildon_program_set_common_menu): * hildon/hildon-window.c: (hildon_window_update_menu_flag): This will probably not work fine with empty legacy menus added to programs or windows and populated later, but so it's life.
-rw-r--r--ChangeLog9
-rw-r--r--hildon/hildon-program.c10
-rw-r--r--hildon/hildon-window.c5
3 files changed, 20 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 72839c4..7a6b893 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-09-11 Claudio Saavedra <csaavedra@igalia.com>
+
+ Do not set any flag for empty legacy menus
+
+ * hildon/hildon-program.c: (hildon_program_set_common_menu):
+ * hildon/hildon-window.c: (hildon_window_update_menu_flag):
+ This will probably not work fine with empty legacy menus added to
+ programs or windows and populated later, but so it's life.
+
2009-09-10 Claudio Saavedra <csaavedra@igalia.com>
Update the application menu flag for application-wise windows
diff --git a/hildon/hildon-program.c b/hildon/hildon-program.c
index f2b1906..33205f0 100644
--- a/hildon/hildon-program.c
+++ b/hildon/hildon-program.c
@@ -658,11 +658,17 @@ hildon_program_set_common_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_menu && menu) {
+
+ GList *menu_children = gtk_container_get_children (GTK_CONTAINER (menu));
+ if (!priv->common_menu
+ && menu && menu_children != NULL) {
hildon_program_set_common_menu_flag (self, TRUE);
- } else if (priv->common_menu && !menu) {
+ } else if (priv->common_menu &&
+ (!menu || menu_children == NULL))
+ {
hildon_program_set_common_menu_flag (self, FALSE);
}
+ g_list_free (menu_children);
priv->common_menu = menu;
diff --git a/hildon/hildon-window.c b/hildon/hildon-window.c
index bd84c32..3d70b02 100644
--- a/hildon/hildon-window.c
+++ b/hildon/hildon-window.c
@@ -1364,8 +1364,9 @@ hildon_window_update_menu_flag (HildonWindow *self,
} else {
if (!priv->program || !hildon_program_get_common_menu (priv->program))
{
- hildon_window_set_menu_flag (self, priv->menu != NULL
- && gtk_container_get_children (GTK_CONTAINER (priv->menu)));
+ GList *menu_children = gtk_container_get_children (GTK_CONTAINER (priv->menu));
+ hildon_window_set_menu_flag (self, priv->menu != NULL && menu_children != NULL);
+ g_free (menu_children);
}
}
}