Remove fullscreen notification option
Unfortunatly gnome-3.35.9x has dropped ClutterTexture, so this needs to be completely rewritten, lets just remove it for now. Note patches re-introducing this are welcome. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 14 KiB |
113
src/extension.js
@ -28,109 +28,6 @@ const N_ = function (e) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TeaTimeFullscreenNotification {
|
|
||||||
constructor() {
|
|
||||||
// this spans the whole monitor and contains
|
|
||||||
// the actual layout, which it displays in
|
|
||||||
// the center of itself
|
|
||||||
|
|
||||||
this._bin = new St.Bin({
|
|
||||||
x_align: St.Align.MIDDLE,
|
|
||||||
y_align: St.Align.MIDDLE
|
|
||||||
});
|
|
||||||
|
|
||||||
if (typeof Layout.MonitorConstraint != 'undefined') {
|
|
||||||
// MonitorConstraint was introduced in gnome-3.6
|
|
||||||
this._monitorConstraint = new Layout.MonitorConstraint();
|
|
||||||
this._bin.add_constraint(this._monitorConstraint);
|
|
||||||
}
|
|
||||||
Main.uiGroup.add_actor(this._bin);
|
|
||||||
|
|
||||||
// a table imitating a vertical box layout to hold the texture and
|
|
||||||
// a label underneath it
|
|
||||||
this._layout = new St.BoxLayout({
|
|
||||||
vertical: true,
|
|
||||||
y_align: Clutter.ActorAlign.CENTER
|
|
||||||
});
|
|
||||||
this._bin.set_child(this._layout);
|
|
||||||
|
|
||||||
// find all the textures
|
|
||||||
let datadir = Me.dir.get_child("data");
|
|
||||||
this._textureFiles = [];
|
|
||||||
if (datadir.query_exists(null)) {
|
|
||||||
let enumerator = datadir.enumerate_children(Gio.FILE_ATTRIBUTE_STANDARD_NAME,
|
|
||||||
Gio.FileQueryInfoFlags.NONE,
|
|
||||||
null);
|
|
||||||
let info;
|
|
||||||
info = enumerator.next_file(null);
|
|
||||||
while (info != null) {
|
|
||||||
let filename = info.get_name();
|
|
||||||
if (filename.match(/^cup.*/)) {
|
|
||||||
this._textureFiles.push(datadir.get_child(filename).get_path());
|
|
||||||
}
|
|
||||||
info = enumerator.next_file(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this._textureFiles.sort();
|
|
||||||
|
|
||||||
this._texture = new Clutter.Texture({
|
|
||||||
reactive: true,
|
|
||||||
keep_aspect_ratio: true
|
|
||||||
});
|
|
||||||
this._texture.connect("button-release-event", this.hide.bind(this));
|
|
||||||
this._layout.add_child(this._texture);
|
|
||||||
|
|
||||||
this._timeline = new Clutter.Timeline({
|
|
||||||
duration: 2000,
|
|
||||||
repeat_count: -1,
|
|
||||||
progress_mode: Clutter.AnimationMode.LINEAR
|
|
||||||
});
|
|
||||||
this._timeline.connect("new-frame", this._newFrame.bind(this));
|
|
||||||
|
|
||||||
this._label = new St.Label({
|
|
||||||
text: _("Your tea is ready!"),
|
|
||||||
style_class: "dash-label"
|
|
||||||
});
|
|
||||||
this._layout.add_child(this._label);
|
|
||||||
|
|
||||||
this._lightbox = new imports.ui.lightbox.Lightbox(Main.uiGroup); // Seems not to work on Gnome 3.10 { fadeInTime: 0.5, fadeOutTime: 0.5 }
|
|
||||||
this._lightbox.highlight(this._bin);
|
|
||||||
}
|
|
||||||
destroy() {
|
|
||||||
this.hide();
|
|
||||||
Main.popModal(this._bin);
|
|
||||||
this._bin.destroy();
|
|
||||||
this._lightbox.hide();
|
|
||||||
}
|
|
||||||
_newFrame(timeline, msecs, user) {
|
|
||||||
let progress = timeline.get_progress();
|
|
||||||
let idx = Math.round(progress * this._textureFiles.length) % this._textureFiles.length;
|
|
||||||
this._texture.set_from_file(this._textureFiles[idx]);
|
|
||||||
}
|
|
||||||
show() {
|
|
||||||
if (typeof Layout.MonitorConstraint != 'undefined') {
|
|
||||||
// global.display was introduced in gnome-shell 3.30
|
|
||||||
if (typeof global.screen != 'undefined') {
|
|
||||||
this._monitorConstraint.index = global.screen.get_current_monitor();
|
|
||||||
} else {
|
|
||||||
this._monitorConstraint.index = global.display.get_current_monitor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Main.pushModal(this._bin);
|
|
||||||
this._timeline.start();
|
|
||||||
this._lightbox.show();
|
|
||||||
this._bin.show_all();
|
|
||||||
}
|
|
||||||
hide() {
|
|
||||||
Main.popModal(this._bin);
|
|
||||||
this._bin.hide();
|
|
||||||
this._lightbox.hide();
|
|
||||||
this._timeline.stop();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
let PopupTeaMenuItem = GObject.registerClass(
|
let PopupTeaMenuItem = GObject.registerClass(
|
||||||
class PopupTeaMenuItem extends PopupMenu.PopupBaseMenuItem {
|
class PopupTeaMenuItem extends PopupMenu.PopupBaseMenuItem {
|
||||||
_init(sTeaname, nBrewtime, params) {
|
_init(sTeaname, nBrewtime, params) {
|
||||||
@ -383,14 +280,8 @@ class TeaTime extends PanelMenu.Button {
|
|||||||
// count down finished, switch display again
|
// count down finished, switch display again
|
||||||
this._stopCountdown();
|
this._stopCountdown();
|
||||||
this._playSound();
|
this._playSound();
|
||||||
|
this._showNotification(_("Your tea is ready!"),
|
||||||
if (!Utils.isGnome34() && this._settings.get_boolean(this.config_keys.fullscreen_notification)) {
|
_("Drink it, while it is hot!"));
|
||||||
this.dialog = new TeaTimeFullscreenNotification();
|
|
||||||
this.dialog.show();
|
|
||||||
} else {
|
|
||||||
this._showNotification(_("Your tea is ready!"),
|
|
||||||
_("Drink it, while it is hot!"));
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
this._updateTimerDisplay(remainingTime);
|
this._updateTimerDisplay(remainingTime);
|
||||||
|
28
src/prefs.js
@ -57,11 +57,6 @@ class TeaTimePrefsWidget extends Gtk.Grid {
|
|||||||
|
|
||||||
_initWindow() {
|
_initWindow() {
|
||||||
let curRow = 0;
|
let curRow = 0;
|
||||||
let labelFN = new Gtk.Label({
|
|
||||||
label: _("Fullscreen Notifications"),
|
|
||||||
hexpand: true,
|
|
||||||
halign: Gtk.Align.START
|
|
||||||
});
|
|
||||||
let labelGC = new Gtk.Label({
|
let labelGC = new Gtk.Label({
|
||||||
label: _("Graphical Countdown"),
|
label: _("Graphical Countdown"),
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@ -74,9 +69,6 @@ class TeaTimePrefsWidget extends Gtk.Grid {
|
|||||||
halign: Gtk.Align.START
|
halign: Gtk.Align.START
|
||||||
});
|
});
|
||||||
|
|
||||||
this.fullscreenNotificationSwitch = new Gtk.Switch();
|
|
||||||
this.fullscreenNotificationSwitch.connect("notify::active", this._saveFullscreenNotifications.bind(this));
|
|
||||||
|
|
||||||
this.graphicalCountdownSwitch = new Gtk.Switch();
|
this.graphicalCountdownSwitch = new Gtk.Switch();
|
||||||
this.graphicalCountdownSwitch.connect("notify::active", this._saveGraphicalCountdown.bind(this));
|
this.graphicalCountdownSwitch.connect("notify::active", this._saveGraphicalCountdown.bind(this));
|
||||||
|
|
||||||
@ -94,14 +86,6 @@ class TeaTimePrefsWidget extends Gtk.Grid {
|
|||||||
this.alarmSoundFileFilter.add_mime_type("audio/*");
|
this.alarmSoundFileFilter.add_mime_type("audio/*");
|
||||||
this.alarmSoundFile.connect("selection_changed", this._saveSoundFile.bind(this));
|
this.alarmSoundFile.connect("selection_changed", this._saveSoundFile.bind(this));
|
||||||
|
|
||||||
|
|
||||||
if (!Utils.isGnome34()) {
|
|
||||||
// Full screen notifications currently not working on GNOME 3.4, thus don't show the switch
|
|
||||||
this.attach(labelFN, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
|
|
||||||
this.attach(this.fullscreenNotificationSwitch, 2, curRow, 1, 1);
|
|
||||||
curRow += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.attach(labelGC, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
|
this.attach(labelGC, 0 /*col*/ , curRow /*row*/ , 2 /*col span*/ , 1 /*row span*/ );
|
||||||
this.attach(this.graphicalCountdownSwitch, 2, curRow, 1, 1);
|
this.attach(this.graphicalCountdownSwitch, 2, curRow, 1, 1);
|
||||||
curRow += 1;
|
curRow += 1;
|
||||||
@ -183,8 +167,6 @@ class TeaTimePrefsWidget extends Gtk.Grid {
|
|||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this.fullscreenNotificationSwitch.active = this._settings.get_boolean(this.config_keys.fullscreen_notification)
|
|
||||||
|
|
||||||
this.graphicalCountdownSwitch.active = this._settings.get_boolean(this.config_keys.graphical_countdown)
|
this.graphicalCountdownSwitch.active = this._settings.get_boolean(this.config_keys.graphical_countdown)
|
||||||
this.alarmSoundSwitch.active = this._settings.get_boolean(this.config_keys.use_alarm_sound)
|
this.alarmSoundSwitch.active = this._settings.get_boolean(this.config_keys.use_alarm_sound)
|
||||||
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
|
let list = this._settings.get_value(this.config_keys.steep_times).unpack();
|
||||||
@ -242,16 +224,6 @@ class TeaTimePrefsWidget extends Gtk.Grid {
|
|||||||
this.treeview.get_selection().unselect_all();
|
this.treeview.get_selection().unselect_all();
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveFullscreenNotifications(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.fullscreen_notification,
|
|
||||||
sw.active);
|
|
||||||
this._inhibitUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
_saveGraphicalCountdown(sw, data) {
|
_saveGraphicalCountdown(sw, data) {
|
||||||
// don't update the backend if someone else is messing with the model
|
// don't update the backend if someone else is messing with the model
|
||||||
if (this._inhibitUpdate)
|
if (this._inhibitUpdate)
|
||||||
|
@ -15,7 +15,6 @@ function debug(text) {
|
|||||||
function GetConfigKeys() {
|
function GetConfigKeys() {
|
||||||
return {
|
return {
|
||||||
steep_times: 'steep-times',
|
steep_times: 'steep-times',
|
||||||
fullscreen_notification: 'fullscreen-notification',
|
|
||||||
graphical_countdown: 'graphical-countdown',
|
graphical_countdown: 'graphical-countdown',
|
||||||
use_alarm_sound: 'use-alarm-sound',
|
use_alarm_sound: 'use-alarm-sound',
|
||||||
alarm_sound: 'alarm-sound-file'
|
alarm_sound: 'alarm-sound-file'
|
||||||
|