[gnome-builder/wip/chergert/perspective] plugins: check for gtk/menus.ui in plugin data dir



commit 3500fc9cebda0cdc4e4a24f64e48d54486d288f9
Author: Christian Hergert <chergert redhat com>
Date:   Sat Dec 5 00:32:51 2015 -0800

    plugins: check for gtk/menus.ui in plugin data dir

 libide/ide-application-plugins.c |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-application-plugins.c b/libide/ide-application-plugins.c
index 1dbe910..8633f9c 100644
--- a/libide/ide-application-plugins.c
+++ b/libide/ide-application-plugins.c
@@ -203,12 +203,31 @@ ide_application_load_plugin_menus (IdeApplication *self,
   g_assert (plugin_info != NULL);
   g_assert (PEAS_IS_ENGINE (engine));
 
+  /*
+   * First check embedded resource for menus.ui.
+   */
   module_name = peas_plugin_info_get_module_name (plugin_info);
   path = g_strdup_printf ("/org/gnome/builder/plugins/%s/gtk/menus.ui", module_name);
   merge_id = egg_menu_manager_add_resource (self->menu_manager, path, NULL);
   if (merge_id != 0)
     g_hash_table_insert (self->merge_ids, g_strdup (module_name), GINT_TO_POINTER (merge_id));
   g_free (path);
+
+  /*
+   * Maybe this is python and embedded resources are annoying to build.
+   * Could be a file on disk.
+   */
+  if (merge_id == 0)
+    {
+      path = g_strdup_printf ("%s/gtk/menus.ui", peas_plugin_info_get_data_dir (plugin_info));
+      if (g_file_test (path, G_FILE_TEST_IS_REGULAR))
+        {
+          merge_id = egg_menu_manager_add_filename (self->menu_manager, path, NULL);
+          if (merge_id != 0)
+            g_hash_table_insert (self->merge_ids, g_strdup (module_name), GINT_TO_POINTER (merge_id));
+        }
+      g_free (path);
+    }
 }
 
 static void


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