diff --git a/po/TeaTime.pot b/po/TeaTime.pot index 0e47d37..b29592e 100644 --- a/po/TeaTime.pot +++ b/po/TeaTime.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-05 14:36+0100\n" +"POT-Creation-Date: 2014-02-18 23:13+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,44 +17,48 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/extension.js:85 ../src/extension.js:282 +#: ../src/extension.js:86 ../src/extension.js:340 msgid "Your tea is ready!" msgstr "" -#: ../src/extension.js:180 +#: ../src/extension.js:191 msgid "Show settings" msgstr "" -#: ../src/extension.js:189 +#: ../src/extension.js:200 msgid "min:sec" msgstr "" -#: ../src/extension.js:244 +#: ../src/extension.js:272 ../src/extension.js:273 msgid "TeaTime applet" msgstr "" -#: ../src/extension.js:263 +#: ../src/extension.js:313 msgid "Timer set!" msgstr "" -#: ../src/extension.js:263 +#: ../src/extension.js:313 #, javascript-format msgid "%ss to go" msgstr "" -#: ../src/extension.js:283 +#: ../src/extension.js:341 msgid "Drink it, while it is hot!" msgstr "" -#: ../src/prefs.js:65 +#: ../src/prefs.js:67 msgid "Fullscreen Notifications" msgstr "" -#: ../src/prefs.js:77 +#: ../src/prefs.js:70 +msgid "Graphical Countdown" +msgstr "" + +#: ../src/prefs.js:96 msgid "Tea" msgstr "" -#: ../src/prefs.js:92 +#: ../src/prefs.js:111 msgid "Steep time" msgstr "" diff --git a/po/de.po b/po/de.po index daa2a3a..befa167 100644 --- a/po/de.po +++ b/po/de.po @@ -8,8 +8,8 @@ msgid "" msgstr "" "Project-Id-Version: TeaTime 7\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-05 14:36+0100\n" -"PO-Revision-Date: 2013-10-31 09:38+0100\n" +"POT-Creation-Date: 2014-02-18 23:13+0100\n" +"PO-Revision-Date: 2014-02-18 23:25+0100\n" "Last-Translator: Olaf Leidinger \n" "Language-Team: German\n" "Language: de\n" @@ -17,46 +17,50 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" -"X-Generator: Poedit 1.5.7\n" +"X-Generator: Poedit 1.6.4\n" -#: ../src/extension.js:85 ../src/extension.js:282 +#: ../src/extension.js:86 ../src/extension.js:340 msgid "Your tea is ready!" msgstr "Dein Tee ist fertig!" -#: ../src/extension.js:180 +#: ../src/extension.js:191 msgid "Show settings" msgstr "Einstellungen" -#: ../src/extension.js:189 +#: ../src/extension.js:200 msgid "min:sec" msgstr "min:sec" -#: ../src/extension.js:244 +#: ../src/extension.js:272 ../src/extension.js:273 msgid "TeaTime applet" msgstr "TeaTime applet" -#: ../src/extension.js:263 +#: ../src/extension.js:313 msgid "Timer set!" msgstr "Die Zeit läuft!" -#: ../src/extension.js:263 +#: ../src/extension.js:313 #, javascript-format msgid "%ss to go" msgstr "%ss verbleiben" -#: ../src/extension.js:283 +#: ../src/extension.js:341 msgid "Drink it, while it is hot!" msgstr "Trink ihn, solange er noch heiß ist!" -#: ../src/prefs.js:65 +#: ../src/prefs.js:67 msgid "Fullscreen Notifications" msgstr "Vollbild-Benachrichtigungen" -#: ../src/prefs.js:77 +#: ../src/prefs.js:70 +msgid "Graphical Countdown" +msgstr "Grafisches Herunterzählen" + +#: ../src/prefs.js:96 msgid "Tea" msgstr "Tee" -#: ../src/prefs.js:92 +#: ../src/prefs.js:111 msgid "Steep time" msgstr "Ziehzeit" diff --git a/po/fr.po b/po/fr.po index 875669f..e3352c8 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-11-05 14:36+0100\n" +"POT-Creation-Date: 2014-02-18 23:13+0100\n" "PO-Revision-Date: 2013-11-05 14:22+0100\n" "Last-Translator: Solveig \n" "Language-Team: LANGUAGE \n" @@ -16,44 +16,48 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: ../src/extension.js:85 ../src/extension.js:282 +#: ../src/extension.js:86 ../src/extension.js:340 msgid "Your tea is ready!" msgstr "Votre thé est prêt !" -#: ../src/extension.js:180 +#: ../src/extension.js:191 msgid "Show settings" msgstr "Préférences" -#: ../src/extension.js:189 +#: ../src/extension.js:200 msgid "min:sec" msgstr "min:sec" -#: ../src/extension.js:244 +#: ../src/extension.js:272 ../src/extension.js:273 msgid "TeaTime applet" msgstr "Application TeaTime" -#: ../src/extension.js:263 +#: ../src/extension.js:313 msgid "Timer set!" msgstr "Minuteur réglé !" -#: ../src/extension.js:263 +#: ../src/extension.js:313 #, javascript-format msgid "%ss to go" msgstr "encore %ss" -#: ../src/extension.js:283 +#: ../src/extension.js:341 msgid "Drink it, while it is hot!" msgstr "Buvez tant que c'est chaud !" -#: ../src/prefs.js:65 +#: ../src/prefs.js:67 msgid "Fullscreen Notifications" msgstr "Notifications en plein écran" -#: ../src/prefs.js:77 +#: ../src/prefs.js:70 +msgid "Graphical Countdown" +msgstr "" + +#: ../src/prefs.js:96 msgid "Tea" msgstr "Thé" -#: ../src/prefs.js:92 +#: ../src/prefs.js:111 msgid "Steep time" msgstr "Temps d'infusion" diff --git a/src/extension.js b/src/extension.js index 13a3b8c..bcd7b87 100644 --- a/src/extension.js +++ b/src/extension.js @@ -162,12 +162,13 @@ const TeaTime = new Lang.Class({ icon_size: 20 }); } // set timer widget - this._timer = new St.DrawingArea({ + this._textualTimer = new St.Label({ text: "" }); + this._graphicalTimer = new St.DrawingArea({ reactive : true }); - this._timer.set_width(20); - this._timer.set_height(20); - this._timer.connect('repaint', Lang.bind(this, this._drawTimer)); + this._graphicalTimer.set_width(20); + this._graphicalTimer.set_height(20); + this._graphicalTimer.connect('repaint', Lang.bind(this, this._drawTimer)); this.actor.add_actor(this._logo); @@ -179,6 +180,8 @@ const TeaTime = new Lang.Class({ this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem()); this._settings.connect("changed::" + Utils.TEATIME_STEEP_TIMES_KEY, Lang.bind(this, this._updateTeaList)); + this._settings.connect("changed::" + Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY, + Lang.bind(this, this._updateCountdownType)); this.teaItemCont = new PopupMenu.PopupMenuSection(); @@ -226,6 +229,22 @@ const TeaTime = new Lang.Class({ this.teaItemCont.addMenuItem(menuItem); } }, + _updateCountdownType : function(config, output) { + let bWantGraphicalCountdown = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY); + + if ( bWantGraphicalCountdown != this._bGraphicalCountdown) { + if (this._idleTimeout != null) { + // we have a running countdown, replace the display + this.actor.remove_actor( this._bGraphicalCountdown + ? this._graphicalTimer : this._textualTimer); + this._bGraphicalCountdown = bWantGraphicalCountdown; + this.actor.add_actor( this._bGraphicalCountdown + ? this._graphicalTimer : this._textualTimer); + + this._updateTimerDisplay( this._getRemainingSec() ); + } // if timeout active + } // value changed + }, _createCustomTimer: function(text, event) { if (event.get_key_symbol() == Clutter.KEY_Enter || event.get_key_symbol() == Clutter.KEY_Return) { @@ -275,12 +294,21 @@ const TeaTime = new Lang.Class({ this._stopTime = new Date(); this._cntdownStart = time; this._progress = 0; - let dt = Math.max(0.1, time / 180); // change time step to fit animation + + this._bGraphicalCountdown = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY); + + let dt = this._bGraphicalCountdown + ? Math.max(0.1, time / 180) // set time step to fit animation + : 1.0; // show every second for the textual countdown this._stopTime.setTime(this._startTime.getTime() + time*1000); // in msec this.actor.remove_actor(this._logo); // show timer instead of default icon - this.actor.add_actor(this._timer); + + this._updateTimerDisplay(time); + + this.actor.add_actor( this._bGraphicalCountdown + ? this._graphicalTimer : this._textualTimer); this._showNotification(_("Timer set!"), _("%ss to go").format(time)); this._idleTimeout = Mainloop.timeout_add_seconds(dt, Lang.bind(this, this._doCountdown)); @@ -289,13 +317,21 @@ const TeaTime = new Lang.Class({ let a = new Date(); return (this._stopTime.getTime() - a.getTime()) * 1e-3; }, + _updateTimerDisplay: function(remainingTime) { + if ( this._bGraphicalCountdown ) { + this._progress = (this._cntdownStart - remainingTime) / this._cntdownStart; + this._graphicalTimer.queue_repaint(); + } else { + this._textualTimer.text = Utils.formatTime(remainingTime); + } + }, _doCountdown : function() { let remainingTime = this._getRemainingSec(); - this._progress = (this._cntdownStart - remainingTime) / this._cntdownStart; if (remainingTime <= 0) { // count down finished, switch display again - this.actor.remove_actor(this._timer); + this.actor.remove_actor( this._bGraphicalCountdown + ? this._graphicalTimer : this._textualTimer); this.actor.add_actor(this._logo); if ( !bUseGnome34Workarounds && this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY)) { this.dialog = new TeaTimeFullscreenNotification(); @@ -308,13 +344,13 @@ const TeaTime = new Lang.Class({ this._idleTimeout = null; return false; } else { - this._timer.queue_repaint(); + this._updateTimerDisplay(remainingTime); return true; // continue timer } }, _drawTimer : function() { - let[width, height] = this._timer.get_surface_size(); - let cr = this._timer.get_context(); + let[width, height] = this._graphicalTimer.get_surface_size(); + let cr = this._graphicalTimer.get_context(); let pi = Math.PI; let r = Math.min(width, height) * 0.5;; diff --git a/src/prefs.js b/src/prefs.js index 58928c5..a27648b 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -63,22 +63,36 @@ const TeaTimePrefsWidget = new Lang.Class({ this._tealist.connect("row-deleted", Lang.bind(this, this._save)); }, _initWindow: function() { - let label = new Gtk.Label({ label: _("Fullscreen Notifications"), - hexpand: true, - halign: Gtk.Align.START }); + let curRow = 0; + let labelFN = new Gtk.Label({ label: _("Fullscreen Notifications"), + hexpand: true, + halign: Gtk.Align.START }); + let labelGC = new Gtk.Label({ label: _("Graphical Countdown"), + hexpand: true, + halign: Gtk.Align.START }); + this.fullscreenNotificationSwitch = new Gtk.Switch(); this.fullscreenNotificationSwitch.connect("notify::active", Lang.bind(this, this._saveFullscreenNotifications)); + this.graphicalCountdownSwitch = new Gtk.Switch(); + this.graphicalCountdownSwitch.connect("notify::active", Lang.bind(this, this._saveGraphicalCountdown)); + if ( !bUseGnome34Workarounds) { // Full screen notifications currently not working on GNOME 3.4, thus don't show the switch - this.attach(label, 0 /*col*/, 0 /*row*/, 1 /*col span*/, 1 /*row span*/); - this.attach(this.fullscreenNotificationSwitch, 1, 0, 1, 1); + this.attach(labelFN, 0 /*col*/, curRow /*row*/, 1 /*col span*/, 1 /*row span*/); + this.attach(this.fullscreenNotificationSwitch, 1, curRow, 1, 1); + curRow += 1; } + + this.attach(labelGC, 0 /*col*/, curRow /*row*/, 1 /*col span*/, 1 /*row span*/); + this.attach(this.graphicalCountdownSwitch, 1, curRow, 1, 1); + curRow += 1; this.treeview = new Gtk.TreeView({model: this._tealist, expand: true}); this.treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE); - this.attach(this.treeview, 0, 1, 2, 1); - + this.attach(this.treeview, 0, curRow, 2, 1); + curRow += 1; + let teaname = new Gtk.TreeViewColumn({ title: _("Tea"), expand: true }); let renderer = new Gtk.CellRendererText({ editable: true }); // When the renderer is done editing it's value, we first write @@ -110,7 +124,7 @@ const TeaTimePrefsWidget = new Lang.Class({ this.toolbar = new Gtk.Toolbar({ icon_size: 1 }); this.toolbar.get_style_context().add_class("inline-toolbar"); - this.add(this.toolbar); + this.attach(this.toolbar, 0 /*col*/, curRow /*row*/, 2 /*col span*/, 1 /*row span*/); this.addButton = new Gtk.ToolButton({ icon_name: "list-add-symbolic", use_action_appearance: false }); this.addButton.connect("clicked", Lang.bind(this, this._addTea)); this.toolbar.insert(this.addButton, -1); @@ -125,6 +139,7 @@ const TeaTimePrefsWidget = new Lang.Class({ this.fullscreenNotificationSwitch.active = this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY) + this.graphicalCountdownSwitch.active = this._settings.get_boolean(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY) let list = this._settings.get_value(Utils.TEATIME_STEEP_TIMES_KEY).unpack(); // stop everyone from reacting to the changes we are about to produce @@ -178,6 +193,15 @@ const TeaTimePrefsWidget = new Lang.Class({ sw.active); this._inhibitUpdate = false; }, + _saveGraphicalCountdown: function(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(Utils.TEATIME_GRAPHICAL_COUNTDOWN_KEY, + sw.active); + this._inhibitUpdate = false; + }, _save: function(store, path_, iter_) { // don't update the backend if someone else is messing with the model if (this._inhibitUpdate) diff --git a/src/schemas/org.gnome.shell.extensions.teatime.gschema.xml.in.in b/src/schemas/org.gnome.shell.extensions.teatime.gschema.xml.in.in index 68fe73a..d94c190 100644 --- a/src/schemas/org.gnome.shell.extensions.teatime.gschema.xml.in.in +++ b/src/schemas/org.gnome.shell.extensions.teatime.gschema.xml.in.in @@ -11,6 +11,11 @@ Show fullscreen notifications. Displays a more disrupting, modal fullscreen notification when the timer has elapsed. + + true + Show an animated graphical countdown. + Displays a small, yet nice animation instead of an textual countdown. + diff --git a/src/utils.js b/src/utils.js index 9e79230..874cfb8 100644 --- a/src/utils.js +++ b/src/utils.js @@ -12,6 +12,7 @@ const Config = imports.misc.config; const TEATIME_STEEP_TIMES_KEY = 'steep-times'; const TEATIME_FULLSCREEN_NOTIFICATION_KEY = 'fullscreen-notification'; +const TEATIME_GRAPHICAL_COUNTDOWN_KEY = 'graphical-countdown'; function initTranslations(domain) { let extension = ExtensionUtils.getCurrentExtension();