Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
jefferyto committed Mar 21, 2019
2 parents 858baf4 + 01813ba commit 7eb3753
Show file tree
Hide file tree
Showing 14 changed files with 184 additions and 87 deletions.
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## 0.2.0 (2019-03-22)
* Restore windows on startup, and save windows for restoring, only for
the primary instance, i.e. when gedit is not in standalone mode
* When restoring windows on startup, reuse the new window/tab (#4)
* Fixed adding "Reopen Closed Window" menu item on platforms with no app
menu or menu bar (#5)
* Added Russian translation (#6, thanks Habetdin!)

## 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
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Reopen closed windows and optionally restore windows between sessions
<https://github.com/jefferyto/gedit-ex-mortis>
0.1.2
0.2.0

All bug reports, feature requests and miscellaneous comments are welcome
at the [project issue tracker][].
Expand Down Expand Up @@ -52,7 +52,10 @@ i.e. only unsaved or blank documents, will not be reopenable.
open in the previous session will be reopened when gedit is started
again. (Default: Disabled)

## Development
## Contributing

Please base changes on, and open pull requests against, the `develop`
branch.

The code in `ex-mortis/utils` comes from [python-gtk-utils][]; changes
should ideally be contributed to that project, then pulled back into
Expand All @@ -66,7 +69,7 @@ Inspired by:

## License

Copyright &copy; 2017-2018 Jeffery To <[email protected]>
Copyright &copy; 2017-2019 Jeffery To <[email protected]>

Available under GNU General Public License version 3

Expand Down
5 changes: 3 additions & 2 deletions ex-mortis.plugin
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ Module=ex-mortis
IAge=3
Name=Ex-Mortis
Description=Reopen closed windows and optionally restore windows between sessions
Description[ru]=Переоткрывает закрытые окна и восстанавливает окна между сессиями
Icon=window-new
Authors=Jeffery To <[email protected]>
Copyright=Copyright © 2017-2018 Jeffery To
Copyright=Copyright © 2017-2019 Jeffery To
Website=https://github.com/jefferyto/gedit-ex-mortis
Version=0.1.2
Version=0.2.0
16 changes: 12 additions & 4 deletions ex-mortis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# __init__.py
# This file is part of Ex-Mortis, a plugin for gedit
#
# Copyright (C) 2017-2018 Jeffery To <[email protected]>
# Copyright (C) 2017-2019 Jeffery To <[email protected]>
# https://github.com/jefferyto/gedit-ex-mortis
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -61,8 +61,9 @@ def do_activate(self):
Gedit.debug_plugin_message(log.format(""))

app = self.app
is_primary = not (app.get_flags() & Gio.ApplicationFlags.NON_UNIQUE)
window_manager = ExMortisWindowManager()
settings = ExMortisSettings()
settings = ExMortisSettings(is_primary)

# app
connect_handlers(
Expand Down Expand Up @@ -102,6 +103,8 @@ def do_activate(self):
'app.reopen-closed-window', ['<Primary><Shift>N']
)
menu_ext = self.extend_menu('app-commands-section')
if not menu_ext:
menu_ext = self.extend_menu('file-section')
menu_item = Gio.MenuItem.new(
_("Reopen Closed _Window"), 'app.reopen-closed-window'
)
Expand Down Expand Up @@ -133,7 +136,7 @@ def do_activate(self):
# windows
windows = app.get_main_windows()

self.restore_windows(
self.handle_restore_data(
window_manager, settings,
settings.restore_between_sessions and not windows
)
Expand Down Expand Up @@ -220,7 +223,7 @@ def setup_window(self, window, is_existing=False):

window_manager.track_window(window)

self.setup_restore_window(window)
self.setup_restore_window(window_manager, window)

if self.is_saving_window_states():
self.bind_window_settings(window_manager, settings, window)
Expand Down Expand Up @@ -438,13 +441,18 @@ def do_create_configure_widget(self):
if log.query(log.INFO):
Gedit.debug_plugin_message(log.format(""))

app = Gedit.App.get_default()
is_primary = not (app.get_flags() & Gio.ApplicationFlags.NON_UNIQUE)
settings = ExMortisSettings()

if settings.can_save:
widget = Gtk.CheckButton.new_with_label(
_("Restore windows between sessions")
)

if not is_primary:
widget.set_sensitive(False)

create_bindings(
self, settings, widget,
{'restore_between_sessions': 'active'},
Expand Down
2 changes: 1 addition & 1 deletion ex-mortis/closingmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# closingmixin.py
# This file is part of Ex-Mortis, a plugin for gedit
#
# Copyright (C) 2017-2018 Jeffery To <[email protected]>
# Copyright (C) 2017-2019 Jeffery To <[email protected]>
# https://github.com/jefferyto/gedit-ex-mortis
#
# This program is free software: you can redistribute it and/or modify
Expand Down
2 changes: 1 addition & 1 deletion ex-mortis/existingmixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# existingmixin.py
# This file is part of Ex-Mortis, a plugin for gedit
#
# Copyright (C) 2017-2018 Jeffery To <[email protected]>
# Copyright (C) 2017-2019 Jeffery To <[email protected]>
# https://github.com/jefferyto/gedit-ex-mortis
#
# This program is free software: you can redistribute it and/or modify
Expand Down
12 changes: 6 additions & 6 deletions ex-mortis/locale/gedit-ex-mortis.pot
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: gedit-ex-mortis 0.1.2\n"
"POT-Creation-Date: 2018-03-13 21:31+0800\n"
"Project-Id-Version: gedit-ex-mortis 0.2.0\n"
"POT-Creation-Date: 2019-03-22 04:12+0800\n"
"PO-Revision-Date: 2017-10-13 22:50+0800\n"
"Last-Translator: Jeffery To <[email protected]>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.4\n"
"X-Generator: Poedit 2.1.1\n"
"X-Poedit-KeywordsList: _;gettext;gettext_noop\n"
"X-Poedit-Basepath: ..\n"
"X-Poedit-SearchPath-0: .\n"
"X-Poedit-SearchPathExcluded-0: schemas\n"
"X-Poedit-SearchPathExcluded-1: utils\n"

#: __init__.py:106
#: __init__.py:109
msgid "Reopen Closed _Window"
msgstr ""

#: __init__.py:445 existingmixin.py:87
#: __init__.py:450 existingmixin.py:87
msgid "Restore windows between sessions"
msgstr ""

#: __init__.py:458
#: __init__.py:466
msgid "Could not load settings schema"
msgstr ""

Expand Down
Binary file not shown.
58 changes: 58 additions & 0 deletions ex-mortis/locale/ru/LC_MESSAGES/gedit-ex-mortis.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
msgid ""
msgstr ""
"Project-Id-Version: gedit-ex-mortis 0.2.0\n"
"POT-Creation-Date: 2019-03-22 04:12+0800\n"
"PO-Revision-Date: 2019-03-22 04:15+0800\n"
"Last-Translator: Habetdin\n"
"Language-Team: Russian\n"
"Language: ru\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.1.1\n"

#: __init__.py:109
msgid "Reopen Closed _Window"
msgstr "Пе_реоткрыть закрытое окно"

#: __init__.py:450 existingmixin.py:87
msgid "Restore windows between sessions"
msgstr "Восстанавливать окна между сессиями"

#: __init__.py:466
msgid "Could not load settings schema"
msgstr "Ошибка при загрузке схемы настроек"

#: existingmixin.py:67
msgid "_Quit"
msgstr "З_авершить"

#: existingmixin.py:68
msgid "_Ignore"
msgstr "И_гнорировать"

#: existingmixin.py:77
msgid ""
"This window cannot be reopened if closed. Restart gedit to fully enable Ex-"
"Mortis."
msgstr ""
"Это окно не может быть восстановлено после закрытия. Перезапустите gedit для "
"полноценной активации Ex-Mortis."

#: existingmixin.py:88
msgid "Application menu"
msgstr "меню приложения"

#: existingmixin.py:88
msgid "File menu"
msgstr "меню Файл"

#: existingmixin.py:89
#, python-brace-format
msgid ""
"To restore this window, enable \"{pref_name}\" in Ex-Mortis' preferences, "
"and quit gedit by selecting Quit in the {menu_name} or in this message."
msgstr ""
"Для восстановления данного окна включите в настройках Ex-Mortis "
"\"{pref_name}\" и выйдите из gedit, выбрав Завершить в {menu_name} или в "
"этом сообщении."
4 changes: 2 additions & 2 deletions ex-mortis/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# log.py
# This file is part of Ex-Mortis, a plugin for gedit
#
# Copyright (C) 2017-2018 Jeffery To <[email protected]>
# Copyright (C) 2017-2019 Jeffery To <[email protected]>
# https://github.com/jefferyto/gedit-ex-mortis
#
# This program is free software: you can redistribute it and/or modify
Expand Down Expand Up @@ -53,7 +53,7 @@
if name in NAMES_TO_LEVELS:
output_level = NAMES_TO_LEVELS[name]

# set by query(), used by prefix()
# set by query(), used by name()
last_queried_level = None


Expand Down
Loading

0 comments on commit 7eb3753

Please sign in to comment.