diff --git a/src/extension.js b/src/extension.js index c2f41db..6040181 100644 --- a/src/extension.js +++ b/src/extension.js @@ -27,6 +27,8 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Utils = Me.imports.utils; +const bUseGnome34Workarounds = imports.misc.extensionUtils.versionCheck( ["3.4"], imports.misc.config.PACKAGE_VERSION); + Utils.initTranslations(); const _ = Gettext.gettext; @@ -148,10 +150,10 @@ const TeaTime = new Lang.Class({ this._settings = Utils.getSettings(); - this._logo = new St.Icon({ - icon_name : 'utilities-teatime', - style_class : 'system-status-icon' - }); + this._logo = new St.Icon({ icon_name: 'utilities-teatime', + icon_type: St.IconType.FULLCOLOR, + style_class : 'system-status-icon', + icon_size: 20 }); // set timer widget this._timer = new St.DrawingArea({ @@ -241,7 +243,21 @@ const TeaTime = new Lang.Class({ } }, _showNotification : function(subject, text) { - let source = new MessageTray.Source(_("TeaTime applet"), 'utilities-teatime'); + let source = ( bUseGnome34Workarounds ) + ? new MessageTray.Source(_("TeaTime applet")) + : new MessageTray.Source(_("TeaTime applet"), 'utilities-teatime'); + + if (bUseGnome34Workarounds) { source.createNotificationIcon = + function() { + let iconBox = new St.Bin(); + iconBox._size = this.ICON_SIZE; + iconBox.child = new St.Icon({ icon_name: 'utilities-teatime', + icon_type: St.IconType.FULLCOLOR, + icon_size: iconBox._size }); + return iconBox; + } // createNotificationIcon + } + Main.messageTray.add(source); let notification = new MessageTray.Notification(source, subject, text); @@ -275,7 +291,7 @@ const TeaTime = new Lang.Class({ // count down finished, switch display again this.actor.remove_actor(this._timer); this.actor.add_actor(this._logo); - if (this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY)) { + if ( !bUseGnome34Workarounds && this._settings.get_boolean(Utils.TEATIME_FULLSCREEN_NOTIFICATION_KEY)) { this.dialog = new TeaTimeFullscreenNotification(); this.dialog.show(); } else { diff --git a/src/prefs.js b/src/prefs.js index ee0bb89..0170e48 100644 --- a/src/prefs.js +++ b/src/prefs.js @@ -20,6 +20,8 @@ const ExtensionUtils = imports.misc.extensionUtils; const Me = ExtensionUtils.getCurrentExtension(); const Utils = Me.imports.utils; +const bUseGnome34Workarounds = imports.misc.extensionUtils.versionCheck( ["3.4"], imports.misc.config.PACKAGE_VERSION); + Utils.initTranslations(); const _ = Gettext.gettext; @@ -65,10 +67,14 @@ const TeaTimePrefsWidget = new Lang.Class({ let label = new Gtk.Label({ label: _("Fullscreen Notifications"), hexpand: true, halign: Gtk.Align.START }); - this.attach(label, 0 /*col*/, 0 /*row*/, 1 /*col span*/, 1 /*row span*/); this.fullscreenNotificationSwitch = new Gtk.Switch(); this.fullscreenNotificationSwitch.connect("notify::active", Lang.bind(this, this._saveFullscreenNotifications)); - this.attach(this.fullscreenNotificationSwitch, 1, 0, 1, 1); + + 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.treeview = new Gtk.TreeView({model: this._tealist, expand: true}); this.treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE);