Commits

Anonymous committed 56b5dbd

Do not create UIXML instance in moo_editor_get_ui_xml, so plugins do not install their menu items when no gui is created

Comments (0)

Files changed (4)

moo/mooedit/mooeditor.c

 moo_editor_get_ui_xml (MooEditor      *editor)
 {
     g_return_val_if_fail (MOO_IS_EDITOR (editor), NULL);
-
-    if (!editor->priv->ui_xml)
-        editor->priv->ui_xml = moo_ui_xml_new ();
-
     return editor->priv->ui_xml;
 }
 

moo/mooedit/plugins/fileselector.c

                                  "closure-callback", show_file_selector,
                                  NULL);
 
-    plugin->ui_merge_id = moo_ui_xml_new_merge_id (xml);
-
-    moo_ui_xml_add_item (xml, plugin->ui_merge_id,
-                         "Editor/Menubar/View",
-                         "ShowFileSelector",
-                         "ShowFileSelector", -1);
+    if (xml)
+    {
+        plugin->ui_merge_id = moo_ui_xml_new_merge_id (xml);
+        moo_ui_xml_add_item (xml, plugin->ui_merge_id,
+                             "Editor/Menubar/View",
+                             "ShowFileSelector",
+                             "ShowFileSelector", -1);
+    }
 
     moo_prefs_new_key_string (DIR_PREFS, NULL);
 

moo/mooedit/plugins/moofind.c

                                  "closure-callback", find_file_cb,
                                  NULL);
 
-    plugin->ui_merge_id = moo_ui_xml_new_merge_id (xml);
-
-    moo_ui_xml_add_item (xml, plugin->ui_merge_id,
-                         "Editor/Menubar/Search",
-                         "FindInFiles", "FindInFiles", -1);
-    moo_ui_xml_add_item (xml, plugin->ui_merge_id,
-                         "Editor/Menubar/Search",
-                         "FindFile", "FindFile", -1);
+    if (xml)
+    {
+        plugin->ui_merge_id = moo_ui_xml_new_merge_id (xml);
+        moo_ui_xml_add_item (xml, plugin->ui_merge_id,
+                             "Editor/Menubar/Search",
+                             "FindInFiles", "FindInFiles", -1);
+        moo_ui_xml_add_item (xml, plugin->ui_merge_id,
+                             "Editor/Menubar/Search",
+                             "FindFile", "FindFile", -1);
+    }
 
     g_type_class_unref (klass);
     return TRUE;
 
     init_actions ();
 
+    xml = moo_ui_xml_new ();
+    moo_ui_xml_add_ui_from_string (xml, MEDIT_UI, -1);
+
     editor = moo_editor_instance ();
+    moo_editor_set_ui_xml (editor, xml);
     lang_table = moo_editor_get_lang_table (editor);
     user_dir = g_build_filename (g_get_home_dir (), ".medit", "syntax", NULL);
     moo_lang_table_add_dir (lang_table, MOO_TEXT_LANG_FILES_DIR);
 
     g_signal_connect (editor, "all-windows-closed", G_CALLBACK (gtk_main_quit), NULL);
 
-    xml = moo_editor_get_ui_xml (editor);
-    moo_ui_xml_add_ui_from_string (xml, MEDIT_UI, -1);
-
     moo_plugin_init_builtin ();
 
     user_dir = g_build_filename (g_get_home_dir (), ".medit", "plugins", NULL);