Add a context menu to the reconcile window. Fixes 120830.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@13701 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2006-03-25 23:51:28 +00:00
parent 1ce73dada8
commit 37d712666a
2 changed files with 91 additions and 0 deletions

View File

@ -1,3 +1,8 @@
2006-03-25 David Hampton <david@hampton-pc.rainbolthampton.net>
* src/gnome/window-reconcile.c: Add a context menu to the
reconcile window. Fixes 120830.
2006-03-25 Derek Atkins <derek@ihtfp.com>
* src/gnome-utils/test/Makefile.am:

View File

@ -802,6 +802,86 @@ gnc_reconcile_window_list_cb(GNCReconcileList *list, Split *split,
recnRecalculateBalance(recnData);
}
/** Popup a contextual menu. This function ends up being called when
* the user right-clicks in the context of a window, or uses the
* keyboard context-menu request key combination (Shift-F10 by
* default).
*
* @param recnData This is a data structure describing the
* Reconciliation Window.
*
* @param event The event parameter passed to the "button-press"
* callback. May be null if there was no event (aka keyboard
* request).
*/
static void
do_popup_menu(RecnWindow *recnData, GdkEventButton *event)
{
GtkWidget *menu;
int button, event_time;
menu = gtk_ui_manager_get_widget(recnData->ui_merge, "/MainPopup");
if (!menu) {
return;
}
if (event) {
button = event->button;
event_time = event->time;
} else {
button = 0;
event_time = gtk_get_current_event_time ();
}
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, event_time);
}
/** Callback function invoked when the user requests that Gnucash
* popup the contextual menu via the keyboard context-menu request
* key combination (Shift-F10 by default).
*
* @param recnData This is a data structure describing the
* Reconciliation Window.
*
* @param widget Whatever widget had focus when the user issued the
* keyboard context-menu request.
*
* @return Always returns TRUE to indicate that the menu request was
* handled.
*/
static gboolean
gnc_reconcile_window_popup_menu_cb (GtkWidget *widget,
RecnWindow *recnData)
{
do_popup_menu(recnData, NULL);
return TRUE;
}
/* Callback function invoked when the user clicks in the content of
* any Gnucash window. If this was a "right-click" then Gnucash will
* popup the contextual menu.
*/
static gboolean
gnc_reconcile_window_button_press_cb (GtkWidget *widget,
GdkEventButton *event,
RecnWindow *recnData)
{
GtkCList *this_list;
gint row, column;
if (event->button == 3 && event->type == GDK_BUTTON_PRESS) {
this_list = GTK_CLIST(widget);
gtk_clist_get_selection_info(this_list, event->x, event->y, &row, &column);
gtk_clist_select_row(this_list, row, column);
do_popup_menu(recnData, event);
return TRUE;
}
return FALSE;
}
static GNCSplitReg *
gnc_reconcile_window_open_register(RecnWindow *recnData)
{
@ -942,6 +1022,9 @@ gnc_reconcile_window_create_list_box(Account *account,
g_signal_connect(list, "toggle_reconciled",
G_CALLBACK(gnc_reconcile_window_list_cb),
recnData);
g_signal_connect(list, "button_press_event",
G_CALLBACK(gnc_reconcile_window_button_press_cb),
recnData);
g_signal_connect(list, "double_click_split",
G_CALLBACK(gnc_reconcile_window_double_click_cb),
recnData);
@ -1503,6 +1586,9 @@ recnWindowWithBalance (GtkWidget *parent, Account *account,
gnc_toolbar_change_cb, recnData);
}
g_signal_connect(recnData->window, "popup-menu",
G_CALLBACK(gnc_reconcile_window_popup_menu_cb), recnData);
statusbar = gtk_statusbar_new();
gtk_statusbar_set_has_resize_grip(GTK_STATUSBAR(statusbar), TRUE);
gtk_box_pack_end(GTK_BOX(vbox), statusbar, FALSE, FALSE, 0);