gnumeric r16460 - in trunk: . src



Author: mortenw
Date: Mon Mar 10 13:58:03 2008
New Revision: 16460
URL: http://svn.gnome.org/viewvc/gnumeric?rev=16460&view=rev

Log:
2008-03-10  Morten Welinder  <terra gnome org>

	* configure.in (ALL_LINGUAS): Undo last change.  It breaks the
	build.

	* src/wbc-gtk.c (cb_add_menus_toolbars): Honour
	/desktop/gnome/interface/toolbar_detachable.  Patch from Nick
	Lamb.  Fixes #321867.



Modified:
   trunk/ChangeLog
   trunk/NEWS
   trunk/configure.in
   trunk/src/wbc-gtk.c

Modified: trunk/NEWS
==============================================================================
--- trunk/NEWS	(original)
+++ trunk/NEWS	Mon Mar 10 13:58:03 2008
@@ -53,6 +53,9 @@
 	* Fix corrupted-gnumeric-bug.  [#519761]
 	* Fix insert-time problem.
 
+Nick Lamb:
+	* Honour detachable-toolbar preference.  [#321867]
+
 Uwe Steinmann:
 	* Paradox DB export.
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Mar 10 13:58:03 2008
@@ -642,7 +642,8 @@
   If you only add one to po/, the build will break in po-functions/.
 ])
 # "id" can go back when there is a po-function translation too.
-AC_SUBST(ALL_LINGUAS, "am ar az bg ca cs da de dz el en_CA en_GB es et fi fr ga gl he hr hu it ja ko lt lv mk ml mr ms nb ne nl nn oc pl pt pt_BR ro ru rw sk sr sr Latn sv te tr uk vi zh_CN zh_HK zh_TW")
+# "zh_HK" can go back when there is a po-function translation too.
+AC_SUBST(ALL_LINGUAS, "am ar az bg ca cs da de dz el en_CA en_GB es et fi fr ga gl he hr hu it ja ko lt lv mk ml mr ms nb ne nl nn oc pl pt pt_BR ro ru rw sk sr sr Latn sv te tr uk vi zh_CN zh_TW")
 
 POFILES_FULL=
 for lang in $ALL_LINGUAS; do

Modified: trunk/src/wbc-gtk.c
==============================================================================
--- trunk/src/wbc-gtk.c	(original)
+++ trunk/src/wbc-gtk.c	Mon Mar 10 13:58:03 2008
@@ -3049,38 +3049,43 @@
 static void
 set_toolbar_style_for_position (GtkToolbar *tb, GtkPositionType pos)
 {
-	GtkHandleBox *hdlbox = GTK_HANDLE_BOX (GTK_WIDGET (tb)->parent);
+	GtkWidget *box = GTK_WIDGET (tb)->parent;
 
-	static const GtkPositionType hdlpos[] = {
-		GTK_POS_TOP, GTK_POS_TOP,
-		GTK_POS_LEFT, GTK_POS_LEFT
-	};
 	static const GtkOrientation orientations[] = {
 		GTK_ORIENTATION_VERTICAL, GTK_ORIENTATION_VERTICAL,
 		GTK_ORIENTATION_HORIZONTAL, GTK_ORIENTATION_HORIZONTAL
 	};
 
 	gtk_toolbar_set_orientation (tb, orientations[pos]);
-	gtk_handle_box_set_handle_position (hdlbox, hdlpos[pos]);
+
+	if (GTK_IS_HANDLE_BOX (box)) {
+		static const GtkPositionType hdlpos[] = {
+			GTK_POS_TOP, GTK_POS_TOP,
+			GTK_POS_LEFT, GTK_POS_LEFT
+		};
+
+		gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (box),
+						    hdlpos[pos]);
+	}
 }
 
 static void
 set_toolbar_position (GtkToolbar *tb, GtkPositionType pos, WBCGtk *gtk)
 {
-	GtkWidget *hdlbox = GTK_WIDGET (tb)->parent;
-	GtkContainer *zone = GTK_CONTAINER (GTK_WIDGET (hdlbox)->parent);
+	GtkWidget *box = GTK_WIDGET (tb)->parent;
+	GtkContainer *zone = GTK_CONTAINER (GTK_WIDGET (box)->parent);
 	GtkContainer *new_zone = GTK_CONTAINER (gtk->toolbar_zones[pos]);
-	char const *name = g_object_get_data (G_OBJECT (hdlbox), "name");
+	char const *name = g_object_get_data (G_OBJECT (box), "name");
 
 	if (zone == new_zone)
 		return;
 
-	g_object_ref (hdlbox);
+	g_object_ref (box);
 	if (zone)
-		gtk_container_remove (zone, hdlbox);
+		gtk_container_remove (zone, box);
 	set_toolbar_style_for_position (tb, pos);
-	gtk_container_add (new_zone, hdlbox);
-	g_object_unref (hdlbox);
+	gtk_container_add (new_zone, box);
+	g_object_unref (box);
 
 	if (zone)
 		gnm_gconf_set_toolbar_position (name, pos);
@@ -3205,8 +3210,8 @@
 }
 
 static void
