diff options
-rw-r--r-- | portato/gui/templates/MainWindow.ui | 16 | ||||
-rw-r--r-- | portato/gui/windows/main.py | 24 |
2 files changed, 28 insertions, 12 deletions
diff --git a/portato/gui/templates/MainWindow.ui b/portato/gui/templates/MainWindow.ui index 3a30907..98da2ad 100644 --- a/portato/gui/templates/MainWindow.ui +++ b/portato/gui/templates/MainWindow.ui @@ -3,6 +3,16 @@ <interface> <object class="GtkUIManager" id="uimanager"> <child> + <object class="GtkActionGroup" id="pluginActionGroup"> + <child> + <object class="GtkAction" id="pluginMenuAction"> + <property name="name">pluginMenuAction</property> + <property name="label" translatable="yes">Plu_gins</property> + </object> + </child> + </object> + </child> + <child> <object class="GtkActionGroup" id="generalActionGroup"> <child> <object class="GtkAction" id="fileMenuAction"> @@ -125,12 +135,6 @@ </object> </child> <child> - <object class="GtkAction" id="pluginMenuAction"> - <property name="name">pluginMenuAction</property> - <property name="label" translatable="yes">Plu_gins</property> - </object> - </child> - <child> <object class="GtkAction" id="helpMenuAction"> <property name="name">helpMenuAction</property> <property name="label" translatable="yes">_?</property> diff --git a/portato/gui/windows/main.py b/portato/gui/windows/main.py index 437d305..2ee4447 100644 --- a/portato/gui/windows/main.py +++ b/portato/gui/windows/main.py @@ -479,13 +479,25 @@ class MainWindow (Window): plugin.load_plugins() menus = [p.menus for p in plugin.get_plugin_queue().get_plugins()] - # if menus: - # pluginMenu = self.tree.get_ui("pluginMenu") + if menus: + uim = self.tree.get_widget("uimanager") + ag = self.tree.get_widget("pluginActionGroup") - # for m in itt.chain(*menus): - # item = gtk.MenuItem(m.label) - # item.connect("activate", m.call) - # pluginMenu.append(item) + ctr = 0 + for m in itt.chain(*menus): + + # create action + aname = "plugin%d" % ctr + a = gtk.Action(aname, m.label, None, None) + a.connect("activate", m.call) + ag.add_action(a) + + # add to UI + mid = uim.new_merge_id() + uim.add_ui(mid, "ui/menubar/pluginMenu", aname, aname, gtk.UI_MANAGER_MENUITEM, False) + + ctr += 1 + splash(_("Building frontend")) # set paned position |