2008-02-25 Sven Herzberg <sven@imendio.com>
authorSven Herzberg <herzi@imendio.com>
Mon, 25 Feb 2008 20:30:17 +0000 (20:30 +0000)
committerSven Herzberg <herzi@imendio.com>
Mon, 25 Feb 2008 20:30:17 +0000 (20:30 +0000)
Fixed: MB#1221: HildonWindow shouldn't call show_all for GtkMenu

* doc/Makefile.am: tell gtk-doc about HILDON_DISABLE_DEPRECATED
* examples/hildon-window-menu-example.c: (main): explicitly show
the menu item
* src/hildon-window.c:
(hildon_window_set_main_menu): moved most of the code from set_menu()
to this place; skipped the call to gtk_widget_show_all(); also didn't
introduce gtk_widget_show() as gtk_menu_popup() will call that anyways
(hildon_window_set_menu): removed most of the code, just keep the
questionable gtk_widget_show_all()
* src/hildon-window.h: added the new function and deprecate the old
one

ChangeLog
doc/Makefile.am
examples/hildon-window-menu-example.c
src/hildon-window.c
src/hildon-window.h

index adb8444..001771e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2008-02-25  Sven Herzberg  <sven@imendio.com>
+
+       Fixed: MB#1221: HildonWindow shouldn't call show_all for GtkMenu
+
+       * doc/Makefile.am: tell gtk-doc about HILDON_DISABLE_DEPRECATED
+       * examples/hildon-window-menu-example.c: (main): explicitly show
+       the menu item
+       * src/hildon-window.c:
+       (hildon_window_set_main_menu): moved most of the code from set_menu()
+       to this place; skipped the call to gtk_widget_show_all(); also didn't
+       introduce gtk_widget_show() as gtk_menu_popup() will call that anyways
+       (hildon_window_set_menu): removed most of the code, just keep the
+       questionable gtk_widget_show_all()
+       * src/hildon-window.h: added the new function and deprecate the old
+       one
+
 2008-01-10  Xan Lopez  <xan.lopez@nokia.com>
 
        [2.0.1-1 release]
index 14cc912..6ae5dc7 100644 (file)
@@ -8,7 +8,7 @@ DOC_MODULE                                      = hildon
 
 DOC_MAIN_SGML_FILE                             = $(DOC_MODULE)-docs.sgml
 
-SCAN_OPTIONS                                   =
+SCAN_OPTIONS                                   =--deprecated-guards="HILDON_DISABLE_DEPRECATED"
 
 SCANOBJ_OPTIONS                                        =--type-init-func="gtk_type_init(0)"
 
index 3aa267b..70b38e0 100644 (file)
@@ -41,9 +41,10 @@ main                                            (int argc,
 
     GtkMenu *menu = GTK_MENU (gtk_menu_new ());
     GtkWidget *menu_item = gtk_menu_item_new_with_label ("Test item");
+    gtk_widget_show (menu_item);
     gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_item);
 
-    hildon_window_set_menu (HILDON_WINDOW (window), menu);
+    hildon_window_set_main_menu (HILDON_WINDOW (window), menu);
 
     g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL);
     gtk_widget_show_all (GTK_WIDGET (window));
index 3b5433d..c03909c 100644 (file)
@@ -1817,19 +1817,21 @@ hildon_window_get_menu                          (HildonWindow * self)
 }
 
 /**
- * hildon_window_set_menu:
+ * hildon_window_set_main_menu:
  * @self: A #HildonWindow
  * @menu: The #GtkMenu to be used for this #HildonWindow
  * 
  * Sets the menu to be used for this window. This menu overrides
  * a program-wide menu that may have been set with
- * hildon_program_set_common_menu. Pass NULL to remove the current
- * menu. HildonWindow takes ownership of the passed menu and you're
+ * hildon_program_set_common_menu(). Pass %NULL to remove the current
+ * menu. #HildonWindow takes ownership of the passed menu and you're
  * not supposed to free it yourself anymore.
+ *
+ * Since: Hildon 2.2
  **/ 
 void
-hildon_window_set_menu                          (HildonWindow *self, 
-                                                 GtkMenu *menu)
+hildon_window_set_main_menu (HildonWindow* self,
+                            GtkMenu     * menu)
 {
     HildonWindowPrivate *priv;
 
@@ -1849,11 +1851,44 @@ hildon_window_set_menu                          (HildonWindow *self,
         gtk_widget_set_name (priv->menu, "menu_force_with_corners");
         gtk_menu_attach_to_widget (GTK_MENU (priv->menu), GTK_WIDGET (self), &detach_menu_func);
         g_object_ref (GTK_MENU (priv->menu));
-        gtk_widget_show_all (GTK_WIDGET (priv->menu));
     }
 }
 
 /**
+ * hildon_window_set_menu:
+ * @self: A #HildonWindow
+ * @menu: The #GtkMenu to be used for this #HildonWindow
+ * 
+ * Sets the menu to be used for this window. This menu overrides
+ * a program-wide menu that may have been set with
+ * hildon_program_set_common_menu. Pass NULL to remove the current
+ * menu. HildonWindow takes ownership of the passed menu and you're
+ * not supposed to free it yourself anymore.
+ *
+ * Note: hildon_window_set_menu() calls gtk_widget_show_all() for the
+ * #GtkMenu. To pass control about visibility to the application
+ * developer, hildon_window_set_main_menu() was introduced, which
+ * doesn't do this.
+ *
+ * Deprecated: Hildon 2.2: use hildon_window_set_main_menu()
+ **/ 
+void
+hildon_window_set_menu                          (HildonWindow *self, 
+                                                 GtkMenu *menu)
+{
+    HildonWindowPrivate *priv;
+
+    g_return_if_fail (HILDON_IS_WINDOW (self));
+
+    hildon_window_set_main_menu (self, menu);
+
+    priv = HILDON_WINDOW_GET_PRIVATE (self);
+
+    if (priv->menu != NULL)
+        gtk_widget_show_all (GTK_WIDGET (priv->menu));
+}
+
+/**
  * hildon_window_get_is_topmost:
  * @self: A #HildonWindow
  * 
index 7ff7dab..36e58f9 100644 (file)
@@ -98,9 +98,15 @@ hildon_window_add_with_scrollbar                (HildonWindow *self,
 GtkMenu*    
 hildon_window_get_menu                          (HildonWindow *self);
 
+void
+hildon_window_set_main_menu                     (HildonWindow *self,
+                                                GtkMenu      *menu);
+
+#ifndef HILDON_DISABLE_DEPRECATED
 void        
 hildon_window_set_menu                          (HildonWindow *self,
                                                  GtkMenu      *menu);
+#endif
 
 void    
 hildon_window_add_toolbar                       (HildonWindow *self,