-cb_handlebox_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
-		      WBCGtk *wbcg)
+cb_toolbar_box_visible (GtkWidget *box, G_GNUC_UNUSED GParamSpec *pspec,
+			WBCGtk *wbcg)
 {
 	GtkToggleAction *toggle_action = g_object_get_data (
 		G_OBJECT (box), "toggle_action");
@@ -3225,7 +3230,7 @@
 		WBCGtk *wbcg = (WBCGtk *)gtk;
 		char const *name = gtk_widget_get_name (w);
 		GtkToggleActionEntry entry;
-		char *toggle_name = g_strdup_printf ("ViewMenuToolbar%s", name);
+		char *toggle_name = g_strconcat ("ViewMenuToolbar", name, NULL);
 		char *tooltip = g_strdup_printf (_("Show/Hide toolbar %s"), _(name));
 		gboolean visible = gnm_gconf_get_toolbar_visible (name);
 
@@ -3236,8 +3241,20 @@
 		g_hash_table_insert (wbcg->visibility_widgets,
 			g_strdup (toggle_name), g_object_ref (w));
 #else
-		GtkWidget *box = gtk_handle_box_new ();
+		GtkWidget *box;
 		GtkPositionType pos = gnm_gconf_get_toolbar_position (name);
+		gboolean toolbars_can_detach = TRUE;
+#ifdef GNM_WITH_GNOME
+		toolbars_can_detach = go_conf_get_bool (NULL, "/desktop/gnome/interface/toolbar_detachable");
+#endif
+		if (toolbars_can_detach) {
+			box = gtk_handle_box_new ();
+			g_object_connect (box,
+				"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
+				"signal::child_detached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (FALSE),
+				NULL);
+		} else
+			box = gtk_hbox_new (FALSE, 2);
 		g_signal_connect (G_OBJECT (w),
 				  "button_press_event",
 				  G_CALLBACK (cb_toolbar_button_press),
@@ -3253,11 +3270,10 @@
 			gtk_widget_hide (box);
 		set_toolbar_position (GTK_TOOLBAR (w), pos, gtk);
 
-		g_object_connect (box,
-			"signal::notify::visible", G_CALLBACK (cb_handlebox_visible), wbcg,
-			"signal::child_attached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (TRUE),
-			"signal::child_detached", G_CALLBACK (cb_handlebox_dock_status), GINT_TO_POINTER (FALSE),
-			NULL);
+		g_signal_connect (box,
+				  "notify::visible",
+				  G_CALLBACK (cb_toolbar_box_visible),
+				  gtk);
 		g_object_set_data_full (G_OBJECT (box), "name",
 					g_strdup (name),
 					(GDestroyNotify)g_free);
@@ -3276,7 +3292,7 @@
 		entry.callback = G_CALLBACK (cb_toolbar_activate);
 		entry.is_active = visible;
 		gtk_action_group_add_toggle_actions (gtk->toolbar.actions,
-			&entry, 1, (WBCGtk *)wbcg);
+			&entry, 1, wbcg);
 		g_object_set_data (G_OBJECT (box), "toggle_action",
 			gtk_action_group_get_action (gtk->toolbar.actions, toggle_name));
 		gtk_ui_manager_add_ui (gtk->ui, gtk->toolbar.merge_id,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]