[gedit] Use descriptive names for the menu extension points



commit 5747ec3f542a5059e2a19aa69cd520b8fcbe7676
Author: Paolo Borelli <pborelli gnome org>
Date:   Wed Feb 5 22:35:44 2014 +0100

    Use descriptive names for the menu extension points

 gedit/gedit-menu.ui                           |  146 ++++++++++++------------
 plugins/docinfo/gedit-docinfo-plugin.c        |    3 +-
 plugins/externaltools/tools/appactivatable.py |    4 +-
 plugins/quickopen/quickopen/__init__.py       |    2 +-
 plugins/snippets/snippets/appactivatable.py   |    2 +-
 plugins/sort/gedit-sort-plugin.c              |    3 +-
 plugins/spell/gedit-spell-app-activatable.c   |    3 +-
 plugins/time/gedit-time-plugin.c              |    3 +-
 8 files changed, 81 insertions(+), 85 deletions(-)
---
diff --git a/gedit/gedit-menu.ui b/gedit/gedit-menu.ui
index 2e0901e..b1e356f 100644
--- a/gedit/gedit-menu.ui
+++ b/gedit/gedit-menu.ui
@@ -3,21 +3,21 @@
   <!-- interface-requires gtk+ 3.0 -->
   <menu id="appmenu">
     <section>
-      <attribute name="id">appmenuext1</attribute>
+      <attribute name="id">app-commands-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_New Window</attribute>
         <attribute name="action">app.new-window</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">appmenuext2</attribute>
+      <attribute name="id">preferences-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">appmenuext3</attribute>
+      <attribute name="id">help-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Help</attribute>
         <attribute name="action">app.help</attribute>
@@ -34,10 +34,10 @@
   </menu>
   <menu id="gear_menu_withappmenu">
     <section>
-      <attribute name="id">ext1</attribute>
+      <attribute name="id">file-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext2</attribute>
+      <attribute name="id">file-section-1</attribute>
       <item>
         <attribute name="label" translatable="yes">_Reload</attribute>
         <attribute name="action">win.revert</attribute>
@@ -52,39 +52,14 @@
       </item>
     </section>
     <section>
-      <attribute name="id">ext3</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext4</attribute>
+      <attribute name="id">print-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Print…</attribute>
         <attribute name="action">win.print</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">ext5</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext6</attribute>
-      <item>
-        <attribute name="label" translatable="yes">Side _Panel</attribute>
-        <attribute name="action">win.side-panel</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
-        <attribute name="action">win.bottom-panel</attribute>
-        <attribute name="hidden-when">action-disabled</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Fullscreen</attribute>
-        <attribute name="action">win.fullscreen</attribute>
-      </item>
-    </section>
-    <section>
-      <attribute name="id">ext7</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext8</attribute>
+      <attribute name="id">search-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Find…</attribute>
         <attribute name="action">win.find</attribute>
@@ -103,23 +78,48 @@
       </item>
     </section>
     <section>
-      <attribute name="id">ext9</attribute>
+      <attribute name="id">edit-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext10</attribute>
+      <attribute name="id">edit-section-1</attribute>
+    </section>
+    <section>
+      <attribute name="id">view-section</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Side _Panel</attribute>
+        <attribute name="action">win.side-panel</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
+        <attribute name="action">win.bottom-panel</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">view-section-1</attribute>
+    </section>
+    <section>
+      <attribute name="id">view-section-2</attribute>
       <item>
         <attribute name="label" translatable="yes">_Highlight Mode…</attribute>
         <attribute name="action">win.highlight-mode</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">ext11</attribute>
+      <attribute name="id">spell-section</attribute>
+    </section>
+    <section>
+      <attribute name="id">tools-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext12</attribute>
+      <attribute name="id">tools-section-1</attribute>
     </section>
     <section>
-      <attribute name="id">ext13</attribute>
+      <attribute name="id">close-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Close All</attribute>
         <attribute name="action">win.close-all</attribute>
@@ -132,10 +132,10 @@
   </menu>
   <menu id="gear_menu_noappmenu">
     <section>
-      <attribute name="id">ext1</attribute>
+      <attribute name="id">file-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext2</attribute>
+      <attribute name="id">file-section-1</attribute>
       <item>
         <attribute name="label" translatable="yes">_Reload</attribute>
         <attribute name="action">win.revert</attribute>
@@ -150,39 +150,14 @@
       </item>
     </section>
     <section>
