[gnome-builder] app: move to dzl_application_get_menu_by_id()



commit d5465ba2a4566344b3b3d37e8caf0875b3361c51
Author: Christian Hergert <chergert redhat com>
Date:   Mon Jun 5 14:29:15 2017 -0700

    app: move to dzl_application_get_menu_by_id()
    
    We no longer need this code in Builder as it has been moved to libdazzle.

 libide/application/ide-application-private.h       |    3 --
 libide/application/ide-application.c               |   34 --------------------
 libide/application/ide-application.h               |    2 -
 libide/editor/ide-editor-frame.c                   |    2 +-
 libide/sourceview/ide-source-view.c                |    2 +-
 libide/workbench/ide-layout-tab.c                  |    2 +-
 libide/workbench/ide-workbench-header-bar.c        |    2 +-
 plugins/beautifier/gb-beautifier-workbench-addin.c |    4 +-
 plugins/project-tree/gb-project-tree-builder.c     |    2 +-
 plugins/project-tree/gb-project-tree.c             |    2 +-
 plugins/terminal/gb-terminal.c                     |    2 +-
 11 files changed, 9 insertions(+), 48 deletions(-)
---
diff --git a/libide/application/ide-application-private.h b/libide/application/ide-application-private.h
index f77ea9b..65de80f 100644
--- a/libide/application/ide-application-private.h
+++ b/libide/application/ide-application-private.h
@@ -55,9 +55,6 @@ struct _IdeApplication
 
   IdeThemeManager     *theme_manager;
 
-  DzlMenuManager      *menu_manager;
-  GHashTable          *merge_ids;
-
   GHashTable          *plugin_css;
   GHashTable          *plugin_gresources;
 
diff --git a/libide/application/ide-application.c b/libide/application/ide-application.c
index 1e8cde3..8d60e36 100644
--- a/libide/application/ide-application.c
+++ b/libide/application/ide-application.c
@@ -167,19 +167,12 @@ ide_application_register_keybindings (IdeApplication *self)
 static void
 ide_application_register_plugin_accessories (IdeApplication *self)
 {
-  GMenu *app_menu;
   IDE_ENTRY;
 
   g_assert (IDE_IS_APPLICATION (self));
 
-  self->menu_manager = dzl_menu_manager_new ();
-  dzl_menu_manager_add_resource (self->menu_manager, "/org/gnome/builder/gtk/menus.ui", NULL);
-
   ide_application_init_plugin_accessories (self);
 
-  app_menu = dzl_menu_manager_get_menu_by_id (self->menu_manager, "app-menu");
-  gtk_application_set_app_menu (GTK_APPLICATION (self), G_MENU_MODEL (app_menu));
-
   IDE_EXIT;
 }
 
@@ -495,7 +488,6 @@ ide_application_finalize (GObject *object)
   g_clear_pointer (&self->dbus_address, g_free);
   g_clear_pointer (&self->tool_arguments, g_strfreev);
   g_clear_pointer (&self->started_at, g_date_time_unref);
-  g_clear_pointer (&self->merge_ids, g_hash_table_unref);
   g_clear_pointer (&self->plugin_css, g_hash_table_unref);
   g_clear_pointer (&self->plugin_settings, g_hash_table_unref);
   g_clear_pointer (&self->reapers, g_ptr_array_unref);
@@ -504,7 +496,6 @@ ide_application_finalize (GObject *object)
   g_clear_object (&self->keybindings);
   g_clear_object (&self->recent_projects);
   g_clear_object (&self->theme_manager);
-  g_clear_object (&self->menu_manager);
 
   G_OBJECT_CLASS (ide_application_parent_class)->finalize (object);
 }
@@ -757,31 +748,6 @@ ide_application_get_started_at (IdeApplication *self)
   return self->started_at;
 }
 
