diff --git a/gnucash/gnome/gnc-plugin-page-owner-tree.c b/gnucash/gnome/gnc-plugin-page-owner-tree.c index 16d952f78a..b4375ec463 100644 --- a/gnucash/gnome/gnc-plugin-page-owner-tree.c +++ b/gnucash/gnome/gnc-plugin-page-owner-tree.c @@ -70,7 +70,7 @@ static QofLogModule log_module = GNC_MOD_GUI; #define PLUGIN_PAGE_ACCT_TREE_CM_CLASS "plugin-page-owner-tree" #define DELETE_DIALOG_FILTER "filter" -#define DELETE_DIALOG_OWNER "owner" +#define DELETE_DIALOG_OWNER "owner" enum { @@ -107,6 +107,7 @@ static GtkWidget *gnc_plugin_page_owner_tree_create_widget (GncPluginPage *plugi static void gnc_plugin_page_owner_tree_destroy_widget (GncPluginPage *plugin_page); static void gnc_plugin_page_owner_tree_save_page (GncPluginPage *plugin_page, GKeyFile *file, const gchar *group); static GncPluginPage *gnc_plugin_page_owner_tree_recreate_page (GtkWidget *window, GKeyFile *file, const gchar *group); +static void set_menu_and_toolbar_qualifier (GncPluginPage *plugin_page); /* Callbacks */ static gboolean gnc_plugin_page_owner_tree_button_press_cb (GtkWidget *widget, @@ -132,7 +133,7 @@ static void gnc_plugin_page_owner_tree_cmd_new_invoice (GSimpleAction *simple, G static void gnc_plugin_page_owner_tree_cmd_owners_report (GSimpleAction *simple, GVariant *parameter, gpointer user_data); static void gnc_plugin_page_owner_tree_cmd_owner_report (GSimpleAction *simple, GVariant *parameter, gpointer user_data); static void gnc_plugin_page_owner_tree_cmd_process_payment (GSimpleAction *simple, GVariant *parameter, gpointer user_data); - +static void gnc_plugin_page_owner_tree_cmd_edit_tax (GSimpleAction *simple, GVariant *parameter, gpointer user_data); static guint plugin_page_signals[LAST_SIGNAL] = { 0 }; @@ -152,6 +153,7 @@ static GActionEntry gnc_plugin_page_owner_tree_actions [] = { "ViewFilterByAction", gnc_plugin_page_owner_tree_cmd_view_filter_by, NULL, NULL, NULL }, { "ViewRefreshAction", gnc_plugin_page_owner_tree_cmd_refresh, NULL, NULL, NULL }, + { "EditTaxOptionsAction", gnc_plugin_page_owner_tree_cmd_edit_tax, NULL, NULL, NULL }, { "OTNewBillAction", gnc_plugin_page_owner_tree_cmd_new_invoice, NULL, NULL, NULL }, { "OTNewInvoiceAction", gnc_plugin_page_owner_tree_cmd_new_invoice, NULL, NULL, NULL }, { "OTNewVoucherAction", gnc_plugin_page_owner_tree_cmd_new_invoice, NULL, NULL, NULL }, @@ -249,6 +251,18 @@ static GncDisplayItem gnc_plugin_page_owner_tree_display_items [] = /** The number of display items provided by this plugin. */ static guint gnc_plugin_page_owner_tree_n_display_items = G_N_ELEMENTS(gnc_plugin_page_owner_tree_display_items); +/** The default menu items that need to be add to the menu */ +static const gchar *gnc_plugin_load_ui_items [] = +{ + "EditPlaceholder2", + "EditPlaceholder3", + "EditPlaceholder5", + "ViewPlaceholder1", + "ViewPlaceholder4", + "ReportsPlaceholder1", + NULL, +}; + /** Actions that require an owner to be selected before they are * enabled. These ones are only sensitive in a read-write book. */ static const gchar *actions_requiring_owner_rw[] = @@ -367,17 +381,6 @@ gnc_plugin_page_owner_tree_new (GncOwnerType owner_type) priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(plugin_page); priv->owner_type = owner_type; - /* Hide menu and toolbar items that are not relevant for the active owner list */ - simple_action_group = gnc_plugin_page_get_action_groupb (GNC_PLUGIN_PAGE(plugin_page)); - for (i = 0; action_owners[i].action_name; i++) - { - action = g_action_map_lookup_action (G_ACTION_MAP(simple_action_group), - action_owners[i].action_name); -//FIXMEb g_object_set (G_OBJECT(action), -// "visible", (priv->owner_type == action_owners[i].owner_type), -// NULL); - } - LEAVE("new %s tree page %p", gncOwnerTypeToQofIdType(owner_type), plugin_page); return GNC_PLUGIN_PAGE(plugin_page); } @@ -394,6 +397,21 @@ gnc_plugin_page_owner_focus_widget (GncPluginPage *owner_plugin_page) GncPluginPageOwnerTreePrivate *priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(owner_plugin_page); GtkTreeView *tree_view = priv->tree_view; + /* Disable the Transaction Menu */ + GAction *action = gnc_main_window_find_action (GNC_MAIN_WINDOW(owner_plugin_page->window), "TransactionAction"); + g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE); + /* Disable the Schedule menu */ + action = gnc_main_window_find_action (GNC_MAIN_WINDOW(owner_plugin_page->window), "ScheduledAction"); + g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE); + /* Disable the FilePrintAction */ + action = gnc_main_window_find_action (GNC_MAIN_WINDOW(owner_plugin_page->window), "FilePrintAction"); + g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE); + + set_menu_and_toolbar_qualifier (owner_plugin_page); + + gnc_main_window_update_menu (GNC_MAIN_WINDOW(owner_plugin_page->window), owner_plugin_page, + gnc_plugin_load_ui_items); + if (GTK_IS_TREE_VIEW(tree_view)) { if (!gtk_widget_is_focus (GTK_WIDGET(tree_view))) @@ -453,7 +471,7 @@ gnc_plugin_page_owner_tree_init (GncPluginPageOwnerTree *plugin_page) G_CALLBACK (gnc_plugin_page_owner_tree_selected), plugin_page); /* change me when the system supports multiple books */ - gnc_plugin_page_add_book(parent, gnc_get_current_book()); + gnc_plugin_page_add_book (parent, gnc_get_current_book()); /* Create menu and toolbar information */ simple_action_group = gnc_plugin_page_create_action_groupb (parent, "GncPluginPageOwnerTreeActions"); @@ -461,8 +479,8 @@ gnc_plugin_page_owner_tree_init (GncPluginPageOwnerTree *plugin_page) gnc_plugin_page_owner_tree_actions, gnc_plugin_page_owner_tree_n_actions, plugin_page); -//FIXMEb gnc_plugin_init_short_names (action_group, toolbar_labels); +//FIXMEb gnc_plugin_init_short_names (action_group, toolbar_labels); /* Init filter */ priv->fd.show_inactive = TRUE; @@ -488,7 +506,8 @@ gnc_plugin_page_owner_tree_finalize (GObject *object) LEAVE(" "); } -static void update_inactive_actions(GncPluginPage *plugin_page) +static void +update_inactive_actions(GncPluginPage *plugin_page) { GSimpleActionGroup *simple_action_group; gboolean is_sensitive = !qof_book_is_readonly(gnc_get_current_book()); @@ -499,13 +518,33 @@ static void update_inactive_actions(GncPluginPage *plugin_page) /* Get the action group */ simple_action_group = gnc_plugin_page_get_action_groupb (plugin_page); - g_return_if_fail (G_IS_SIMPLE_ACTION_GROUP (simple_action_group)); + g_return_if_fail (G_IS_SIMPLE_ACTION_GROUP(simple_action_group)); /* Set the action's sensitivity */ gnc_plugin_update_actionsb (simple_action_group, readonly_inactive_actions, "sensitive", is_sensitive); } +static void +set_menu_and_toolbar_qualifier (GncPluginPage *plugin_page) +{ + GncPluginPageOwnerTree *page = GNC_PLUGIN_PAGE_OWNER_TREE(plugin_page); + GncPluginPageOwnerTreePrivate *priv; + + g_return_if_fail (GNC_IS_PLUGIN_PAGE_OWNER_TREE(page)); + + priv = GNC_PLUGIN_PAGE_OWNER_TREE_GET_PRIVATE(page); + + if (priv->owner_type == GNC_OWNER_CUSTOMER) + gnc_plugin_page_set_menu_qualifier (plugin_page, "c"); + else if (priv->owner_type == GNC_OWNER_VENDOR) + gnc_plugin_page_set_menu_qualifier (plugin_page, "v"); + else if (priv->owner_type == GNC_OWNER_EMPLOYEE) + gnc_plugin_page_set_menu_qualifier (plugin_page, "e"); + else + gnc_plugin_page_set_menu_qualifier (plugin_page, NULL); +} + static void gnc_plugin_page_owner_tree_selected (GObject *object, gpointer user_data) { @@ -685,6 +724,8 @@ gnc_plugin_page_owner_tree_create_widget (GncPluginPage *plugin_page) G_CALLBACK(gnc_plugin_page_inserted_cb), NULL); + set_menu_and_toolbar_qualifier (plugin_page); + LEAVE("widget = %p", priv->widget); return priv->widget; } @@ -1180,6 +1221,21 @@ gnc_plugin_page_owner_tree_cmd_refresh (GSimpleAction *simple, gtk_widget_queue_draw (priv->widget); } +static void +gnc_plugin_page_owner_tree_cmd_edit_tax (GSimpleAction *simple, + GVariant *parameter, + gpointer user_data) +{ + GncPluginPageOwnerTree *plugin_page = user_data; + GtkWidget *parent; + + g_return_if_fail (GNC_IS_PLUGIN_PAGE_OWNER_TREE(plugin_page)); + + parent = GTK_WIDGET(gnc_plugin_page_get_window (GNC_PLUGIN_PAGE(plugin_page))); + + gnc_tax_info_dialog (parent, NULL); +} + static void gnc_plugin_page_owner_tree_cmd_new_invoice (GSimpleAction *simple, GVariant *parameter, diff --git a/gnucash/gnucash-gresources.xml b/gnucash/gnucash-gresources.xml index 39d0c02904..d133d4e6ac 100644 --- a/gnucash/gnucash-gresources.xml +++ b/gnucash/gnucash-gresources.xml @@ -20,6 +20,7 @@ ui/gnc-plugin-page-account-tree.ui ui/gnc-plugin-page-budget.ui + ui/gnc-plugin-page-owner-tree.ui ui/gnc-plugin-page-register.ui ui/gnc-plugin-page-sx-list.ui diff --git a/gnucash/ui/gnc-plugin-page-owner-tree.ui b/gnucash/ui/gnc-plugin-page-owner-tree.ui new file mode 100644 index 0000000000..743f94055d --- /dev/null +++ b/gnucash/ui/gnc-plugin-page-owner-tree.ui @@ -0,0 +1,685 @@ + + + + + + E_dit Customer + GncPluginPageOwnerTreeActions.OTEditCustomerAction + <Primary>e + Edit the selected customer + yes + + + _New Customer... + GncPluginPageOwnerTreeActions.OTNewCustomerAction + Create a new customer + yes + + + + + + E_dit Vendor + GncPluginPageOwnerTreeActions.OTEditVendorAction + <Primary>e + Edit the selected vendor + yes + + + _New Vendor... + GncPluginPageOwnerTreeActions.OTNewVendorAction + Create a new vendor + yes + + + + + + E_dit Employee + GncPluginPageOwnerTreeActions.OTEditEmployeeAction + <Primary>e + Edit the selected employee + yes + + + _New Employee... + GncPluginPageOwnerTreeActions.OTNewEmployeeAction + Create a new employee + yes + + + + + + + _Find... + gnc-plugin-basic-commands-actions.EditFindTransactionsAction + <Primary>f + Find transactions with a search + yes + + + + + + + Ta_x Report Options + GncPluginPageOwnerTreeActions.EditTaxOptionsAction + + Setup relevant accounts for tax reports, e.g. US income tax + yes + + + + + + _Filter By... + GncPluginPageOwnerTreeActions.ViewFilterByAction + yes + + + + + + _Refresh + GncPluginPageOwnerTreeActions.ViewRefreshAction + <Primary>r + Refresh this window + yes + + + + + + Customer Report + GncPluginPageOwnerTreeActions.OTCustomerReportAction + Show customer report + yes + + + Customer Listing + GncPluginPageOwnerTreeActions.OTCustomerListingReportAction + Show customer aging overview for all customers + yes + + + + + + Vendor Report + GncPluginPageOwnerTreeActions.OTVendorReportAction + Show vendor report + yes + + + Vendor Listing + GncPluginPageOwnerTreeActions.OTVendorListingReportAction + Show vendor aging overview for all vendors + yes + + + + + + Employee Report + GncPluginPageOwnerTreeActions.OTEmployeeReportAction + Show employee report + yes + + + + + +
+ + Re_name Page + mainwin.ActionsRenamePageAction + Rename this page + +
+
+ + E_dit Customer + GncPluginPageOwnerTreeActions.OTEditCustomerAction + Edit the selected customer + +
+
+ + New _Invoice... + GncPluginPageOwnerTreeActions.OTNewInvoiceAction + Create a new invoice + + + Customer Report + GncPluginPageOwnerTreeActions.OTCustomerReportAction + Show customer report + + + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + +
+
+ + +
+ + Re_name Page + mainwin.ActionsRenamePageAction + Rename this page + +
+
+ + E_dit Vendor + GncPluginPageOwnerTreeActions.OTEditVendorAction + Edit the selected vendor + +
+
+ + New _Bill... + GncPluginPageOwnerTreeActions.OTNewBillAction + Create a new bill + + + Vendor Report + GncPluginPageOwnerTreeActions.OTVendorReportAction + Show vendor report + + + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + +
+
+ + +
+ + Re_name Page + mainwin.ActionsRenamePageAction + Rename this page + +
+
+ + E_dit Employee + GncPluginPageOwnerTreeActions.OTEditEmployeeAction + Edit the selected customer + +
+
+ + New _Voucher... + GncPluginPageOwnerTreeActions.OTNewVoucherAction + Create a new voucher + + + Employee Report + GncPluginPageOwnerTreeActions.OTEmployeeReportAction + Show employee report + + + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + +
+
+ + + + True + False + + + True + False + _Save + gnc-plugin-basic-commands-actions.FileSaveAction + Save the current file + True + document-save + + + False + True + + + + + True + False + _Close + mainwin.FileCloseAction + Close the currently active page + True + window-close + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Invoice... + gnc-plugin-business-actions.ToolbarNewInvoiceAction + Open the New Invoice dialog + True + gnc-invoice-new + + + False + True + + + + + True + False + + + False + True + + + + + True + False + _New Customer... + GncPluginPageOwnerTreeActions.OTNewCustomerAction + Create a new customer + True + gnc-account-new + + + False + True + + + + + True + False + E_dit Customer + GncPluginPageOwnerTreeActions.OTEditCustomerAction + Edit the selected customer + True + gnc-account-edit + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Invoice... + GncPluginPageOwnerTreeActions.OTNewInvoiceAction + Create a new invoice + True + gnc-invoice-pay + + + False + True + + + + + True + False + Customer Listing + GncPluginPageOwnerTreeActions.OTCustomerListingReportAction + Show customer aging overview for all customers + True + document-print-preview + + + False + True + + + + + True + False + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + True + gnc-invoice-pay + + + False + True + + + + + + True + False + + + True + False + _Save + gnc-plugin-basic-commands-actions.FileSaveAction + Save the current file + True + document-save + + + False + True + + + + + True + False + _Close + mainwin.FileCloseAction + Close the currently active page + True + window-close + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Invoice... + gnc-plugin-business-actions.ToolbarNewInvoiceAction + Open the New Invoice dialog + True + gnc-invoice-new + + + False + True + + + + + True + False + + + False + True + + + + + True + False + _New Vendor... + GncPluginPageOwnerTreeActions.OTNewVendorAction + Create a new vendor + True + gnc-account-new + + + False + True + + + + + True + False + E_dit Vendor + GncPluginPageOwnerTreeActions.OTEditVendorAction + Edit the selected vendor + True + gnc-account-edit + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Bill... + GncPluginPageOwnerTreeActions.OTNewBillAction + Create a new bill + True + gnc-invoice-pay + + + False + True + + + + + True + False + Vendor Listing + GncPluginPageOwnerTreeActions.OTVendorListingReportAction + Show vendor aging overview for all vendors + True + document-print-preview + + + False + True + + + + + True + False + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + True + gnc-invoice-pay + + + False + True + + + + + + True + False + + + True + False + _Save + gnc-plugin-basic-commands-actions.FileSaveAction + Save the current file + True + document-save + + + False + True + + + + + True + False + _Close + mainwin.FileCloseAction + Close the currently active page + True + window-close + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Invoice... + gnc-plugin-business-actions.ToolbarNewInvoiceAction + Open the New Invoice dialog + True + gnc-invoice-new + + + False + True + + + + + True + False + + + False + True + + + + + True + False + _New Employee... + GncPluginPageOwnerTreeActions.OTNewEmployeeAction + Create a new employee + True + gnc-account-new + + + False + True + + + + + True + False + E_dit Employee + GncPluginPageOwnerTreeActions.OTEditEmployeeAction + Edit the selected employee + True + gnc-account-edit + + + False + True + + + + + True + False + + + False + True + + + + + True + False + New _Voucher... + GncPluginPageOwnerTreeActions.OTNewVoucherAction + Create a new voucher + True + gnc-invoice-pay + + + False + True + + + + + True + False + Process Payment + GncPluginPageOwnerTreeActions.OTProcessPaymentAction + Process Payment + True + gnc-invoice-pay + + + False + True + + + + +