[maemo-commits] [maemo-commits] r15225 - in projects/haf/trunk/hildon-1: . doc examples src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Mon Feb 25 22:30:32 EET 2008
Author: herzi
Date: 2008-02-25 22:30:17 +0200 (Mon, 25 Feb 2008)
New Revision: 15225

Modified:
   projects/haf/trunk/hildon-1/ChangeLog
   projects/haf/trunk/hildon-1/doc/Makefile.am
   projects/haf/trunk/hildon-1/examples/hildon-window-menu-example.c
   projects/haf/trunk/hildon-1/src/hildon-window.c
   projects/haf/trunk/hildon-1/src/hildon-window.h
Log:
2008-02-25  Sven Herzberg  <sven at 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



Modified: projects/haf/trunk/hildon-1/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-1/ChangeLog	2008-02-25 09:21:19 UTC (rev 15224)
+++ projects/haf/trunk/hildon-1/ChangeLog	2008-02-25 20:30:17 UTC (rev 15225)
@@ -1,3 +1,19 @@
+2008-02-25  Sven Herzberg  <sven at 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 at nokia.com>
 
 	[2.0.1-1 release]

Modified: projects/haf/trunk/hildon-1/doc/Makefile.am
===================================================================
--- projects/haf/trunk/hildon-1/doc/Makefile.am	2008-02-25 09:21:19 UTC (rev 15224)
+++ projects/haf/trunk/hildon-1/doc/Makefile.am	2008-02-25 20:30:17 UTC (rev 15225)
@@ -8,7 +8,7 @@
 
 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)"
 

Modified: projects/haf/trunk/hildon-1/examples/hildon-window-menu-example.c
===================================================================
--- projects/haf/trunk/hildon-1/examples/hildon-window-menu-example.c	2008-02-25 09:21:19 UTC (rev 15224)
+++ projects/haf/trunk/hildon-1/examples/hildon-window-menu-example.c	2008-02-25 20:30:17 UTC (rev 15225)
@@ -41,9 +41,10 @@
 
     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));

Modified: projects/haf/trunk/hildon-1/src/hildon-window.c
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-window.c	2008-02-25 09:21:19 UTC (rev 15224)
+++ projects/haf/trunk/hildon-1/src/hildon-window.c	2008-02-25 20:30:17 UTC (rev 15225)
@@ -1817,19 +1817,21 @@
 }
 
 /**
- * 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 @@
         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
  * 

Modified: projects/haf/trunk/hildon-1/src/hildon-window.h
===================================================================
--- projects/haf/trunk/hildon-1/src/hildon-window.h	2008-02-25 09:21:19 UTC (rev 15224)
+++ projects/haf/trunk/hildon-1/src/hildon-window.h	2008-02-25 20:30:17 UTC (rev 15225)
@@ -98,9 +98,15 @@
 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,


More information about the maemo-commits mailing list