-/**
- * ide_application_get_menu_by_id:
- * @self: An #IdeApplication.
- * @id: The id of the menu to lookup.
- *
- * Similar to gtk_application_get_menu_by_id() but takes into account merging
- * the menus provided by, and extended by, plugins.
- *
- * Returns: (transfer none): A #GMenu.
- */
-GMenu *
-ide_application_get_menu_by_id (IdeApplication *self,
-                                const gchar    *id)
-{
-  g_return_val_if_fail (IDE_IS_APPLICATION (self), NULL);
-  g_return_val_if_fail (id != NULL, NULL);
-
-  if (self->menu_manager != NULL)
-    return dzl_menu_manager_get_menu_by_id (self->menu_manager, id);
-
-  g_critical ("%s() called by non-UI process", G_STRFUNC);
-
-  return NULL;
-}
-
 gboolean
 ide_application_open_project (IdeApplication *self,
                               GFile          *file)
diff --git a/libide/application/ide-application.h b/libide/application/ide-application.h
index 1172927..fbec15d 100644
--- a/libide/application/ide-application.h
+++ b/libide/application/ide-application.h
@@ -55,8 +55,6 @@ void                ide_application_get_worker_async     (IdeApplication       *
 GDBusProxy         *ide_application_get_worker_finish    (IdeApplication       *self,
                                                           GAsyncResult         *result,
                                                           GError              **error);
-GMenu              *ide_application_get_menu_by_id       (IdeApplication       *self,
-                                                          const gchar          *id);
 gboolean            ide_application_open_project         (IdeApplication       *self,
                                                           GFile                *file);
 void                ide_application_add_reaper           (IdeApplication       *self,
diff --git a/libide/editor/ide-editor-frame.c b/libide/editor/ide-editor-frame.c
index 89eea54..c5fd1fc 100644
--- a/libide/editor/ide-editor-frame.c
+++ b/libide/editor/ide-editor-frame.c
@@ -974,7 +974,7 @@ ide_editor_frame__search_populate_popup (IdeEditorFrame *self,
 
       group = gtk_widget_get_action_group (GTK_WIDGET (self->search_frame), "search-entry");
 
-      menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "ide-editor-frame-search-menu");
+      menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "ide-editor-frame-search-menu");
       gtk_menu_shell_bind_model (GTK_MENU_SHELL (popup), G_MENU_MODEL (menu), NULL, TRUE);
 
       clipboard = gtk_widget_get_clipboard (GTK_WIDGET (entry), GDK_SELECTION_CLIPBOARD);
diff --git a/libide/sourceview/ide-source-view.c b/libide/sourceview/ide-source-view.c
index 3d2595a..1c72fc3 100644
--- a/libide/sourceview/ide-source-view.c
+++ b/libide/sourceview/ide-source-view.c
@@ -5489,7 +5489,7 @@ ide_source_view_real_populate_popup (GtkTextView *text_view,
   if (!IDE_IS_BUFFER (buffer))
     return;
 
-  model = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "ide-source-view-popup-menu");
+  model = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "ide-source-view-popup-menu");
   gtk_menu_shell_bind_model (GTK_MENU_SHELL (popup), G_MENU_MODEL (model), NULL, TRUE);
 
   gtk_text_buffer_get_selection_bounds (buffer, &begin, &end);
diff --git a/libide/workbench/ide-layout-tab.c b/libide/workbench/ide-layout-tab.c
index 6affe84..10f0be0 100644
--- a/libide/workbench/ide-layout-tab.c
+++ b/libide/workbench/ide-layout-tab.c
@@ -243,7 +243,7 @@ ide_layout_tab_init (IdeLayoutTab *self)
 
   gtk_widget_add_events (GTK_WIDGET (self), GDK_ENTER_NOTIFY | GDK_LEAVE_NOTIFY);
 
-  menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "ide-layout-stack-menu");
+  menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "ide-layout-stack-menu");
   popover = gtk_popover_new_from_model (self->title_menu_button, G_MENU_MODEL (menu));
   gtk_menu_button_set_popover (GTK_MENU_BUTTON (self->title_menu_button), popover);
 }
