Fix the file print menu item

Create a placeholder for the file print item as the label can change
for different pages. Also fix the sensitivity depending on page.
This commit is contained in:
Robert Fewell 2022-11-04 17:32:27 +00:00
parent bf648f6ed5
commit e16217a219
21 changed files with 119 additions and 17 deletions

View File

@ -100,7 +100,7 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder5",
"FilePlaceholder6",
NULL,
};
@ -432,7 +432,7 @@ gnc_history_update_action (GncMainWindow *window,
if (!gnc_menubar_model_find_item (gnc_main_window_get_menu_model(window), gsm)) // could not find action_name
{
add_item = TRUE;
gsm->search_action_name = "FilePlaceholder5"; // placeholder
gsm->search_action_name = "FilePlaceholder6"; // placeholder
if (!gnc_menubar_model_find_item (gnc_main_window_get_menu_model(window), gsm))
{

View File

@ -136,7 +136,9 @@ static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder0",
"FilePlaceholder2",
"FilePlaceholder4",
"FilePlaceholder3",
"FilePlaceholder5",
"EditPlaceholder3",
"EditPlaceholder5",
"ActionsPlaceholder2",
"ToolsPlaceholder1",

View File

@ -216,6 +216,7 @@ static guint gnc_plugin_page_account_tree_n_actions = G_N_ELEMENTS(gnc_plugin_pa
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder1",
"EditPlaceholder2",
"EditPlaceholder3",

View File

@ -127,7 +127,6 @@ static void allperiods_budget_helper (GtkTreeModel *model, GtkTreePath *path,
static GActionEntry gnc_plugin_page_budget_actions [] =
{
{ "FakeToplevel", NULL, NULL, NULL, NULL },
{ "OpenAccountAction", gnc_plugin_page_budget_cmd_open_account, NULL, NULL, NULL },
{ "OpenSubaccountsAction", gnc_plugin_page_budget_cmd_open_subaccounts, NULL, NULL, NULL },
{ "DeleteBudgetAction", gnc_plugin_page_budget_cmd_delete_budget, NULL, NULL, NULL },
@ -145,6 +144,7 @@ static guint gnc_plugin_page_budget_n_actions = G_N_ELEMENTS(gnc_plugin_page_bud
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder1",
"EditPlaceholder3",
"EditPlaceholder5",
@ -384,6 +384,9 @@ gnc_plugin_page_budget_focus_widget (GncPluginPage *budget_plugin_page)
/* Disable the Schedule menu */
action = gnc_main_window_find_action (GNC_MAIN_WINDOW(budget_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(budget_plugin_page->window), "FilePrintAction");
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
gnc_main_window_update_menu_and_toolbar (GNC_MAIN_WINDOW(budget_plugin_page->window),
budget_plugin_page,

View File

@ -143,6 +143,7 @@ static guint gnc_plugin_page_invoice_n_actions = G_N_ELEMENTS(gnc_plugin_page_in
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder1",
"EditPlaceholder3",
"EditPlaceholder5",

View File

@ -170,6 +170,7 @@ static guint gnc_plugin_page_owner_tree_n_actions = G_N_ELEMENTS(gnc_plugin_page
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder2",
"EditPlaceholder3",
"EditPlaceholder5",

View File

@ -351,6 +351,7 @@ static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS(gnc_plugin_page_r
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder1",
"EditPlaceholder2",
"EditPlaceholder3",

View File

@ -215,6 +215,7 @@ static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"FilePlaceholder4",
"FilePlaceholder5",
"EditPlaceholder6",
"ReportsPlaceholder1",
NULL,

View File

@ -142,6 +142,7 @@ static guint gnc_plugin_page_sx_list_n_actions = G_N_ELEMENTS(gnc_plugin_page_sx
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder3",
"EditPlaceholder3",
"EditPlaceholder5",
"ViewPlaceholder4",
@ -183,6 +184,9 @@ gnc_plugin_page_sx_list_focus_widget (GncPluginPage *sx_plugin_page)
/* Enable the Schedule Menu */
action = gnc_main_window_find_action (GNC_MAIN_WINDOW(sx_plugin_page->window), "ScheduledAction");
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), TRUE);
/* Disable the FilePrintAction */
action = gnc_main_window_find_action (GNC_MAIN_WINDOW(sx_plugin_page->window), "FilePrintAction");
g_simple_action_set_enabled (G_SIMPLE_ACTION(action), FALSE);
gnc_main_window_update_menu_and_toolbar (GNC_MAIN_WINDOW(sx_plugin_page->window),
sx_plugin_page,

View File

@ -57,7 +57,7 @@ static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);
/** The default menu items that need to be add to the menu */
static const gchar *gnc_plugin_load_ui_items [] =
{
"FilePlaceholder4",
"FilePlaceholder5",
NULL,
};

View File

@ -32,10 +32,9 @@
</section>
<section>
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="label" translatable="no">PrintPlaceholder</attribute>
<attribute name="action">mainwin.FilePlaceholder3</attribute>
<attribute name="hidden-when">action-disabled</attribute>
</item>
<item>
<attribute name="label" translatable="yes">Pa_ge Setup...</attribute>
@ -45,7 +44,7 @@
</item>
<item>
<attribute name="label" translatable="no">PdfPlaceholder</attribute>
<attribute name="action">mainwin.FilePlaceholder3</attribute>
<attribute name="action">mainwin.FilePlaceholder4</attribute>
<attribute name="hidden-when">action-disabled</attribute>
</item>
<submenu>
@ -53,7 +52,7 @@
<attribute name="action">mainwin.FileExportAction</attribute>
<item>
<attribute name="label" translatable="no">ExportPlaceholder</attribute>
<attribute name="action">mainwin.FilePlaceholder4</attribute>
<attribute name="action">mainwin.FilePlaceholder5</attribute>
<attribute name="hidden-when">action-disabled</attribute>
</item>
</submenu>
@ -69,7 +68,7 @@
<section>
<item>
<attribute name="label" translatable="no">RecentPlaceholder</attribute>
<attribute name="action">mainwin.FilePlaceholder5</attribute>
<attribute name="action">mainwin.FilePlaceholder6</attribute>
<attribute name="hidden-when">action-disabled</attribute>
</item>
</section>

View File

@ -36,7 +36,17 @@
</item>
</menu>
<menu id="FilePlaceholder4">
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="FilePlaceholder5">
<item>
<attribute name="label" translatable="yes">Export _Accounts</attribute>
<attribute name="action">gnc-plugin-basic-commands-actions.FileExportAccountsAction</attribute>
@ -44,6 +54,16 @@
</item>
</menu>
<menu id="EditPlaceholder3">
<item>
<attribute name="label" translatable="yes">_Find...</attribute>
<attribute name="action">gnc-plugin-basic-commands-actions.EditFindTransactionsAction</attribute>
<attribute name="accel">&lt;Primary&gt;f</attribute>
<attribute name="tooltip" translatable="yes">Find transactions with a search</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder5">
<item>
<!-- Translators: remember to reuse this translation in dialog-account.glade -->

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder4">
<menu id="FilePlaceholder5">
<item>
<attribute name="label" translatable="yes">Export Account T_ree to CSV...</attribute>
<attribute name="action">gnc-plugin-csv-export-actions.CsvExportTreeAction</attribute>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder5">
<menu id="FilePlaceholder6">
<item>
<attribute name="label" translatable="no">RecentFile0Action</attribute>
<attribute name="action">gnc-plugin-file-history-actions.RecentFile0Action</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder1">
<item>
<attribute name="label" translatable="yes">_Edit Account</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder1">
<item>
<attribute name="label" translatable="yes">Esti_mate Budget...</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">GncPluginPageInvoiceActions.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder1">
<item>
<attribute name="label" translatable="no">EditEditInvoiceAction</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder2-c">
<item>
<attribute name="label" translatable="yes">E_dit Customer</attribute>

View File

@ -1,6 +1,15 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print Cheques</attribute>
<attribute name="action">GncPluginPageRegisterActions.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder1">
<item>
<attribute name="label" translatable="yes">Assign as payment...</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print Report</attribute>
<attribute name="action">GncPluginPageReportActions.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the current report</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder6">
<item>
<attribute name="label" translatable="yes">_Report Options</attribute>
@ -10,7 +20,7 @@
</item>
</menu>
<menu id="FilePlaceholder3">
<menu id="FilePlaceholder4">
<item>
<attribute name="label" translatable="yes">Export as P_DF...</attribute>
<attribute name="action">GncPluginPageReportActions.FilePrintPDFAction</attribute>
@ -19,7 +29,7 @@
</item>
</menu>
<menu id="FilePlaceholder4">
<menu id="FilePlaceholder5">
<item>
<attribute name="label" translatable="yes">Export _Report</attribute>
<attribute name="action">GncPluginPageReportActions.ReportExportAction</attribute>

View File

@ -1,6 +1,16 @@
<?xml version="1.0"?>
<interface>
<menu id="FilePlaceholder3">
<item>
<attribute name="label" translatable="yes">_Print</attribute>
<attribute name="action">mainwin.FilePrintAction</attribute>
<attribute name="accel">&lt;Primary&gt;p</attribute>
<attribute name="tooltip" translatable="yes">Print the currently active page</attribute>
<attribute name="temp" translatable="no">yes</attribute>
</item>
</menu>
<menu id="EditPlaceholder3">
<item>
<attribute name="label" translatable="yes">_Find...</attribute>