[Gnucash-changes] r12266 - gnucash/trunk/src/gnome - Consolidate some common functionality.

David Hampton hampton at cvs.gnucash.org
Thu Jan 5 01:33:10 EST 2006


Author: hampton
Date: 2006-01-05 01:33:10 -0500 (Thu, 05 Jan 2006)
New Revision: 12266
Trac: http://svn.gnucash.org/trac/changeset/12266

Modified:
   gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
Log:
Consolidate some common functionality.

Modified: gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2006-01-05 06:32:34 UTC (rev 12265)
+++ gnucash/trunk/src/gnome/gnc-plugin-page-account-tree.c	2006-01-05 06:33:10 UTC (rev 12266)
@@ -577,18 +577,14 @@
 }
 
 static void
-gnc_plugin_page_account_tree_double_click_cb (GtkTreeView        *treeview,
-					      GtkTreePath        *path,
-					      GtkTreeViewColumn  *col,
-					      GncPluginPageAccountTree *page)
+gppat_open_account_common (GncPluginPageAccountTree *page,
+			   Account *account,
+			   gboolean include_subs)
 {
 	GncPluginPageAccountTreePrivate *priv;
 	GtkWidget *window;
 	GncPluginPage *new_page;
-	Account *account;
 
-	g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
-	account = gnc_tree_view_account_get_account_from_path (GNC_TREE_VIEW_ACCOUNT(treeview), path);
 	if (account == NULL)
 	  return;
 
@@ -599,6 +595,19 @@
 }
 
 static void
+gnc_plugin_page_account_tree_double_click_cb (GtkTreeView        *treeview,
+					      GtkTreePath        *path,
+					      GtkTreeViewColumn  *col,
+					      GncPluginPageAccountTree *page)
+{
+	Account *account;
+
+	g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
+	account = gnc_tree_view_account_get_account_from_path (GNC_TREE_VIEW_ACCOUNT(treeview), path);
+	gppat_open_account_common (page, account, FALSE);
+}
+
+static void
 gnc_plugin_page_account_tree_selection_changed_cb (GtkTreeSelection *selection,
 						   GncPluginPageAccountTree *page)
 {
@@ -646,36 +655,22 @@
 gnc_plugin_page_account_tree_cmd_open_account (GtkAction *action,
 					       GncPluginPageAccountTree *page)
 {
-	GtkWidget *window;
-	GncPluginPage *new_page;
 	Account *account;
 
 	g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
 	account = gnc_plugin_page_account_tree_get_current_account (page);
-	if (account == NULL)
-	  return;
-
-	window = GNC_PLUGIN_PAGE (page)->window;
-	new_page = gnc_plugin_page_register_new (account, FALSE);
-	gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
+	gppat_open_account_common (page, account, FALSE);
 }
 
 static void
 gnc_plugin_page_account_tree_cmd_open_subaccounts (GtkAction *action,
 						   GncPluginPageAccountTree *page)
 {
-	GtkWidget *window;
-	GncPluginPage *new_page;
 	Account *account;
 
 	g_return_if_fail (GNC_IS_PLUGIN_PAGE_ACCOUNT_TREE (page));
 	account = gnc_plugin_page_account_tree_get_current_account (page);
-	if (account == NULL)
-	  return;
-
-	window = GNC_PLUGIN_PAGE (page)->window;
-	new_page = gnc_plugin_page_register_new (account, TRUE);
-	gnc_main_window_open_page (GNC_MAIN_WINDOW(window), new_page);
+	gppat_open_account_common (page, account, TRUE);
 }
 
 static void



More information about the gnucash-changes mailing list