r18406 - gnucash/trunk/src/business/business-gnome - Bug 599324 - Patch: Add double click behaviour to account list in payment dialog

Phil Longstaff plongstaff at code.gnucash.org
Sun Nov 1 17:16:31 EST 2009


Author: plongstaff
Date: 2009-11-01 17:16:30 -0500 (Sun, 01 Nov 2009)
New Revision: 18406
Trac: http://svn.gnucash.org/trac/changeset/18406

Modified:
   gnucash/trunk/src/business/business-gnome/dialog-payment.c
Log:
Bug 599324 -  Patch: Add double click behaviour to account list in payment dialog

Patch by Geert Janssens


Modified: gnucash/trunk/src/business/business-gnome/dialog-payment.c
===================================================================
--- gnucash/trunk/src/business/business-gnome/dialog-payment.c	2009-11-01 21:49:00 UTC (rev 18405)
+++ gnucash/trunk/src/business/business-gnome/dialog-payment.c	2009-11-01 22:16:30 UTC (rev 18406)
@@ -74,6 +74,8 @@
 void gnc_payment_ok_cb (GtkWidget *widget, gpointer data);
 void gnc_payment_cancel_cb (GtkWidget *widget, gpointer data);
 void gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data);
+void gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
+                                             GtkTreeViewColumn *column, PaymentWindow *pw);
 
 
 static void
@@ -360,6 +362,35 @@
   g_free (pw);
 }
 
+void
+gnc_payment_acct_tree_row_activated_cb (GtkWidget *widget, GtkTreePath *path,
+                                        GtkTreeViewColumn *column, PaymentWindow *pw)
+{
+GtkTreeView *view;
+GtkTreeModel *model;
+GtkTreeIter iter;
+
+g_return_if_fail(widget);
+view = GTK_TREE_VIEW(widget);
+
+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,
+     * 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 an account without any children, so click the Ok button. */
+    gnc_payment_ok_cb(widget, pw);
+}
+}
+
 /* Select the list of accounts to show in the tree */
 static void
 gnc_payment_set_account_types (GncTreeViewAccount *tree)
@@ -483,6 +514,9 @@
   g_signal_connect (G_OBJECT (pw->invoice_choice), "changed",
 		    G_CALLBACK (gnc_payment_dialog_invoice_changed_cb), pw);
 
+  g_signal_connect (G_OBJECT (pw->acct_tree), "row-activated",
+		    G_CALLBACK (gnc_payment_acct_tree_row_activated_cb), pw);
+
   /* Register with the component manager */
   pw->component_id =
     gnc_register_gui_component (cm_class,



More information about the gnucash-changes mailing list