-      <attribute name="id">ext3</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext4</attribute>
+      <attribute name="id">print-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Print…</attribute>
         <attribute name="action">win.print</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">ext5</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext6</attribute>
-      <item>
-        <attribute name="label" translatable="yes">Side _Panel</attribute>
-        <attribute name="action">win.side-panel</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
-        <attribute name="action">win.bottom-panel</attribute>
-        <attribute name="hidden-when">action-disabled</attribute>
-      </item>
-      <item>
-        <attribute name="label" translatable="yes">_Fullscreen</attribute>
-        <attribute name="action">win.fullscreen</attribute>
-      </item>
-    </section>
-    <section>
-      <attribute name="id">ext7</attribute>
-    </section>
-    <section>
-      <attribute name="id">ext8</attribute>
+      <attribute name="id">search-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Find…</attribute>
         <attribute name="action">win.find</attribute>
@@ -201,30 +176,55 @@
       </item>
     </section>
     <section>
-      <attribute name="id">ext9</attribute>
+      <attribute name="id">edit-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext10</attribute>
+      <attribute name="id">edit-section-1</attribute>
+    </section>
+    <section>
+      <attribute name="id">view-section</attribute>
+      <item>
+        <attribute name="label" translatable="yes">Side _Panel</attribute>
+        <attribute name="action">win.side-panel</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Bottom Panel</attribute>
+        <attribute name="action">win.bottom-panel</attribute>
+        <attribute name="hidden-when">action-disabled</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">_Fullscreen</attribute>
+        <attribute name="action">win.fullscreen</attribute>
+      </item>
+    </section>
+    <section>
+      <attribute name="id">view-section-1</attribute>
+    </section>
+    <section>
+      <attribute name="id">view-section-2</attribute>
       <item>
         <attribute name="label" translatable="yes">_Highlight Mode…</attribute>
         <attribute name="action">win.highlight-mode</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">ext11</attribute>
+      <attribute name="id">spell-section</attribute>
+    </section>
+    <section>
+      <attribute name="id">tools-section</attribute>
     </section>
     <section>
-      <attribute name="id">ext12</attribute>
+      <attribute name="id">tools-section-1</attribute>
     </section>
     <section>
-      <attribute name="id">appmenuext2</attribute>
+      <attribute name="id">preferences-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Preferences</attribute>
         <attribute name="action">app.preferences</attribute>
       </item>
     </section>
     <section>
-      <attribute name="id">appmenuext3</attribute>
+      <attribute name="id">help-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Help</attribute>
         <attribute name="action">app.help</attribute>
@@ -235,7 +235,7 @@
       </item>
     </section>
     <section>
-      <attribute name="id">ext13</attribute>
+      <attribute name="id">close-section</attribute>
       <item>
         <attribute name="label" translatable="yes">_Close All</attribute>
         <attribute name="action">win.close-all</attribute>
diff --git a/plugins/docinfo/gedit-docinfo-plugin.c b/plugins/docinfo/gedit-docinfo-plugin.c
index 6b75d65..25e6117 100644
--- a/plugins/docinfo/gedit-docinfo-plugin.c
+++ b/plugins/docinfo/gedit-docinfo-plugin.c
@@ -537,8 +537,7 @@ gedit_docinfo_plugin_app_activate (GeditAppActivatable *activatable)
 
        priv = GEDIT_DOCINFO_PLUGIN (activatable)->priv;
 
-       priv->menu_ext = gedit_app_activatable_extend_menu (activatable,
-                                                           "ext9");
+       priv->menu_ext = gedit_app_activatable_extend_menu (activatable, "tools-section");
        item = g_menu_item_new (_("_Document Statistics"), "win.docinfo");
        gedit_menu_extension_append_menu_item (priv->menu_ext, item);
        g_object_unref (item);
diff --git a/plugins/externaltools/tools/appactivatable.py b/plugins/externaltools/tools/appactivatable.py
index 20aa739..0e931e7 100644
--- a/plugins/externaltools/tools/appactivatable.py
+++ b/plugins/externaltools/tools/appactivatable.py
@@ -78,11 +78,11 @@ class AppActivatable(GObject.Object, Gedit.AppActivatable):
         self._library = ToolLibrary()
         self._library.set_locations(os.path.join(self.plugin_info.get_data_dir(), 'tools'))
 
-        self.menu_ext = self.extend_menu("appmenuext2")
+        self.menu_ext = self.extend_menu("preferences-section")
         item = Gio.MenuItem.new(_("Manage _External Tools..."), "win.manage-tools")
         self.menu_ext.append_menu_item(item)
 
