r17538 - gnucash/branches/2.2/src/gnome - [r17440, r17469] Usability: Price/Security Editor: Expand/Collapse non-leaf rows is double-clicked.

Andreas Köhler andi5 at cvs.gnucash.org
Wed Sep 17 10:50:34 EDT 2008


Author: andi5
Date: 2008-09-17 10:50:33 -0400 (Wed, 17 Sep 2008)
New Revision: 17538
Trac: http://svn.gnucash.org/trac/changeset/17538

Modified:
   gnucash/branches/2.2/src/gnome/dialog-commodities.c
   gnucash/branches/2.2/src/gnome/dialog-price-edit-db.c
Log:
[r17440,r17469] Usability: Price/Security Editor: Expand/Collapse non-leaf rows is double-clicked.

Previously, nothing happened when a namespace (or commodity in the price editor)
row was activated.  Now these rows will expand or collapse.  It is often easier
to double-click the row than hunt for the expander.

Committed by cedayiv.

Modified: gnucash/branches/2.2/src/gnome/dialog-commodities.c
===================================================================
--- gnucash/branches/2.2/src/gnome/dialog-commodities.c	2008-09-17 14:50:25 UTC (rev 17537)
+++ gnucash/branches/2.2/src/gnome/dialog-commodities.c	2008-09-17 14:50:33 UTC (rev 17538)
@@ -92,7 +92,27 @@
 row_activated_cb (GtkTreeView *view, GtkTreePath *path,
                   GtkTreeViewColumn *column, CommoditiesDialog *cd)
 {
-  edit_clicked (cd);
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  g_return_if_fail(view);
+
+  model = gtk_tree_view_get_model(view);
+  if (gtk_tree_model_get_iter(model, &iter, path))
+  {
+    if (gtk_tree_model_iter_has_child(model, &iter))
+    {
+      /* There are children, so it's not a commodity.
+       * Just expand or collapse the row. */
+      if (gtk_tree_view_row_expanded(view, path))
+        gtk_tree_view_collapse_row(view, path);
+      else
+        gtk_tree_view_expand_row(view, path, FALSE);
+    }
+    else
+      /* It's a commodity, so click the Edit button. */
+      edit_clicked(cd);
+  }
 }
 
 static void

Modified: gnucash/branches/2.2/src/gnome/dialog-price-edit-db.c
===================================================================
--- gnucash/branches/2.2/src/gnome/dialog-price-edit-db.c	2008-09-17 14:50:25 UTC (rev 17537)
+++ gnucash/branches/2.2/src/gnome/dialog-price-edit-db.c	2008-09-17 14:50:33 UTC (rev 17538)
@@ -355,7 +355,27 @@
 row_activated_cb (GtkTreeView *view, GtkTreePath *path,
 		  GtkTreeViewColumn *column, gpointer data)
 {
-  gnc_prices_dialog_edit_clicked (GTK_WIDGET (view), data);
+  GtkTreeModel *model;
+  GtkTreeIter iter;
+
+  g_return_if_fail(view);
+
+  model = gtk_tree_view_get_model(view);
+  if (gtk_tree_model_get_iter(model, &iter, path))
+  {
+    if (gtk_tree_model_iter_has_child(model, &iter))
+    {
+      /* There are children, so it's not a price.
+       * Just expand or collapse the row. */
+      if (gtk_tree_view_row_expanded(view, path))
+        gtk_tree_view_collapse_row(view, path);
+      else
+        gtk_tree_view_expand_row(view, path, FALSE);
+    }
+    else
+      /* It's a price, so click the Edit button. */
+      gnc_prices_dialog_edit_clicked(GTK_WIDGET(view), data);
+  }
 }
 
 static void



More information about the gnucash-changes mailing list