remember running Timer (#55)

Merge branch master from zeners/gnomeshell-teatime:

* remember running timer
* po/update_strings
* show remaining time in Stop Timer menu item, if graphical style is in use
This commit is contained in:
zeners 2021-09-12 20:14:29 +02:00 committed by GitHub
parent 5d15efdc4d
commit 3697b6c6ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 359 additions and 131 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 21:58+0200\n"
"POT-Creation-Date: 2021-08-24 18:26+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,47 +17,56 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr ""
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr ""
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr ""
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr ""
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr ""
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr ""
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr ""
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr ""
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr ""
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr ""
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr ""
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr ""
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr ""
@ -108,3 +117,20 @@ msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:27
msgid "Play a sound file after drawing is completed."
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: TeaTime 7\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 22:00+0200\n"
"POT-Creation-Date: 2021-08-24 18:22+0200\n"
"PO-Revision-Date: 2016-10-04 22:00+0200\n"
"Last-Translator: Olaf Leidinger <oleid@mescharet.de>\n"
"Language-Team: German\n"
@ -19,47 +19,56 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.8.9\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr "Dein Tee ist fertig!"
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr "Einstellungen"
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr "min:sec"
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr "TeaTime applet"
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr "%s verbleiben"
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr "Dein Tee ist fertig!"
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr "Trink ihn, solange er noch heiß ist!"
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr "Vollbild-Benachrichtigungen"
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr "Grafisches Herunterzählen"
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr "Benachrichtigungsklang"
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr "Einen Benachrichtigungklang wählen."
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr "Tee"
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr "Ziehzeit"
@ -114,8 +123,29 @@ msgstr "Nach Abschluss des Ziehens eine Klangdatei abspielen"
msgid "Play a sound file after drawing is completed."
msgstr "Eine Klangdatei abspielen, wenn das Ziehen abgeschlossen ist."
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr "aktuelle laufende Ziehzeit"
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
"Startzeitpunkt und Ziehzeit in Sekunden zum Wiederherstellen bei einem "
"Plugin-Restart "
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr "aktuelle Ziehzeit über Plugin-Reset hinaus behalten"
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""
"Ziehzeiten über eine Bilschirmsperre oder Plugin/System-Neustart hinaus "
"behalten"
#~ msgid "Fullscreen Notifications"
#~ msgstr "Vollbild-Benachrichtigungen"
#~ msgid "Timer set!"
#~ msgstr "Die Zeit läuft!"
#~ msgid "%ss to go"
#~ msgstr "%ss verbleiben"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 21:58+0200\n"
"POT-Creation-Date: 2021-08-24 18:26+0200\n"
"PO-Revision-Date: 2013-11-05 14:22+0100\n"
"Last-Translator: Solveig <teatime@solveig.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,47 +16,56 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr "Su té está listo!"
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr "Preferencias"
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr "min:sec"
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr "Applicación TeaTime"
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr "para ir %s"
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr "Su té está listo!"
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr "Beba mientras está caliente!"
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr "Notificaciones en pantalla completa"
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr "Cuenta atrás gráfica"
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr ""
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr ""
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr "Té"
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr "Tiempo de infusión"
@ -111,8 +120,25 @@ msgstr ""
msgid "Play a sound file after drawing is completed."
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""
#~ msgid "Fullscreen Notifications"
#~ msgstr "Notificaciones en pantalla completa"
#~ msgid "Timer set!"
#~ msgstr "Definir el tiempo!"
#~ msgid "%ss to go"
#~ msgstr "para ir %ss"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 22:06+0200\n"
"POT-Creation-Date: 2021-08-24 18:26+0200\n"
"PO-Revision-Date: 2013-11-05 14:22+0100\n"
"Last-Translator: Solveig <teatime@solveig.org>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -16,47 +16,56 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr "Votre thé est prêt !"
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr "Préférences"
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr "min:sec"
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr "Application TeaTime"
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr "encore %s"
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr "Votre thé est prêt !"
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr "Buvez tant que c'est chaud !"
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr "Notifications en plein écran"
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr ""
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr ""
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr ""
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr "Thé"
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr "Temps d'infusion"
@ -111,8 +120,25 @@ msgstr ""
msgid "Play a sound file after drawing is completed."
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""
#~ msgid "Fullscreen Notifications"
#~ msgstr "Notifications en plein écran"
#~ msgid "Timer set!"
#~ msgstr "Minuteur réglé !"
#~ msgid "%ss to go"
#~ msgstr "encore %ss"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 22:06+0200\n"
"POT-Creation-Date: 2021-08-24 18:26+0200\n"
"PO-Revision-Date: 2016-01-19 20:52-0200\n"
"Last-Translator: Fábio B. Tramasoli <fabio@tramasoli.com>\n"
"Language-Team: \n"
@ -18,47 +18,56 @@ msgstr ""
"X-Generator: Poedit 1.8.6\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr "Seu chá está pronto!"
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr "Exibir configurações"
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr "min:s"
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr "applet TeaTime"
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr "%s para acabar"
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr "Seu chá está pronto!"
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr "Beba enquanto está quente!"
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr "Notificações em tela-cheia"
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr "Contagem regressiva gráfica"
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr ""
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr ""
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr "Chá"
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr "Tempo de infusão"
@ -114,8 +123,25 @@ msgstr ""
msgid "Play a sound file after drawing is completed."
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""
#~ msgid "Fullscreen Notifications"
#~ msgstr "Notificações em tela-cheia"
#~ msgid "Timer set!"
#~ msgstr "Timer configurado!"
#~ msgid "%ss to go"
#~ msgstr "%ss para acabar"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-10-04 22:06+0200\n"
"POT-Creation-Date: 2021-08-24 18:26+0200\n"
"PO-Revision-Date: 2016-10-04 21:48+0800\n"
"Last-Translator: 绿色圣光 <lishaohui.qd@163.com>\n"
"Language-Team: Chinese (Simplified) <>\n"
@ -18,47 +18,56 @@ msgstr ""
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Gtranslator 2.91.7\n"
#: ../src/extension.js:86 ../src/extension.js:327
msgid "Your tea is ready!"
msgstr "您的茶已经准备好了!"
#: ../src/extension.js:179
#: ../src/extension.js:96
msgid "Show settings"
msgstr "显示设置"
#: ../src/extension.js:188
#: ../src/extension.js:106
msgid "min:sec"
msgstr "分:秒"
#: ../src/extension.js:260 ../src/extension.js:261
#: ../src/extension.js:142 ../src/extension.js:258 ../src/extension.js:269
msgid "Stop Timer"
msgstr ""
#: ../src/extension.js:208
msgid "TeaTime applet"
msgstr "泡茶时间小程序"
#: ../src/extension.js:328
#: ../src/extension.js:269
#, javascript-format
msgid "%s to go"
msgstr ""
#: ../src/extension.js:282
msgid "Your tea is ready!"
msgstr "您的茶已经准备好了!"
#: ../src/extension.js:283
msgid "Drink it, while it is hot!"
msgstr "趁热喝吧!"
#: ../src/prefs.js:69
msgid "Fullscreen Notifications"
msgstr "全屏通知"
#: ../src/prefs.js:72
#: ../src/prefs.js:68
msgid "Graphical Countdown"
msgstr "图形化倒计时"
#: ../src/prefs.js:76
#: ../src/prefs.js:74
msgid "Alarm sound"
msgstr "提示音"
#: ../src/prefs.js:92
#: ../src/prefs.js:80
msgid "Remember running Timer"
msgstr ""
#: ../src/prefs.js:100 ../src/prefs.js:180
msgid "Select alarm sound file"
msgstr "选择提示声音文件"
#: ../src/prefs.js:121
#: ../src/prefs.js:126
msgid "Tea"
msgstr "茶"
#: ../src/prefs.js:136
#: ../src/prefs.js:146
msgid "Steep time"
msgstr "浸泡时间"
@ -111,3 +120,23 @@ msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:27
msgid "Play a sound file after drawing is completed."
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:31
msgid "Currently running timer"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:32
msgid ""
"Start-time and total duration in seconds to restore after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:36
msgid "remember running timer after plugin shutdown"
msgstr ""
#: ../src/schemas/org.gnome.shell.extensions.teatime.gschema.xml:37
msgid "remember startet timer after screen-lock or reboot"
msgstr ""
#~ msgid "Fullscreen Notifications"
#~ msgstr "全屏通知"

View File

@ -77,6 +77,7 @@ let TeaTime = GObject.registerClass(
this._idleTimeout = null;
this._createMenu();
this._continueRunningTimer();
}
_createMenu() {
@ -119,13 +120,27 @@ let TeaTime = GObject.registerClass(
this._updateTeaList();
}
_continueRunningTimer() {
let running = this._settings.get_string(this.config_keys.running_timer).split("#");
if (running.length == 2) {
try {
this._initCountdown(new Date(running[0]), parseInt(running[1]));
this.graphicalCounter = 0; // redraw with correct values
} catch (e) {
// remove unreadable timer
this._settings.set_string(this.config_keys.running_timer, '');
}
}
}
_updateTeaList(config, output) {
// make sure the menu is empty
this.teaItemCont.removeAll();
// fill with new teas
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
let menuItem = new PopupTeaMenuItem("Stop Timer", 0);
let menuItem = new PopupTeaMenuItem(_("Stop Timer"), 0);
this.stopMenu = menuItem.tealabel
menuItem.connect('activate', function () {
this._stopCountdown();
}.bind(this));
@ -135,7 +150,8 @@ let TeaTime = GObject.registerClass(
let menuItem = new PopupTeaMenuItem(_(teaname), time);
menuItem.connect('activate', function () {
this._initCountdown(time);
this._initCountdown(new Date(), time);
}.bind(this));
this.teaItemCont.addMenuItem(menuItem);
}
@ -181,7 +197,7 @@ let TeaTime = GObject.registerClass(
seconds = parseInt(s);
}
if (seconds > 0) {
this._initCountdown(seconds);
this._initCountdown(new Date(), seconds);
this.menu.close();
}
}
@ -202,18 +218,18 @@ let TeaTime = GObject.registerClass(
}
}
_initCountdown(time) {
this._startTime = new Date();
_initCountdown(startTime, time) {
this._startTime = startTime;
this._stopTime = new Date();
this._cntdownStart = time;
this._bGraphicalCountdown = this._settings.get_boolean(this.config_keys.graphical_countdown);
let dt = this._bGraphicalCountdown ?
this.graphicalInterval = this._bGraphicalCountdown ?
Math.max(1.0, time / 90) // set time step to fit animation
:
1.0; // show every second for the textual countdown
this.graphicalCounter = 0;
this._stopTime.setTime(this._startTime.getTime() + time * 1000); // in msec
this.remove_actor(this._logo); // show timer instead of default icon
@ -224,7 +240,12 @@ let TeaTime = GObject.registerClass(
this._graphicalTimer : this._textualTimer);
if (this._idleTimeout != null) Mainloop.source_remove(this._idleTimeout);
this._idleTimeout = Mainloop.timeout_add_seconds(dt, this._doCountdown.bind(this));
this._idleTimeout = Mainloop.timeout_add_seconds(1, this._doCountdown.bind(this));
if (this._settings.get_boolean(this.config_keys.remember_running_timer)) {
// remember timer
this._settings.set_string(this.config_keys.running_timer, this._startTime.toJSON() + '#' + time);
}
}
_stopCountdown() {
@ -233,6 +254,9 @@ let TeaTime = GObject.registerClass(
this._graphicalTimer : this._textualTimer);
this.add_actor(this._logo);
this._idleTimeout = null;
// always remove remembered timer
this._settings.set_string(this.config_keys.running_timer, '');
this.stopMenu.text = _("Stop Timer");
}
_getRemainingSec() {
@ -242,9 +266,14 @@ let TeaTime = GObject.registerClass(
_updateTimerDisplay(remainingTime) {
if (this._bGraphicalCountdown) {
this._graphicalTimer.setStatus((this._cntdownStart - remainingTime) / this._cntdownStart);
if (this.graphicalCounter-- <= 0) {
this.graphicalCounter = this.graphicalInterval;
this._graphicalTimer.setStatus((this._cntdownStart - remainingTime) / this._cntdownStart);
}
this.stopMenu.text = _("Stop Timer") + ': ' + _('%s to go').replace('%s', Utils.formatTime(remainingTime));
} else {
this._textualTimer.text = Utils.formatTime(remainingTime);
this.stopMenu.text = _("Stop Timer");
}
}

View File

@ -1,2 +1,2 @@
{"shell-version": ["3.32", "3.34", "3.36"], "uuid": "TeaTime@oleid.mescharet.de", "name": "TeaTime", "settings-schema": "org.gnome.shell.extensions.teatime", "gettext-domain": "TeaTime",
{"shell-version": ["3.32", "3.34", "3.36", "40"], "uuid": "TeaTime@oleid.mescharet.de", "name": "TeaTime", "settings-schema": "org.gnome.shell.extensions.teatime", "gettext-domain": "TeaTime",
"description": "A tea steeping timer\nCurrently in passive maintainance.\nGit repository: https://github.com/oleid/gnome-shell-teatime"}

View File

@ -76,6 +76,12 @@ var TeaTimePrefsWidget = GObject.registerClass(
halign: Gtk.Align.START
});
let labelRT = new Gtk.Label({
label: _("Remember running Timer"),
hexpand: true,
halign: Gtk.Align.START
});
this.graphicalCountdownSwitch = new Gtk.Switch();
this.graphicalCountdownSwitch.connect("notify::active", this._saveGraphicalCountdown.bind(this));
@ -83,6 +89,9 @@ var TeaTimePrefsWidget = GObject.registerClass(
this.alarmSoundSwitch = new Gtk.Switch();
this.alarmSoundSwitch.connect("notify::active", this._saveUseAlarm.bind(this));
this.rememberRunningCounterSwitch = new Gtk.Switch();
this.rememberRunningCounterSwitch.connect("notify::active", this._saveRememberRunningCounter.bind(this));
this.alarmSoundFileFilter = new Gtk.FileFilter();
this.alarmSoundFileFilter.add_mime_type("audio/*");
@ -101,6 +110,10 @@ var TeaTimePrefsWidget = GObject.registerClass(
this.attach(this.alarmSoundSwitch, 3, curRow + 1, 2, 1);
curRow += 2;
this.attach(labelRT, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
this.attach(this.rememberRunningCounterSwitch, 3, curRow, 2, 1);
curRow += 1;
this.treeview = new Gtk.TreeView({
model: this._tealist
});
@ -184,6 +197,7 @@ var TeaTimePrefsWidget = GObject.registerClass(
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
this.alarmSoundFileFile = this._settings.get_string(this.config_keys.alarm_sound);
this.alarmSoundFileButton.label = Gio.File.new_for_uri(this.alarmSoundFileFile).get_basename();
this.rememberRunningCounterSwitch.active = this._settings.get_boolean(this.config_keys.remember_running_timer);
// stop everyone from reacting to the changes we are about to produce
// in the model
@ -256,6 +270,16 @@ var TeaTimePrefsWidget = GObject.registerClass(
this._inhibitUpdate = false;
}
_saveRememberRunningCounter(sw, data) {
// don't update the backend if someone else is messing with the model
if (this._inhibitUpdate)
return;
this._inhibitUpdate = true;
this._settings.set_boolean(this.config_keys.remember_running_timer,
sw.active);
this._inhibitUpdate = false;
}
_saveSoundFile(sw, response_id, data) {
// don't update the backend if someone else is messing with the model or not accept new file
if (this._inhibitUpdate || response_id != Gtk.ResponseType.ACCEPT)

View File

@ -26,6 +26,16 @@
<summary>Play sound when drawing completed</summary>
<description>Play a sound file after drawing is completed.</description>
</key>
<key name="running-timer" type="s">
<default>"-"</default>
<summary>Currently running timer</summary>
<description>Start-time and total duration in seconds to restore after plugin shutdown</description>
</key>
<key name="remember-running-timer" type="b">
<default>true</default>
<summary>remember running timer after plugin shutdown</summary>
<description>remember startet timer after screen-lock or reboot</description>
</key>
</schema>
</schemalist>

View File

@ -17,7 +17,9 @@ function GetConfigKeys() {
steep_times: 'steep-times',
graphical_countdown: 'graphical-countdown',
use_alarm_sound: 'use-alarm-sound',
alarm_sound: 'alarm-sound-file'
alarm_sound: 'alarm-sound-file',
running_timer: 'running-timer',
remember_running_timer: 'remember-running-timer'
};
}