From 3f22ee757d05e00cd74bf9694ee1b6042e4bf969 Mon Sep 17 00:00:00 2001 From: Derek Atkins Date: Tue, 2 Jul 2002 15:18:27 +0000 Subject: [PATCH] * business/business-gnome/dialog-invoice.c: use glade for the popup. Only set the popup for Read-Write invoices. * business/business-gnome/glade/invoice.glade: define the popup menu in glade. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7068 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 10 +++ src/business/business-gnome/dialog-invoice.c | 75 ++++++------------ .../business-gnome/glade/invoice.glade | 76 +++++++++++++++++++ 3 files changed, 109 insertions(+), 52 deletions(-) diff --git a/ChangeLog b/ChangeLog index b01ce7aa95..c0a69a16f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2002-07-02 Derek Atkins + + * register/register-gnome/gnucash-sheet.c: allow a caller to + "unset" the popup menu by passing a NULL popup. + + * business/business-gnome/dialog-invoice.c: use glade for the + popup. Only set the popup for Read-Write invoices. + * business/business-gnome/glade/invoice.glade: define the popup + menu in glade. + 2002-07-01 Derek Atkins * business-gnome/dialog-invoice.c: make all my callbacks diff --git a/src/business/business-gnome/dialog-invoice.c b/src/business/business-gnome/dialog-invoice.c index c6282e3d9e..03b614b9e8 100644 --- a/src/business/business-gnome/dialog-invoice.c +++ b/src/business/business-gnome/dialog-invoice.c @@ -64,6 +64,9 @@ struct _invoice_window { GtkWidget * menubar; GtkWidget * statusbar; + /* Popup Menu */ + GtkWidget * popup_menu; + /* Toolbar Widgets */ GtkWidget * toolbar_dock; GtkWidget * edit_button; @@ -504,58 +507,25 @@ static GtkWidget * gnc_invoice_window_create_popup_menu (InvoiceWindow *iw) { GtkWidget *popup; + GladeXML *xml; - GnomeUIInfo transaction_menu[] = - { - { - GNOME_APP_UI_ITEM, - N_("_Enter"), - N_("Record the current entry"), - gnc_invoice_window_recordCB, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, - { - GNOME_APP_UI_ITEM, - N_("_Cancel"), - N_("Cancel the current entry"), - gnc_invoice_window_cancelCB, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, - { - GNOME_APP_UI_ITEM, - N_("_Delete"), - N_("Delete the current entry"), - gnc_invoice_window_deleteCB, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, - GNOMEUIINFO_SEPARATOR, - { - GNOME_APP_UI_ITEM, - N_("D_uplicate"), - N_("Make a copy of the current entry"), - gnc_invoice_window_duplicateCB, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, - GNOMEUIINFO_SEPARATOR, - { - GNOME_APP_UI_ITEM, - N_("_Blank"), - N_("Move to the blank entry at the " - "bottom of the register"), - gnc_invoice_window_blankCB, NULL, NULL, - GNOME_APP_PIXMAP_NONE, NULL, - 0, 0, NULL - }, - GNOMEUIINFO_END - }; + xml = gnc_glade_xml_new ("invoice.glade", "Invoice Window Popup Menu"); - gnc_fill_menu_with_data (transaction_menu, iw); + popup = glade_xml_get_widget (xml, "Invoice Window Popup Menu"); - popup = gnome_popup_menu_new (transaction_menu); + glade_xml_signal_autoconnect_full (xml, gnc_glade_autoconnect_full_func, iw); + + /* Glade insists on making this a tearoff menu. */ + if (gnome_preferences_get_menus_have_tearoff ()) { + GtkMenuShell *ms = GTK_MENU_SHELL (popup); + GtkWidget *tearoff; + + tearoff = g_list_nth_data (ms->children, 0); + ms->children = g_list_remove (ms->children, tearoff); + gtk_widget_destroy (tearoff); + } + + iw->popup_menu = popup; return popup; } @@ -970,6 +940,9 @@ gnc_invoice_update_window (InvoiceWindow *iw) hide = glade_xml_get_widget (iw->xml, "hide4"); gtk_widget_hide_all (hide); + /* Remove the popup menu */ + gnucash_register_attach_popup (iw->reg, NULL, iw); + } else { /* ! posted */ hide = glade_xml_get_widget (iw->xml, "posted_label"); gtk_widget_hide_all (hide); @@ -1225,9 +1198,7 @@ gnc_invoice_new_window (GNCBook *bookp, InvoiceDialogType type, GTK_SIGNAL_FUNC(gnc_invoice_redraw_help_cb), iw); popup = gnc_invoice_window_create_popup_menu (iw); - gnucash_register_attach_popup (GNUCASH_REGISTER (regWidget), - popup, iw); - + gnucash_register_attach_popup (GNUCASH_REGISTER (regWidget), popup, iw); } gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger)); diff --git a/src/business/business-gnome/glade/invoice.glade b/src/business/business-gnome/glade/invoice.glade index 8d895c388e..16184114cb 100644 --- a/src/business/business-gnome/glade/invoice.glade +++ b/src/business/business-gnome/glade/invoice.glade @@ -1177,4 +1177,80 @@ + + GtkMenu + Invoice Window Popup Menu + + + GtkMenuItem + enter_item + Record the current entry + + activate + gnc_invoice_window_recordCB + Tue, 02 Jul 2002 14:52:15 GMT + + + False + + + + GtkMenuItem + cancel_item + Cancel the current entry + + activate + gnc_invoice_window_cancelCB + Tue, 02 Jul 2002 14:52:15 GMT + + + False + + + + GtkMenuItem + delete_item + Delete the current entry + + activate + gnc_invoice_window_deleteCB + Tue, 02 Jul 2002 14:52:15 GMT + + + False + + + + GtkMenuItem + separator1 + False + + + + GtkMenuItem + duplicate_item + Make a copy of the current entry + + activate + gnc_invoice_window_duplicateCB + Tue, 02 Jul 2002 14:52:15 GMT + + + False + + + + GtkMenuItem + blank_item + Move to the blank entry at the bottom of the Invoice + + activate + gnc_invoice_window_blankCB + Tue, 02 Jul 2002 14:52:15 GMT + + + False + + +