[Gnucash-changes] r14435 - gnucash/branches/register-rewrite/src - Factor out a button press callback that is useful for any plugin page
Chris Shoemaker
chris at cvs.gnucash.org
Sun Jun 25 19:13:43 EDT 2006
Author: chris
Date: 2006-06-25 19:13:42 -0400 (Sun, 25 Jun 2006)
New Revision: 14435
Trac: http://svn.gnucash.org/trac/changeset/14435
Modified:
gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.c
gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.h
gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-account-tree.c
gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-budget.c
Log:
Factor out a button press callback that is useful for any plugin page
that uses a GtkTreeView.
Modified: gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-account-tree.c
===================================================================
--- gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-account-tree.c 2006-06-25 14:58:03 UTC (rev 14434)
+++ gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-account-tree.c 2006-06-25 23:13:42 UTC (rev 14435)
@@ -104,9 +104,6 @@
static GncPluginPage *gnc_plugin_page_account_tree_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group);
/* Callbacks */
-static gboolean gnc_plugin_page_account_tree_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- GncPluginPage *page);
static void gnc_plugin_page_account_tree_double_click_cb (GtkTreeView *treeview,
GtkTreePath *path,
GtkTreeViewColumn *col,
@@ -456,7 +453,7 @@
g_signal_connect (G_OBJECT (selection), "changed",
G_CALLBACK (gnc_plugin_page_account_tree_selection_changed_cb), page);
g_signal_connect (G_OBJECT (tree_view), "button-press-event",
- G_CALLBACK (gnc_plugin_page_account_tree_button_press_cb), page);
+ G_CALLBACK (gnc_tree_view_button_press_cb), page);
g_signal_connect (G_OBJECT (tree_view), "row-activated",
G_CALLBACK (gnc_plugin_page_account_tree_double_click_cb), page);
@@ -583,33 +580,6 @@
/* Callbacks */
-/** This button press handler calls the common button press handler
- * for all pages. The GtkTreeView eats all button presses and
- * doesn't pass them up the widget tree, even when doesn't do
- * anything with them. The only way to get access to the button
- * presses in an account tree page is here on the tree view widget.
- * Button presses on all other pages are caught by the signal
- * registered in gnc-main-window.c. */
-static gboolean
-gnc_plugin_page_account_tree_button_press_cb (GtkWidget *widget,
- GdkEventButton *event,
- GncPluginPage *page)
-{
- gboolean result;
-
- g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
-
- ENTER("widget %p, event %p, page %p", widget, event, page);
- result = gnc_main_window_button_press_cb(widget, event, page);
- LEAVE(" ");
-
- /* Always return FALSE. This will let the tree view callback run as
- * well which will select the item under the cursor. By the time
- * the user sees the menu both callbacks will have run and the menu
- * actions will operate on the just-selected account. */
- return FALSE;
-}
-
static void
gppat_open_account_common (GncPluginPageAccountTree *page,
Account *account,
Modified: gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-budget.c
===================================================================
--- gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-budget.c 2006-06-25 14:58:03 UTC (rev 14434)
+++ gnucash/branches/register-rewrite/src/gnome/gnc-plugin-page-budget.c 2006-06-25 23:13:42 UTC (rev 14435)
@@ -95,8 +95,6 @@
GtkWidget *window, GKeyFile *file, const gchar *group);
-static gboolean gppb_button_press_cb(
- GtkWidget *widget, GdkEventButton *event, GncPluginPage *page);
static gboolean gppb_key_press_cb(
GtkWidget *treeview, GdkEventKey *event, gpointer userdata);
static void gppb_double_click_cb(
@@ -399,7 +397,7 @@
g_signal_connect(G_OBJECT(selection), "changed",
G_CALLBACK(gppb_selection_changed_cb), plugin_page);
g_signal_connect(G_OBJECT(tree_view), "button-press-event",
- G_CALLBACK(gppb_button_press_cb), plugin_page);
+ G_CALLBACK(gnc_tree_view_button_press_cb), plugin_page);
g_signal_connect(G_OBJECT(tree_view), "row-activated",
G_CALLBACK(gppb_double_click_cb), page);
g_signal_connect_after(G_OBJECT(tree_view), "key-press-event",
@@ -557,28 +555,7 @@
return page;
}
-/** This button press handler calls the common button press handler
- * for all pages. The GtkTreeView eats all button presses and
- * doesn't pass them up the widget tree, even when doesn't do
- * anything with them. The only way to get access to the button
- * presses in an account tree page is here on the tree view widget.
- * Button presses on all other pages are caught by the signal
- * registered in gnc-main-window.c. */
static gboolean
-gppb_button_press_cb(GtkWidget *widget, GdkEventButton *event,
- GncPluginPage *page)
-{
- gboolean result;
-
- g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
-
- ENTER("widget %p, event %p, page %p", widget, event, page);
- result = gnc_main_window_button_press_cb(widget, event, page);
- LEAVE(" ");
- return result;
-}
-
-static gboolean
gppb_key_press_cb(GtkWidget *treeview, GdkEventKey *event, gpointer userdata)
{
GtkTreeView *tv = GTK_TREE_VIEW(treeview);
Modified: gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.c
===================================================================
--- gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.c 2006-06-25 14:58:03 UTC (rev 14434)
+++ gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.c 2006-06-25 23:13:42 UTC (rev 14435)
@@ -2156,5 +2156,23 @@
return;
}
+gboolean
+gnc_tree_view_button_press_cb(GtkWidget *widget, GdkEventButton *event,
+ GncPluginPage *page)
+{
+ gboolean result;
+ g_return_val_if_fail(GNC_IS_PLUGIN_PAGE(page), FALSE);
+
+ ENTER("widget %p, event %p, page %p", widget, event, page);
+ result = gnc_main_window_button_press_cb(widget, event, page);
+ LEAVE(" ");
+
+ /* Always return FALSE. This will let the tree view callback run as
+ * well which will select the item under the cursor. By the time
+ * the user sees the menu both callbacks will have run and the menu
+ * actions will operate on the just-selected row. */
+ return FALSE;
+}
+
/** @} */
Modified: gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.h
===================================================================
--- gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.h 2006-06-25 14:58:03 UTC (rev 14434)
+++ gnucash/branches/register-rewrite/src/gnome-utils/gnc-tree-view.h 2006-06-25 23:13:42 UTC (rev 14435)
@@ -34,6 +34,7 @@
#include <gtk/gtktreemodel.h>
#include <gtk/gtktreeview.h>
+#include "gnc-plugin-page.h"
G_BEGIN_DECLS
@@ -400,6 +401,17 @@
gboolean
gnc_tree_view_path_is_valid(GncTreeView *view, GtkTreePath *path);
+/** This button press handler calls the common button press handler
+ * for all pages. The GtkTreeView eats all button presses and
+ * doesn't pass them up the widget tree, even when doesn't do
+ * anything with them. The only way to get access to the button
+ * presses in an tree page is here on the tree view widget. Button
+ * presses on all other pages are caught by the signal registered in
+ * gnc-main-window.c. */
+gboolean
+gnc_tree_view_button_press_cb(GtkWidget *widget, GdkEventButton *event,
+ GncPluginPage *page);
+
/** @} */
/** @} */
More information about the gnucash-changes
mailing list