-        self.submenu_ext = self.extend_menu("ext9")
+        self.submenu_ext = self.extend_menu("tools-section-1")
         external_tools_submenu = Gio.Menu()
         item = Gio.MenuItem.new_submenu(_("External _Tools"), external_tools_submenu)
         self.submenu_ext.append_menu_item(item)
diff --git a/plugins/quickopen/quickopen/__init__.py b/plugins/quickopen/quickopen/__init__.py
index 8026028..317b48e 100644
--- a/plugins/quickopen/quickopen/__init__.py
+++ b/plugins/quickopen/quickopen/__init__.py
@@ -30,7 +30,7 @@ class QuickOpenAppActivatable(GObject.Object, Gedit.AppActivatable):
     def do_activate(self):
         self.app.add_accelerator("<Primary><Alt>O", "win.quickopen", None)
 
-        self.menu_ext = self.extend_menu("ext2")
+        self.menu_ext = self.extend_menu("file-section")
         item = Gio.MenuItem.new(_("Quick Open..."), "win.quickopen")
         self.menu_ext.prepend_menu_item(item)
 
diff --git a/plugins/snippets/snippets/appactivatable.py b/plugins/snippets/snippets/appactivatable.py
index 71d80fc..04525bb 100644
--- a/plugins/snippets/snippets/appactivatable.py
+++ b/plugins/snippets/snippets/appactivatable.py
@@ -50,7 +50,7 @@ class AppActivatable(GObject.Object, Gedit.AppActivatable):
                 self.app.add_action(action)
 
                 item = Gio.MenuItem.new(_("Manage _Snippets..."), "app.snippets")
-                self.menu = self.extend_menu("appmenuext2")
+                self.menu = self.extend_menu("preferences-section")
                 self.menu.append_menu_item(item)
 
         def do_deactivate(self):
diff --git a/plugins/sort/gedit-sort-plugin.c b/plugins/sort/gedit-sort-plugin.c
index 6f8a6ba..6e3264a 100644
--- a/plugins/sort/gedit-sort-plugin.c
+++ b/plugins/sort/gedit-sort-plugin.c
@@ -428,8 +428,7 @@ gedit_sort_plugin_app_activate (GeditAppActivatable *activatable)
 
        priv = GEDIT_SORT_PLUGIN (activatable)->priv;
 
-       priv->menu_ext = gedit_app_activatable_extend_menu (activatable,
-                                                           "ext9");
+       priv->menu_ext = gedit_app_activatable_extend_menu (activatable, "tools-section");
        item = g_menu_item_new (_("S_ort..."), "win.sort");
        gedit_menu_extension_append_menu_item (priv->menu_ext, item);
        g_object_unref (item);
diff --git a/plugins/spell/gedit-spell-app-activatable.c b/plugins/spell/gedit-spell-app-activatable.c
index 3b9bf2a..388b12b 100644
--- a/plugins/spell/gedit-spell-app-activatable.c
+++ b/plugins/spell/gedit-spell-app-activatable.c
@@ -130,8 +130,7 @@ gedit_spell_app_activatable_activate (GeditAppActivatable *activatable)
        GMenuItem *item;
 
        gtk_application_add_accelerator (GTK_APPLICATION (priv->app), "<Shift>F7", "win.check_spell", NULL);
-       priv->menu_ext = gedit_app_activatable_extend_menu (activatable,
-                                                           "ext5");
+       priv->menu_ext = gedit_app_activatable_extend_menu (activatable, "spell-section");
 
        item = g_menu_item_new (_("_Check Spelling..."), "win.check_spell");
        gedit_menu_extension_append_menu_item (priv->menu_ext, item);
diff --git a/plugins/time/gedit-time-plugin.c b/plugins/time/gedit-time-plugin.c
index a0559ca..1dd036e 100644
--- a/plugins/time/gedit-time-plugin.c
+++ b/plugins/time/gedit-time-plugin.c
@@ -269,8 +269,7 @@ gedit_time_plugin_app_activate (GeditAppActivatable *activatable)
 
        priv = GEDIT_TIME_PLUGIN (activatable)->priv;
 
-       priv->menu_ext = gedit_app_activatable_extend_menu (activatable,
-                                                           "ext5");
+       priv->menu_ext = gedit_app_activatable_extend_menu (activatable, "tools-section");
        item = g_menu_item_new (_("In_sert Date and Time..."), "win.time");
        gedit_menu_extension_append_menu_item (priv->menu_ext, item);
        g_object_unref (item);


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