Remove action callbacks that simply set the state

- it is the default behaviour
This commit is contained in:
Richard Cohen 2023-03-10 15:20:28 +00:00
parent 9b95419608
commit d36cf2177e
4 changed files with 10 additions and 59 deletions

View File

@ -276,22 +276,6 @@ GNC_DEFINE_TYPE_WITH_CODE(GncMainWindow, gnc_main_window, GTK_TYPE_APPLICATION_W
* code. */
static guint main_window_signals[LAST_SIGNAL] = { 0 };
static void
toggle_change_state (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
static void
radio_change_state (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
/** An array of all of the actions provided by the main window code.
* This includes some placeholder actions for the menus that are
* visible in the menu bar but have no action associated with
@ -317,10 +301,10 @@ static GActionEntry gnc_menu_actions [] =
{ "ViewSortByAction", nullptr, nullptr, nullptr, nullptr },
{ "ViewFilterByAction", nullptr, nullptr, nullptr, nullptr },
{ "ViewRefreshAction", gnc_main_window_cmd_view_refresh, nullptr, nullptr, nullptr },
{ "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", toggle_change_state },
{ "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", toggle_change_state },
{ "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", toggle_change_state },
{ "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", radio_change_state },
{ "ViewToolbarAction", gnc_main_window_cmd_view_toolbar, nullptr, "true", nullptr },
{ "ViewSummaryAction", gnc_main_window_cmd_view_summary, nullptr, "true", nullptr },
{ "ViewStatusbarAction", gnc_main_window_cmd_view_statusbar, nullptr, "true", nullptr },
{ "ViewTabPositionAction", gnc_main_window_cmd_view_tab_position, "i", "@i 0", nullptr },
{ "ScheduledAction", nullptr, nullptr, nullptr, nullptr },
@ -329,7 +313,7 @@ static GActionEntry gnc_menu_actions [] =
{ "WindowNewAction", gnc_main_window_cmd_window_new, nullptr, nullptr, nullptr },
{ "WindowMovePageAction", gnc_main_window_cmd_window_move_page, nullptr, nullptr, nullptr },
#ifndef MAC_INTEGRATION
{ "WindowAction", gnc_main_window_cmd_window_raise, "i", "@i 0", radio_change_state },
{ "WindowAction", gnc_main_window_cmd_window_raise, "i", "@i 0", nullptr },
#endif
{ "HelpTutorialAction", gnc_main_window_cmd_help_tutorial, nullptr, nullptr, nullptr },
{ "HelpContentsAction", gnc_main_window_cmd_help_contents, nullptr, nullptr, nullptr },

View File

@ -96,15 +96,6 @@ static void gnc_plugin_page_invoice_cmd_edit_tax (GSimpleAction *simple, GVarian
static void gnc_plugin_page_redraw_help_cb (GnucashRegister *gsr, GncPluginPageInvoice *invoice_page);
static void gnc_plugin_page_invoice_refresh_cb (GHashTable *changes, gpointer user_data);
static void
radio_change_state (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
/************************************************************
* Actions *
************************************************************/
@ -135,7 +126,7 @@ static GActionEntry gnc_plugin_page_invoice_actions [] =
{ "BusinessLinkOpenAction", gnc_plugin_page_invoice_cmd_link_open, NULL, NULL, NULL },
{ "ToolsProcessPaymentAction", gnc_plugin_page_invoice_cmd_pay_invoice, NULL, NULL, NULL },
{ "ReportsCompanyReportAction", gnc_plugin_page_invoice_cmd_company_report, NULL, NULL, NULL },
{ "SortOrderRadioAction", gnc_plugin_page_invoice_cmd_sort_changed, "i", "@i 0", radio_change_state },
{ "SortOrderRadioAction", gnc_plugin_page_invoice_cmd_sort_changed, "i", "@i 0", NULL },
};
static guint gnc_plugin_page_invoice_n_actions = G_N_ELEMENTS(gnc_plugin_page_invoice_actions);

View File

@ -243,22 +243,6 @@ static void gnc_plugin_page_register_event_handler (QofInstance* entity,
static GncInvoice* invoice_from_split (Split* split);
static GList* invoices_from_transaction (Transaction* trans);
static void
toggle_change_state (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
static void
radio_change_state (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
/************************************************************/
/* Actions */
/************************************************************/
@ -341,9 +325,9 @@ static GActionEntry gnc_plugin_page_register_actions [] =
{ "ReportsAccountReportAction", gnc_plugin_page_register_cmd_account_report, NULL, NULL, NULL },
{ "ReportsAcctTransReportAction", gnc_plugin_page_register_cmd_transaction_report, NULL, NULL, NULL },
{ "ViewStyleDoubleLineAction", gnc_plugin_page_register_cmd_style_double_line, NULL, "false", toggle_change_state },
{ "SplitTransactionAction", gnc_plugin_page_register_cmd_expand_transaction, NULL, "false", toggle_change_state },
{ "ViewStyleRadioAction", gnc_plugin_page_register_cmd_style_changed, "i", "@i 0", radio_change_state },
{ "ViewStyleDoubleLineAction", gnc_plugin_page_register_cmd_style_double_line, NULL, "false", NULL },
{ "SplitTransactionAction", gnc_plugin_page_register_cmd_expand_transaction, NULL, "false", NULL },
{ "ViewStyleRadioAction", gnc_plugin_page_register_cmd_style_changed, "i", "@i 0", NULL },
};
static guint gnc_plugin_page_register_n_actions = G_N_ELEMENTS(gnc_plugin_page_register_actions);

View File

@ -82,14 +82,6 @@ static void gnc_plugin_ab_cmd_aqb_import (GSimpleAction *simple, GVariant *param
#define MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW "ABViewLogwindowAction"
static void
change_state_logwindow (GSimpleAction *simple,
GVariant *state,
gpointer user_data)
{
g_simple_action_set_state (simple, state);
}
static GActionEntry gnc_plugin_actions [] =
{
{ "OnlineActionsAction", NULL, NULL, NULL, NULL },
@ -101,7 +93,7 @@ static GActionEntry gnc_plugin_actions [] =
{ "ABIssueIntTransAction", gnc_plugin_ab_cmd_issue_inttransaction, NULL, NULL, NULL },
{ "ABIssueSepaDirectDebitAction", gnc_plugin_ab_cmd_issue_sepa_direct_debit, NULL, NULL, NULL },
{ "AQBankingImportAction", gnc_plugin_ab_cmd_aqb_import, NULL, NULL, NULL },
{ MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW, gnc_plugin_ab_cmd_view_logwindow, NULL, "true", change_state_logwindow },
{ MENU_TOGGLE_ACTION_AB_VIEW_LOGWINDOW, gnc_plugin_ab_cmd_view_logwindow, NULL, "true", NULL },
};
/** The number of actions provided by this plugin. */
static guint gnc_plugin_n_actions = G_N_ELEMENTS(gnc_plugin_actions);