From 8331f9988652582fc48e12cd4ad8dbd32c74d07e Mon Sep 17 00:00:00 2001 From: John Ralls Date: Thu, 12 Dec 2024 14:20:25 -0800 Subject: [PATCH] Make struct GtkMainWindow private with accessor for just_plugin_prefs. --- gnucash/gnome-utils/gnc-main-window.cpp | 14 +++++++++++++- gnucash/gnome-utils/gnc-main-window.h | 9 +++------ gnucash/gnome-utils/gnc-plugin-menu-additions.c | 2 +- gnucash/gnome-utils/gnc-plugin.c | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp index 09e59c3a41d..f55dace0f1a 100644 --- a/gnucash/gnome-utils/gnc-main-window.cpp +++ b/gnucash/gnome-utils/gnc-main-window.cpp @@ -208,10 +208,16 @@ static void gnc_quartz_set_menu (GncMainWindow* window); #endif static void gnc_main_window_init_menu_updaters (GncMainWindow *window); +struct _GncMainWindow +{ + GtkApplicationWindow gtk_application_window; /**< The parent object for a main window. */ + gboolean window_quitting; /**< Set to TRUE when quitting from this window. */ + gboolean just_plugin_prefs; /**< Just remove preferences only from plugins */ +}; /** The instance private data structure for an embedded window * object. */ -typedef struct GncMainWindowPrivate +typedef struct { /** The dock (vbox) at the top of the window containing the * menubar and toolbar. These items are generated by the UI @@ -5666,5 +5672,11 @@ gnc_main_window_get_menu_model (GncMainWindow *window) return priv->menubar_model; } +gboolean +gnc_main_window_just_plugin_prefs (GncMainWindow* window) +{ + return window->just_plugin_prefs; +} + /** @} */ /** @} */ diff --git a/gnucash/gnome-utils/gnc-main-window.h b/gnucash/gnome-utils/gnc-main-window.h index 63bd933d6dc..d5157a3074c 100644 --- a/gnucash/gnome-utils/gnc-main-window.h +++ b/gnucash/gnome-utils/gnc-main-window.h @@ -63,12 +63,7 @@ typedef struct } GncMenuUpdate; /** The instance data structure for a main window object. */ -typedef struct GncMainWindow -{ - GtkApplicationWindow gtk_application_window; /**< The parent object for a main window. */ - gboolean window_quitting; /**< Set to TRUE when quitting from this window. */ - gboolean just_plugin_prefs; /**< Just remove preferences only from plugins */ -} GncMainWindow; +typedef struct _GncMainWindow GncMainWindow; /** The class data structure for a main window object. */ typedef struct @@ -545,6 +540,8 @@ void gnc_main_window_update_menu_and_toolbar (GncMainWindow *window, **/ void gnc_main_window_show_all_windows(void); +gboolean gnc_main_window_just_plugin_prefs (GncMainWindow* window); + /** * Opens the Book Options dialog. * diff --git a/gnucash/gnome-utils/gnc-plugin-menu-additions.c b/gnucash/gnome-utils/gnc-plugin-menu-additions.c index 69051b8630d..483912b4b13 100644 --- a/gnucash/gnome-utils/gnc-plugin-menu-additions.c +++ b/gnucash/gnome-utils/gnc-plugin-menu-additions.c @@ -543,7 +543,7 @@ gnc_plugin_menu_additions_remove_from_window (GncPlugin *plugin, * actions name is installed into the plugin class. */ simple_action_group = gnc_main_window_get_action_group (window, PLUGIN_ACTIONS_NAME); - if (simple_action_group && !window->just_plugin_prefs) + if (simple_action_group && !gnc_main_window_just_plugin_prefs (window)) gtk_widget_insert_action_group (GTK_WIDGET(window), PLUGIN_ACTIONS_NAME, NULL); LEAVE(" "); diff --git a/gnucash/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c index 1dd26f14542..3cf42db4af5 100644 --- a/gnucash/gnome-utils/gnc-plugin.c +++ b/gnucash/gnome-utils/gnc-plugin.c @@ -196,7 +196,7 @@ gnc_plugin_remove_from_window (GncPlugin *plugin, /* * Update window to remove UI items */ - if (klass->actions_name && !window->just_plugin_prefs) + if (klass->actions_name && !gnc_main_window_just_plugin_prefs (window)) { DEBUG ("%s: %d actions to unmerge", klass->actions_name, (klass->n_actions));