diff --git a/libide/workbench/ide-workbench-header-bar.c b/libide/workbench/ide-workbench-header-bar.c
index f6a569d..7e9e64d 100644
--- a/libide/workbench/ide-workbench-header-bar.c
+++ b/libide/workbench/ide-workbench-header-bar.c
@@ -70,7 +70,7 @@ ide_workbench_header_bar_init (IdeWorkbenchHeaderBar *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  model = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "gear-menu");
+  model = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gear-menu");
   popover = gtk_popover_new_from_model (NULL, G_MENU_MODEL (model));
   gtk_widget_set_size_request (popover, 225, -1);
   gtk_menu_button_set_popover (priv->menu_button, popover);
diff --git a/plugins/beautifier/gb-beautifier-workbench-addin.c 
b/plugins/beautifier/gb-beautifier-workbench-addin.c
index 7e510dd..e8caf55 100644
--- a/plugins/beautifier/gb-beautifier-workbench-addin.c
+++ b/plugins/beautifier/gb-beautifier-workbench-addin.c
@@ -134,7 +134,7 @@ view_populate_submenu (GbBeautifierWorkbenchAddin *self,
       g_object_set_data_full (G_OBJECT (view), "gb-beautifier-default-action", NULL, g_free);
     }
 
-  default_menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "gb-beautify-default-section");
+  default_menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gb-beautify-default-section");
   g_menu_remove_all (default_menu);
 
   lang_id = gb_beautifier_helper_get_lang_id (self, view);
@@ -209,7 +209,7 @@ view_populate_popup (GbBeautifierWorkbenchAddin *self,
   g_assert (GTK_IS_WIDGET (popup));
   g_assert (IDE_IS_SOURCE_VIEW (source_view));
 
-  submenu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "gb-beautify-profiles-section");
+  submenu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gb-beautify-profiles-section");
   g_menu_remove_all (submenu);
   view_populate_submenu (self, source_view, submenu, self->entries);
 }
diff --git a/plugins/project-tree/gb-project-tree-builder.c b/plugins/project-tree/gb-project-tree-builder.c
index 2d70da2..81ed22f 100644
--- a/plugins/project-tree/gb-project-tree-builder.c
+++ b/plugins/project-tree/gb-project-tree-builder.c
@@ -308,7 +308,7 @@ gb_project_tree_builder_node_popup (IdeTreeBuilder *builder,
     {
       GMenu *mime_section;
 
-      mime_section = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT,
+      mime_section = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT,
                                                      "gb-project-tree-open-by-mime-section");
       populate_mime_handlers (mime_section, GB_PROJECT_FILE (item));
     }
diff --git a/plugins/project-tree/gb-project-tree.c b/plugins/project-tree/gb-project-tree.c
index 6f1cf88..195106c 100644
--- a/plugins/project-tree/gb-project-tree.c
+++ b/plugins/project-tree/gb-project-tree.c
@@ -340,7 +340,7 @@ gb_project_tree_init (GbProjectTree *self)
 
   gb_project_tree_actions_init (self);
 
-  menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "gb-project-tree-popup-menu");
+  menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gb-project-tree-popup-menu");
   ide_tree_set_context_menu (IDE_TREE (self), G_MENU_MODEL (menu));
 }
 
diff --git a/plugins/terminal/gb-terminal.c b/plugins/terminal/gb-terminal.c
index b9b48c0..0e00fb0 100644
--- a/plugins/terminal/gb-terminal.c
+++ b/plugins/terminal/gb-terminal.c
@@ -109,7 +109,7 @@ popup_targets_received (GtkClipboard     *clipboard,
 
       terminal->url  = vte_terminal_match_check_event (VTE_TERMINAL (terminal), (GdkEvent 
*)popup_info->event, NULL);
 
-      menu = ide_application_get_menu_by_id (IDE_APPLICATION_DEFAULT, "gb-terminal-view-popup-menu");
+      menu = dzl_application_get_menu_by_id (DZL_APPLICATION_DEFAULT, "gb-terminal-view-popup-menu");
       terminal->popup_menu = gtk_menu_new_from_model (G_MENU_MODEL (menu));
 
       group = gtk_widget_get_action_group (GTK_WIDGET (terminal), "terminal");


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]