* 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
This commit is contained in:
Derek Atkins 2002-07-02 15:18:27 +00:00
parent e5b6d357a5
commit 3f22ee757d
3 changed files with 109 additions and 52 deletions

View File

@ -1,3 +1,13 @@
2002-07-02 Derek Atkins <derek@ihtfp.com>
* 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 <derek@ihtfp.com> 2002-07-01 Derek Atkins <derek@ihtfp.com>
* business-gnome/dialog-invoice.c: make all my callbacks * business-gnome/dialog-invoice.c: make all my callbacks

View File

@ -64,6 +64,9 @@ struct _invoice_window {
GtkWidget * menubar; GtkWidget * menubar;
GtkWidget * statusbar; GtkWidget * statusbar;
/* Popup Menu */
GtkWidget * popup_menu;
/* Toolbar Widgets */ /* Toolbar Widgets */
GtkWidget * toolbar_dock; GtkWidget * toolbar_dock;
GtkWidget * edit_button; GtkWidget * edit_button;
@ -504,58 +507,25 @@ static GtkWidget *
gnc_invoice_window_create_popup_menu (InvoiceWindow *iw) gnc_invoice_window_create_popup_menu (InvoiceWindow *iw)
{ {
GtkWidget *popup; GtkWidget *popup;
GladeXML *xml;
GnomeUIInfo transaction_menu[] = xml = gnc_glade_xml_new ("invoice.glade", "Invoice Window Popup 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
};
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; return popup;
} }
@ -970,6 +940,9 @@ gnc_invoice_update_window (InvoiceWindow *iw)
hide = glade_xml_get_widget (iw->xml, "hide4"); hide = glade_xml_get_widget (iw->xml, "hide4");
gtk_widget_hide_all (hide); gtk_widget_hide_all (hide);
/* Remove the popup menu */
gnucash_register_attach_popup (iw->reg, NULL, iw);
} else { /* ! posted */ } else { /* ! posted */
hide = glade_xml_get_widget (iw->xml, "posted_label"); hide = glade_xml_get_widget (iw->xml, "posted_label");
gtk_widget_hide_all (hide); 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); GTK_SIGNAL_FUNC(gnc_invoice_redraw_help_cb), iw);
popup = gnc_invoice_window_create_popup_menu (iw); popup = gnc_invoice_window_create_popup_menu (iw);
gnucash_register_attach_popup (GNUCASH_REGISTER (regWidget), gnucash_register_attach_popup (GNUCASH_REGISTER (regWidget), popup, iw);
popup, iw);
} }
gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger)); gnc_table_realize_gui (gnc_entry_ledger_get_table (entry_ledger));

View File

@ -1177,4 +1177,80 @@
</widget> </widget>
</widget> </widget>
<widget>
<class>GtkMenu</class>
<name>Invoice Window Popup Menu</name>
<widget>
<class>GtkMenuItem</class>
<name>enter_item</name>
<tooltip>Record the current entry</tooltip>
<signal>
<name>activate</name>
<handler>gnc_invoice_window_recordCB</handler>
<last_modification_time>Tue, 02 Jul 2002 14:52:15 GMT</last_modification_time>
</signal>
<label>Enter</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>cancel_item</name>
<tooltip>Cancel the current entry</tooltip>
<signal>
<name>activate</name>
<handler>gnc_invoice_window_cancelCB</handler>
<last_modification_time>Tue, 02 Jul 2002 14:52:15 GMT</last_modification_time>
</signal>
<label>Cancel</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>delete_item</name>
<tooltip>Delete the current entry</tooltip>
<signal>
<name>activate</name>
<handler>gnc_invoice_window_deleteCB</handler>
<last_modification_time>Tue, 02 Jul 2002 14:52:15 GMT</last_modification_time>
</signal>
<label>Delete</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>separator1</name>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>duplicate_item</name>
<tooltip>Make a copy of the current entry</tooltip>
<signal>
<name>activate</name>
<handler>gnc_invoice_window_duplicateCB</handler>
<last_modification_time>Tue, 02 Jul 2002 14:52:15 GMT</last_modification_time>
</signal>
<label>Duplicate</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>blank_item</name>
<tooltip>Move to the blank entry at the bottom of the Invoice</tooltip>
<signal>
<name>activate</name>
<handler>gnc_invoice_window_blankCB</handler>
<last_modification_time>Tue, 02 Jul 2002 14:52:15 GMT</last_modification_time>
</signal>
<label>Blank</label>
<right_justify>False</right_justify>
</widget>
</widget>
</GTK-Interface> </GTK-Interface>