diff --git a/gnucash/gnome-utils/gnc-embedded-window.c b/gnucash/gnome-utils/gnc-embedded-window.c index fc11a7836f..118c530fc0 100644 --- a/gnucash/gnome-utils/gnc-embedded-window.c +++ b/gnucash/gnome-utils/gnc-embedded-window.c @@ -128,8 +128,6 @@ gnc_embedded_window_open_page (GncEmbeddedWindow *window, gtk_box_pack_end(GTK_BOX(window), page->notebook_page, TRUE, TRUE, 2); gnc_plugin_page_inserted (page); - -//FIXMEb gnc_plugin_page_merge_actions (page, window->ui_merge); LEAVE(" "); } @@ -158,9 +156,6 @@ gnc_embedded_window_close_page (GncEmbeddedWindow *window, priv->page = NULL; gnc_plugin_page_removed (page); -//FIXMEb gnc_plugin_page_unmerge_actions (page, window->ui_merge); -// gtk_ui_manager_ensure_update (window->ui_merge); - gnc_plugin_page_destroy_widget (page); g_object_unref(page); LEAVE(" "); diff --git a/gnucash/gnome-utils/gnc-main-window.cpp b/gnucash/gnome-utils/gnc-main-window.cpp index 1c7f7843f3..a21327d7f3 100644 --- a/gnucash/gnome-utils/gnc-main-window.cpp +++ b/gnucash/gnome-utils/gnc-main-window.cpp @@ -3248,7 +3248,6 @@ gnc_main_window_disconnect (GncMainWindow *window, priv = GNC_MAIN_WINDOW_GET_PRIVATE(window); if (priv->current_page == page) { -//FIXMEb gnc_plugin_page_unmerge_actions (page, window->ui_merge); gnc_plugin_page_unselected (page); priv->current_page = nullptr; } @@ -3291,7 +3290,6 @@ gnc_main_window_disconnect (GncMainWindow *window, gnc_plugin_page_removed (page); -//FIXMEb gtk_ui_manager_ensure_update (window->ui_merge); gnc_window_set_status (GNC_WINDOW(window), page, nullptr); } @@ -3708,9 +3706,7 @@ gnc_main_window_unmerge_actions (GncMainWindow *window, if (entry == nullptr) return; -//FIXMEb gtk_ui_manager_remove_action_group (window->ui_merge, entry->action_group); -// gtk_ui_manager_remove_ui (window->ui_merge, entry->merge_id); -// gtk_ui_manager_ensure_update (window->ui_merge); + gtk_widget_insert_action_group (GTK_WIDGET(window), group_name, nullptr); g_hash_table_remove (priv->merged_actions_table, group_name); } @@ -4651,7 +4647,6 @@ gnc_main_window_switch_page (GtkNotebook *notebook, if (priv->current_page != nullptr) { page = priv->current_page; -//FIXMEb gnc_plugin_page_unmerge_actions (page, window->ui_merge); gnc_plugin_page_unselected (page); } @@ -4670,7 +4665,7 @@ gnc_main_window_switch_page (GtkNotebook *notebook, if (page != nullptr) { /* Update the user interface (e.g. menus and toolbars */ - gnc_plugin_page_merge_actionsb (page, GTK_WIDGET(window)); + gnc_plugin_page_merge_actions (page, GTK_WIDGET(window)); visible = gnc_main_window_show_summarybar (window, nullptr); gnc_plugin_page_show_summarybar (page, visible); diff --git a/gnucash/gnome-utils/gnc-plugin-page.c b/gnucash/gnome-utils/gnc-plugin-page.c index 978978abc3..9c97884b84 100644 --- a/gnucash/gnome-utils/gnc-plugin-page.c +++ b/gnucash/gnome-utils/gnc-plugin-page.c @@ -91,9 +91,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; typedef struct _GncPluginPagePrivate { /** The group of all actions provided by this plugin. */ - GtkActionGroup *action_group; - GtkUIManager *ui_merge; - guint merge_id; char *ui_description; GtkBuilder *builder; //FIXMEb added @@ -258,25 +255,8 @@ gnc_plugin_page_recreate_page(GtkWidget *window, } -/* Add the actions for a content page to the specified window. */ void gnc_plugin_page_merge_actions (GncPluginPage *page, - GtkUIManager *ui_merge) -{ - GncPluginPagePrivate *priv; - - g_return_if_fail (GNC_IS_PLUGIN_PAGE(page)); - - priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); - priv->ui_merge = ui_merge; - gtk_action_group_set_sensitive (priv->action_group, TRUE); - priv->merge_id = gnc_plugin_add_actions (priv->ui_merge, - priv->action_group, - priv->ui_description); -} - -void -gnc_plugin_page_merge_actionsb (GncPluginPage *page, GtkWidget *window) { GncPluginPagePrivate *priv; @@ -304,28 +284,6 @@ gnc_plugin_page_merge_actionsb (GncPluginPage *page, } -/* Remove the actions for a content page from the specified window. */ -void -gnc_plugin_page_unmerge_actions (GncPluginPage *page, - GtkUIManager *ui_merge) -{ - GncPluginPagePrivate *priv; - - priv = GNC_PLUGIN_PAGE_GET_PRIVATE(page); - - g_return_if_fail (GNC_IS_PLUGIN_PAGE(page)); - g_return_if_fail (priv->merge_id != 0); - g_return_if_fail (priv->action_group != NULL); - - gtk_ui_manager_remove_ui (ui_merge, priv->merge_id); - gtk_action_group_set_sensitive (priv->action_group, FALSE); - gtk_ui_manager_remove_action_group (ui_merge, priv->action_group); - - priv->ui_merge = NULL; - priv->merge_id = 0; -} - - GAction * gnc_plugin_page_get_action (GncPluginPage *page, const gchar *name) { @@ -473,28 +431,6 @@ gnc_plugin_page_class_init (GncPluginPageClass *klass) NULL, G_PARAM_READWRITE)); - g_object_class_install_property - (gobject_class, - PROP_UI_MERGE, - g_param_spec_object ("ui-merge", - "UI Merge", - "A pointer to the GtkUIManager object that " - "represents this pages menu hierarchy.", - GTK_TYPE_UI_MANAGER, - G_PARAM_READABLE)); - - g_object_class_install_property - (gobject_class, - PROP_ACTION_GROUP, - g_param_spec_object ("action-group", - "Action Group", - "A pointer to the GtkActionGroup object that " - "represents this pages available menu/toolbar " - "actions.", - GTK_TYPE_ACTION_GROUP, - G_PARAM_READABLE)); - - signals[INSERTED] = g_signal_new ("inserted", @@ -671,12 +607,6 @@ gnc_plugin_page_get_property (GObject *object, case PROP_UI_DESCRIPTION: g_value_set_string (value, priv->ui_description); break; - case PROP_UI_MERGE: - g_value_take_object (value, priv->ui_merge); - break; - case PROP_ACTION_GROUP: - g_value_take_object (value, priv->action_group); - break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; diff --git a/gnucash/gnome-utils/gnc-plugin-page.h b/gnucash/gnome-utils/gnc-plugin-page.h index bf079734b9..6797f64101 100644 --- a/gnucash/gnome-utils/gnc-plugin-page.h +++ b/gnucash/gnome-utils/gnc-plugin-page.h @@ -290,24 +290,10 @@ GncPluginPage *gnc_plugin_page_recreate_page (GtkWidget *window, * @param plugin_page A pointer to the page whose actions should be * added to the user interface. * - * @param merge A pointer to the UI manager data structure for a - * window. + * @param merge A pointer to the window. */ void gnc_plugin_page_merge_actions (GncPluginPage *plugin_page, - GtkUIManager *merge); -void gnc_plugin_page_merge_actionsb (GncPluginPage *plugin_page, - GtkWidget *window); //FIXMEb added - -/** Remove the actions for a content page from the specified window. - * - * @param plugin_page A pointer to the page whose actions should be - * removed from the user interface. - * - * @param merge A pointer to the UI manager data structure for a - * window. - */ -void gnc_plugin_page_unmerge_actions (GncPluginPage *plugin_page, - GtkUIManager *merge); + GtkWidget *window); //FIXMEb added /** Retrieve the textual name of a plugin. diff --git a/gnucash/gnome-utils/gnc-plugin.c b/gnucash/gnome-utils/gnc-plugin.c index 318808da34..a85aff94b8 100644 --- a/gnucash/gnome-utils/gnc-plugin.c +++ b/gnucash/gnome-utils/gnc-plugin.c @@ -262,84 +262,5 @@ gnc_plugin_set_actions_enabled (GSimpleActionGroup *simple_action_group, } } -/** Load a new set of actions into an existing UI. - * - * See gnc-plugin.h for documentation on the function arguments. */ -gint -gnc_plugin_add_actions (GtkUIManager *ui_merge, - GtkActionGroup *action_group, - const gchar *filename) -{ - GError *error = NULL; - gchar *pathname; - gint merge_id; - - g_return_val_if_fail (ui_merge, 0); - g_return_val_if_fail (action_group, 0); - g_return_val_if_fail (filename, 0); - - ENTER("ui_merge %p, action_group %p, filename %s", - ui_merge, action_group, filename); - gtk_ui_manager_insert_action_group (ui_merge, action_group, 0); - - pathname = gnc_filepath_locate_ui_file (filename); - if (pathname == NULL) - { - LEAVE("fail"); - return 0; - } - - merge_id = gtk_ui_manager_add_ui_from_file (ui_merge, pathname, &error); - DEBUG("merge_id is %d", merge_id); - - g_assert(merge_id || error); - if (merge_id) - { - gtk_ui_manager_ensure_update (ui_merge); - } - else - { - g_critical("Failed to load ui file.\n Filename %s\n Error %s", - filename, error->message); - g_error_free(error); - } - - g_free(pathname); - LEAVE(" "); - return merge_id; -} - -#if 0 -static void -gnc_plugin_base_init (gpointer klass) -{ - static gboolean initialized = FALSE; - - if (!initialized) - { - initialized = TRUE; - - signals[MERGE_ACTIONS] = g_signal_new ("merge-actions", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GncPluginClass, merge_actions), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, - 1, - GTK_TYPE_MENU_MERGE); - signals[UNMERGE_ACTIONS] = g_signal_new ("unmerge-actions", - G_OBJECT_CLASS_TYPE (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (GncPluginClass, unmerge_actions), - NULL, NULL, - g_cclosure_marshal_VOID__POINTER, - G_TYPE_NONE, - 1, - GTK_TYPE_MENU_MERGE); - } -} -#endif - /** @} */ /** @} */ diff --git a/gnucash/gnome-utils/gnc-plugin.h b/gnucash/gnome-utils/gnc-plugin.h index 612937606d..d0a1281f46 100644 --- a/gnucash/gnome-utils/gnc-plugin.h +++ b/gnucash/gnome-utils/gnc-plugin.h @@ -268,24 +268,6 @@ void gnc_plugin_set_actions_enabled (GSimpleActionGroup *simple_action_group, const gchar **action_names, gboolean enable); //FIXMEb added -/** Load a new set of actions into an existing UI. The actions from - * the provided group will be merged into the pre-existing ui, as - * directed by the specified file. - * - * @param ui_merge A pointer to the UI manager data structure for a - * window. - * - * @param action_group The set of actions provided by a given plugin. - * - * @param filename The name of the ui description file. This file - * name will be searched for in the ui directory. - * - * @return The merge_id number for the newly merged UI. If an error - * occurred, the return value is 0. - */ -gint gnc_plugin_add_actions (GtkUIManager *ui_merge, - GtkActionGroup *action_group, - const gchar *filename); G_END_DECLS #endif /* __GNC_PLUGIN_H */