diff --git a/Changelog.md b/Changelog.md index 9a48bad..5e274d1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,9 @@ # Changelog +## 0.1.2 (2018-03-13) +* Fixed auto-closing gedit if there are no windows to restore (#1) +* Fixed (potentially) affecting the translations of other plugins + ## 0.1.1 (2017-10-13) * Added .pot file diff --git a/README.md b/README.md index 242e69b..de5b8e5 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Reopen closed windows and optionally restore windows between sessions -0.1.1 +0.1.2 All bug reports, feature requests and miscellaneous comments are welcome at the [project issue tracker][]. @@ -62,7 +62,7 @@ Inspired by: ## License -Copyright © 2017 Jeffery To +Copyright © 2017-2018 Jeffery To Available under GNU General Public License version 3 diff --git a/ex-mortis.plugin b/ex-mortis.plugin index 54105fc..1a30904 100644 --- a/ex-mortis.plugin +++ b/ex-mortis.plugin @@ -6,6 +6,6 @@ Name=Ex-Mortis Description=Reopen closed windows and optionally restore windows between sessions Icon=window-new Authors=Jeffery To -Copyright=Copyright © 2017 Jeffery To +Copyright=Copyright © 2017-2018 Jeffery To Website=https://github.com/jefferyto/gedit-ex-mortis -Version=0.1.1 +Version=0.1.2 diff --git a/ex-mortis/__init__.py b/ex-mortis/__init__.py index 3c8d478..27c5d64 100644 --- a/ex-mortis/__init__.py +++ b/ex-mortis/__init__.py @@ -3,7 +3,7 @@ # __init__.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify @@ -39,8 +39,7 @@ try: import gettext gettext.bindtextdomain('gedit-ex-mortis', LOCALE_PATH) - gettext.textdomain('gedit-ex-mortis') - _ = gettext.gettext + _ = lambda s: gettext.dgettext('gedit-ex-mortis', s) except: _ = lambda s: s @@ -434,6 +433,7 @@ class ExMortisConfigurable(GObject.Object, PeasGtk.Configurable): __gtype_name__ = 'ExMortisConfigurable' + def do_create_configure_widget(self): if log.query(log.INFO): Gedit.debug_plugin_message(log.format("")) @@ -452,14 +452,14 @@ def do_create_configure_widget(self): ) widget.set_active(settings.restore_between_sessions) + widget._settings = settings else: - widget = Gtk.Box() - widget.add(Gtk.Label.new(_("Could not load settings schema"))) - - widget.set_border_width(5) + widget = Gtk.Label.new(_("Could not load settings schema")) - widget._settings = settings + box = Gtk.Box.new(Gtk.Orientation.VERTICAL, 0) + box.set_border_width(5) + box.add(widget) - return widget + return box diff --git a/ex-mortis/closingmixin.py b/ex-mortis/closingmixin.py index bce6630..16b73f5 100644 --- a/ex-mortis/closingmixin.py +++ b/ex-mortis/closingmixin.py @@ -3,7 +3,7 @@ # closingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/existingmixin.py b/ex-mortis/existingmixin.py index c905399..dad5a71 100644 --- a/ex-mortis/existingmixin.py +++ b/ex-mortis/existingmixin.py @@ -3,7 +3,7 @@ # existingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify @@ -29,8 +29,7 @@ try: import gettext gettext.bindtextdomain('gedit-ex-mortis', LOCALE_PATH) - gettext.textdomain('gedit-ex-mortis') - _ = gettext.gettext + _ = lambda s: gettext.dgettext('gedit-ex-mortis', s) except: _ = lambda s: s diff --git a/ex-mortis/locale/gedit-ex-mortis.pot b/ex-mortis/locale/gedit-ex-mortis.pot index 6524c9b..83c1c69 100644 --- a/ex-mortis/locale/gedit-ex-mortis.pot +++ b/ex-mortis/locale/gedit-ex-mortis.pot @@ -1,7 +1,7 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: gedit-ex-mortis 0.1.1\n" +"Project-Id-Version: gedit-ex-mortis 0.1.2\n" "POT-Creation-Date: 2017-10-13 22:50+0800\n" "PO-Revision-Date: 2017-10-13 22:50+0800\n" "Last-Translator: Jeffery To \n" diff --git a/ex-mortis/log.py b/ex-mortis/log.py index 723cb9e..fd6959d 100644 --- a/ex-mortis/log.py +++ b/ex-mortis/log.py @@ -3,7 +3,7 @@ # log.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify @@ -97,14 +97,13 @@ def query(log_level): return highest(log_level) <= output_level -def prefix(log_level=None): +def name(log_level=None): if log_level is None: log_level = last_queried_level - name = LEVELS_TO_NAMES[highest(log_level)] if log_level is not None else 'unknown' - - return '[' + name + '] ' + return LEVELS_TO_NAMES[highest(log_level)] if log_level is not None else 'unknown' def format(message, *args): - return prefix() + (message % tuple(debug_str(arg) for arg in args)) + msg = message % tuple(debug_str(arg) for arg in args) + return "[%s] %s" % (name(), msg) diff --git a/ex-mortis/quittingmixin.py b/ex-mortis/quittingmixin.py index 2a9e7e0..4767810 100644 --- a/ex-mortis/quittingmixin.py +++ b/ex-mortis/quittingmixin.py @@ -3,7 +3,7 @@ # quittingmixin.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify @@ -339,7 +339,7 @@ def restore_windows(self, window_manager, settings, do_restore): settings.remove_window(window_id) - if do_restore: + if do_restore and states: if log.query(log.MESSAGE): Gedit.debug_plugin_message(log.format("restoring %s windows", len(states))) @@ -372,10 +372,14 @@ def restore_windows(self, window_manager, settings, do_restore): for window, state in zip(windows, states): self.setup_restore_window(window, state) - else: + elif not do_restore: if log.query(log.MESSAGE): Gedit.debug_plugin_message(log.format("not restoring windows")) + else: + if log.query(log.MESSAGE): + Gedit.debug_plugin_message(log.format("no windows to restore")) + def setup_restore_window(self, window, state=None): if log.query(log.INFO): Gedit.debug_plugin_message(log.format("%s", window)) diff --git a/ex-mortis/settings.py b/ex-mortis/settings.py index ba03193..6e7eb34 100644 --- a/ex-mortis/settings.py +++ b/ex-mortis/settings.py @@ -3,7 +3,7 @@ # settings.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/windowmanager.py b/ex-mortis/windowmanager.py index 6be0883..9cd161e 100644 --- a/ex-mortis/windowmanager.py +++ b/ex-mortis/windowmanager.py @@ -3,7 +3,7 @@ # windowmanager.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify diff --git a/ex-mortis/windowstate.py b/ex-mortis/windowstate.py index 6ce1fd6..b7da88a 100644 --- a/ex-mortis/windowstate.py +++ b/ex-mortis/windowstate.py @@ -3,7 +3,7 @@ # windowstate.py # This file is part of Ex-Mortis, a plugin for gedit # -# Copyright (C) 2017 Jeffery To +# Copyright (C) 2017-2018 Jeffery To # https://github.com/jefferyto/gedit-ex-mortis # # This program is free software: you can redistribute it and/or modify