Do not like GtkContainer's children list
authorClaudio Saavedra <csaavedra@igalia.com>
Fri, 11 Sep 2009 09:48:52 +0000 (12:48 +0300)
committerClaudio Saavedra <csaavedra@igalia.com>
Fri, 11 Sep 2009 09:48:52 +0000 (12:48 +0300)
hildon/hildon-program.c
hildon/hildon-window.c

index 90954f3..4134d65 100644 (file)
@@ -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;
 
index bd84c32..d2be1c9 100644 (file)
@@ -1364,8 +1364,8 @@ 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);
         }
     }
 }