[pitivi] console: Use action for menu button
- From: Alexandru Băluț <alexbalut src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] console: Use action for menu button
- Date: Tue, 9 Apr 2019 05:32:39 +0000 (UTC)
commit 9f90d77c4e81efc11034d958b1fc62714941b506
Author: Diego Garcia Gangl <dnicolas gmail com>
Date: Fri Apr 5 21:07:23 2019 -0300
console: Use action for menu button
plugins/console/console.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/plugins/console/console.py b/plugins/console/console.py
index bc9dac25..8b3c2864 100644
--- a/plugins/console/console.py
+++ b/plugins/console/console.py
@@ -21,6 +21,7 @@ import sys
from gettext import gettext as _
from gi.repository import Gdk
+from gi.repository import Gio
from gi.repository import GObject
from gi.repository import Gtk
from gi.repository import Pango
@@ -157,6 +158,10 @@ class Console(GObject.GObject, Peas.Activatable):
description=None,
section="console")
+ open_action = Gio.SimpleAction.new("open_console", None)
+ open_action.connect("activate", self.__menu_item_activate_cb)
+ self.app.add_action(open_action)
+
self._setup_dialog()
self.add_menu_item()
self.menu_item.show()
@@ -175,11 +180,13 @@ class Console(GObject.GObject, Peas.Activatable):
menu = self.app.gui.editor.builder.get_object("menu_box")
self.menu_item = Gtk.ModelButton.new()
self.menu_item.props.text = _("Developer Console")
- self.menu_item.connect("activate", self.__menu_item_activate_cb)
+ self.menu_item.set_action_name("app.open_console")
+
menu.add(self.menu_item)
def remove_menu_item(self):
"""Removes a menu item from the Pitivi menu."""
+ self.app.remove_action("open_console")
menu = self.app.gui.editor.builder.get_object("menu_box")
menu.remove(self.menu_item)
self.menu_item = None
@@ -246,7 +253,7 @@ class Console(GObject.GObject, Peas.Activatable):
if self.terminal:
self.terminal.set_font(settings.consoleFont)
- def __menu_item_activate_cb(self, unused_data):
+ def __menu_item_activate_cb(self, unused_data, unused_param):
self.window.show_all()
self.window.set_keep_above(True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]