Make struct GtkMainWindow private with accessor for just_plugin_prefs.

This commit is contained in:
John Ralls 2024-12-12 14:20:25 -08:00
parent 81e11f70c3
commit 8331f99886
4 changed files with 18 additions and 9 deletions

View File

@ -208,10 +208,16 @@ static void gnc_quartz_set_menu (GncMainWindow* window);
#endif #endif
static void gnc_main_window_init_menu_updaters (GncMainWindow *window); 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 /** The instance private data structure for an embedded window
* object. */ * object. */
typedef struct GncMainWindowPrivate typedef struct
{ {
/** The dock (vbox) at the top of the window containing the /** The dock (vbox) at the top of the window containing the
* menubar and toolbar. These items are generated by the UI * 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; return priv->menubar_model;
} }
gboolean
gnc_main_window_just_plugin_prefs (GncMainWindow* window)
{
return window->just_plugin_prefs;
}
/** @} */ /** @} */
/** @} */ /** @} */

View File

@ -63,12 +63,7 @@ typedef struct
} GncMenuUpdate; } GncMenuUpdate;
/** The instance data structure for a main window object. */ /** The instance data structure for a main window object. */
typedef struct GncMainWindow typedef struct _GncMainWindow 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;
/** The class data structure for a main window object. */ /** The class data structure for a main window object. */
typedef struct typedef struct
@ -545,6 +540,8 @@ void gnc_main_window_update_menu_and_toolbar (GncMainWindow *window,
**/ **/
void gnc_main_window_show_all_windows(void); void gnc_main_window_show_all_windows(void);
gboolean gnc_main_window_just_plugin_prefs (GncMainWindow* window);
/** /**
* Opens the Book Options dialog. * Opens the Book Options dialog.
* *

View File

@ -543,7 +543,7 @@ gnc_plugin_menu_additions_remove_from_window (GncPlugin *plugin,
* actions name is installed into the plugin class. */ * actions name is installed into the plugin class. */
simple_action_group = gnc_main_window_get_action_group (window, PLUGIN_ACTIONS_NAME); 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); gtk_widget_insert_action_group (GTK_WIDGET(window), PLUGIN_ACTIONS_NAME, NULL);
LEAVE(" "); LEAVE(" ");

View File

@ -196,7 +196,7 @@ gnc_plugin_remove_from_window (GncPlugin *plugin,
/* /*
* Update window to remove UI items * 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", DEBUG ("%s: %d actions to unmerge",
klass->actions_name, (klass->n_actions)); klass->actions_name, (klass->n_actions));