[gnumeric] GUI: Improve consistency when moving toolbars around.
- From: Morten Welinder <mortenw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI: Improve consistency when moving toolbars around.
- Date: Fri, 25 Sep 2009 00:32:05 +0000 (UTC)
commit c6db0f1e5650be4878afeb15a966c6db441aedaf
Author: Morten Welinder <terra gnome org>
Date: Thu Sep 24 20:31:30 2009 -0400
GUI: Improve consistency when moving toolbars around.
ChangeLog | 5 +++++
NEWS | 1 +
src/wbc-gtk.c | 29 +++++++++++++++++++++++++----
3 files changed, 31 insertions(+), 4 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1ad0335..d9a5081 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-09-24 Morten Welinder <terra gnome org>
+
+ * src/wbc-gtk.c (set_toolbar_position): When moving to a new
+ position, preserve the original order.
+
2009-09-24 Andreas J. Guelzow <aguelzow pyrshep ca>
* src/gnm-pane.c (set_acetate_coords): set the acetate item really
diff --git a/NEWS b/NEWS
index 257c2fa..e382522 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,7 @@ Morten:
* Fix inter-process pasting of merged regions.
* Make inter-process pasting use the sax parser.
* Make auto-format templates use the sax parser.
+ * Improve consistency when moving toolbars around.
--------------------------------------------------------------------------
Gnumeric 1.9.13
diff --git a/src/wbc-gtk.c b/src/wbc-gtk.c
index 209388a..6245bd7 100644
--- a/src/wbc-gtk.c
+++ b/src/wbc-gtk.c
@@ -3472,6 +3472,10 @@ set_toolbar_position (GtkToolbar *tb, GtkPositionType pos, WBCGtk *gtk)
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 (box), "name");
+ const char *key = "toolbar-order";
+ int n = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (box), key));
+ GList *children, *l;
+ int cpos = 0;
if (zone == new_zone)
return;
@@ -3480,7 +3484,18 @@ set_toolbar_position (GtkToolbar *tb, GtkPositionType pos, WBCGtk *gtk)
if (zone)
gtk_container_remove (zone, box);
set_toolbar_style_for_position (tb, pos);
+
+ children = gtk_container_get_children (new_zone);
+ for (l = children; l; l = l->next) {
+ GObject *child = l->data;
+ int nc = GPOINTER_TO_INT (g_object_get_data (child, key));
+ if (nc < n) cpos++;
+ }
+ g_list_free (children);
+
gtk_container_add (new_zone, box);
+ gtk_container_child_set (new_zone, box, "position", cpos, NULL);
+
g_object_unref (box);
if (zone)
@@ -3635,13 +3650,14 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
char *toggle_name = g_strconcat ("ViewMenuToolbar", name, NULL);
char *tooltip = g_strdup_printf (_("Show/Hide toolbar %s"), _(name));
gboolean visible = gnm_conf_get_toolbar_visible (name);
+ int n = g_hash_table_size (wbcg->visibility_widgets);
+ GtkWidget *vw;
#ifdef GNM_USE_HILDON
hildon_window_add_toolbar (HILDON_WINDOW (wbcg_toplevel (wbcg)), GTK_TOOLBAR (w));
gtk_widget_show_all (w);
- g_hash_table_insert (wbcg->visibility_widgets,
- g_strdup (toggle_name), g_object_ref (w));
+ vw = w;
#else
GtkWidget *box;
GtkPositionType pos = gnm_conf_get_toolbar_position (name);
@@ -3667,6 +3683,8 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
gtk_widget_show_all (box);
if (!visible)
gtk_widget_hide (box);
+ g_object_set_data (G_OBJECT (box), "toolbar-order",
+ GINT_TO_POINTER (n));
set_toolbar_position (GTK_TOOLBAR (w), pos, gtk);
g_signal_connect (box,
@@ -3677,9 +3695,12 @@ cb_add_menus_toolbars (G_GNUC_UNUSED GtkUIManager *ui,
g_strdup (name),
(GDestroyNotify)g_free);
- g_hash_table_insert (wbcg->visibility_widgets,
- g_strdup (toggle_name), g_object_ref (box));
+ vw = box;
#endif
+ g_hash_table_insert (wbcg->visibility_widgets,
+ g_strdup (toggle_name),
+ g_object_ref (vw));
+
gtk_toolbar_set_show_arrow (GTK_TOOLBAR (w), TRUE);
gtk_toolbar_set_style (GTK_TOOLBAR (w), GTK_TOOLBAR_ICONS);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]