[gedit-latex] Move "New LaTeX document" back in the app menu
- From: Pietro Battiston <pbattiston src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit-latex] Move "New LaTeX document" back in the app menu
- Date: Sat, 30 Apr 2016 15:59:31 +0000 (UTC)
commit f4202b7abedb81811957c6a66df309cce0bd010c
Author: Pietro Battiston <pbattiston src gnome org>
Date: Sat Apr 30 17:56:33 2016 +0200
Move "New LaTeX document" back in the app menu
latex/appactivatable.py | 8 +++++++-
latex/windowactivatable.py | 7 +------
2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/latex/appactivatable.py b/latex/appactivatable.py
index f217684..e5528a6 100644
--- a/latex/appactivatable.py
+++ b/latex/appactivatable.py
@@ -60,6 +60,8 @@ class LaTeXAppActivatable(GObject.Object, Gedit.AppActivatable):
self.init_tools()
def add_latex_menu(self):
+ self.appmenu_ext = self.extend_menu("preferences-section")
+
self.menu_ext = self.extend_menu("tools-section-1")
menu = Gio.MenuItem.new(_("LaTeX"), "win.FileDummyAction")
container = Gio.Menu.new()
@@ -73,7 +75,10 @@ class LaTeXAppActivatable(GObject.Object, Gedit.AppActivatable):
action = clazz(icon_factory=self._icon_factory)
actionlink = "win." + clazz.__name__
item = Gio.MenuItem.new(_(action.label), actionlink)
- container.append_item(item)
+ if clazz.__name__ == 'LaTeXNewAction':
+ self.appmenu_ext.append_menu_item(item)
+ else:
+ container.append_item(item)
# FIXME: this is not working (it does work in init_tools() below):
item.set_attribute_value("hidden-when",
GLib.Variant.new_string("action-disabled"))
@@ -123,5 +128,6 @@ class LaTeXAppActivatable(GObject.Object, Gedit.AppActivatable):
def do_deactivate(self):
del self.latex_tools_menu
del self.menu_ext
+ del self.appmenu_ext
# ex:ts=4:et
diff --git a/latex/windowactivatable.py b/latex/windowactivatable.py
index 255f826..f373c2d 100644
--- a/latex/windowactivatable.py
+++ b/latex/windowactivatable.py
@@ -349,7 +349,7 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
if Gedit.utils_is_valid_location(gfile):
LOG.debug("GeditWindow.create_tab_from_uri(%s)" % uri)
self.window.create_tab_from_location(
- gfile, Gedit.encoding_get_current(),
+ gfile, Gedit.gedit_encoding_get_current(),
1, 1, False, True)
else:
LOG.error("Gedit.utils.uri_is_valid(%s) = False" % uri)
@@ -419,11 +419,6 @@ class LaTeXWindowActivatable(GObject.Object, Gedit.WindowActivatable, PeasGtk.Co
# "Duplicate child name in GtkStack: LaTeX Tools"
menu_action.set_enabled(bool(to_enable))
- # The "new LaTeX document" is the only one we always want enabled:
- # (and hence its menu):
- self.window.lookup_action('FileDummyAction').set_enabled(True)
- self.window.lookup_action('LaTeXNewAction').set_enabled(True)
-
if extension:
self.show_toolbar()
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]