Skip to content

Commit

Permalink
Bug 599324 - Patch: Add double click behaviour to account list in pay…
Browse files Browse the repository at this point in the history
…ment dialog

Patch by Geert Janssens


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18406 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
Phil Longstaff committed Nov 1, 2009
1 parent e405df9 commit 5d95e03
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/business/business-gnome/dialog-payment.c
Expand Up @@ -74,6 +74,8 @@ struct _payment_window {
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
Expand Down Expand Up @@ -360,6 +362,35 @@ gnc_payment_window_destroy_cb (GtkWidget *widget, gpointer data)
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)
Expand Down Expand Up @@ -483,6 +514,9 @@ new_payment_window (GncOwner *owner, QofBook *book, GncInvoice *invoice)
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,
Expand Down

0 comments on commit 5d95e03

Please sign in to comment.