Timer: Send a notification when falling back to the manual schedule
This commit is contained in:
@@ -22,6 +22,9 @@ main = [
|
|||||||
enums = [
|
enums = [
|
||||||
'enums/Time.js',
|
'enums/Time.js',
|
||||||
]
|
]
|
||||||
|
icons = [
|
||||||
|
'data/icons/nightthemeswitcher-symbolic.svg',
|
||||||
|
]
|
||||||
modules = [
|
modules = [
|
||||||
'modules/Switcher.js',
|
'modules/Switcher.js',
|
||||||
'modules/SwitcherCommands.js',
|
'modules/SwitcherCommands.js',
|
||||||
@@ -43,6 +46,7 @@ preferences = [
|
|||||||
|
|
||||||
install_data(main, install_dir: INSTALL_DIR)
|
install_data(main, install_dir: INSTALL_DIR)
|
||||||
install_data(enums, install_dir: INSTALL_DIR / 'enums')
|
install_data(enums, install_dir: INSTALL_DIR / 'enums')
|
||||||
|
install_data(icons, install_dir: INSTALL_DIR / 'icons')
|
||||||
install_data(modules, install_dir: INSTALL_DIR / 'modules')
|
install_data(modules, install_dir: INSTALL_DIR / 'modules')
|
||||||
install_data(preferences, install_dir: INSTALL_DIR / 'preferences')
|
install_data(preferences, install_dir: INSTALL_DIR / 'preferences')
|
||||||
|
|
||||||
|
|||||||
+27
-2
@@ -4,10 +4,12 @@
|
|||||||
const { Geoclue, Gio, GLib, GObject, Meta, Shell } = imports.gi;
|
const { Geoclue, Gio, GLib, GObject, Meta, Shell } = imports.gi;
|
||||||
const { extensionUtils } = imports.misc;
|
const { extensionUtils } = imports.misc;
|
||||||
|
|
||||||
const { main } = imports.ui;
|
const { main, messageTray } = imports.ui;
|
||||||
|
|
||||||
const Me = extensionUtils.getCurrentExtension();
|
const Me = extensionUtils.getCurrentExtension();
|
||||||
|
|
||||||
|
const _ = extensionUtils.gettext;
|
||||||
|
|
||||||
const debug = Me.imports.debug;
|
const debug = Me.imports.debug;
|
||||||
|
|
||||||
const { Time } = Me.imports.enums.Time;
|
const { Time } = Me.imports.enums.Time;
|
||||||
@@ -244,7 +246,7 @@ var Timer = class extends GObject.Object {
|
|||||||
this.#changeTime(time, true);
|
this.#changeTime(time, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#onGeoclueReady(_, result) {
|
#onGeoclueReady(_geoclue, result) {
|
||||||
try {
|
try {
|
||||||
this.#geoclue = Geoclue.Simple.new_finish(result);
|
this.#geoclue = Geoclue.Simple.new_finish(result);
|
||||||
this.#geoclueLocationConnectionId = this.#geoclue.connect('notify::location', this.#onLocationChanged.bind(this));
|
this.#geoclueLocationConnectionId = this.#geoclue.connect('notify::location', this.#onLocationChanged.bind(this));
|
||||||
@@ -257,6 +259,29 @@ var Timer = class extends GObject.Object {
|
|||||||
this.#updateSuntimes();
|
this.#updateSuntimes();
|
||||||
} else {
|
} else {
|
||||||
console.error(`[${Me.metadata.name}] Unable to retrieve the location, using the manual schedule times instead.\n${e}`);
|
console.error(`[${Me.metadata.name}] Unable to retrieve the location, using the manual schedule times instead.\n${e}`);
|
||||||
|
|
||||||
|
const source = new messageTray.Source(Me.metadata.name, 'dialog-information-symbolic');
|
||||||
|
main.messageTray.add(source);
|
||||||
|
|
||||||
|
const notification = new messageTray.Notification(
|
||||||
|
source,
|
||||||
|
_('Unknown Location'),
|
||||||
|
_('A manual schedule will be used to switch the dark mode.'),
|
||||||
|
{
|
||||||
|
gicon: Gio.icon_new_for_string(GLib.build_filenamev([Me.path, 'icons', 'nightthemeswitcher-symbolic.svg'])),
|
||||||
|
}
|
||||||
|
);
|
||||||
|
notification.addAction(_('Edit Manual Schedule'), () => extensionUtils.openPrefs());
|
||||||
|
|
||||||
|
const locationSettingsApp = Shell.AppSystem.get_default().lookup_app('gnome-location-panel.desktop');
|
||||||
|
if (locationSettingsApp)
|
||||||
|
notification.addAction(_('Open Location Settings'), () => locationSettingsApp.activate());
|
||||||
|
|
||||||
|
notification.connect('activated', () => extensionUtils.openPrefs());
|
||||||
|
|
||||||
|
source.showNotification(notification);
|
||||||
|
|
||||||
|
this.#settings.set_boolean('manual-schedule', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,11 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: nightthemeswitcher@romainvigier.fr\n"
|
"Project-Id-Version: nightthemeswitcher@romainvigier.fr\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2022-08-17 14:13+0200\n"
|
<<<<<<< HEAD
|
||||||
|
"POT-Creation-Date: 2022-10-30 14:28+0100\n"
|
||||||
|
=======
|
||||||
|
"POT-Creation-Date: 2022-10-30 14:03+0100\n"
|
||||||
|
>>>>>>> d754bee (Timer: Send a notification when falling back to the manual schedule)
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@@ -21,7 +25,7 @@ msgstr ""
|
|||||||
msgid "Change background"
|
msgid "Change background"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/data/ui/BackgroundButton.ui:31
|
#: src/data/ui/BackgroundButton.ui:24
|
||||||
msgid "Select your background image"
|
msgid "Select your background image"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@ msgstr ""
|
|||||||
msgid "notify-send \"Hello sunshine!\""
|
msgid "notify-send \"Hello sunshine!\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/data/ui/CommandsPage.ui:35 src/data/ui/SchedulePage.ui:39
|
#: src/data/ui/CommandsPage.ui:35 src/data/ui/SchedulePage.ui:40
|
||||||
msgid "Sunset"
|
msgid "Sunset"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@ msgstr ""
|
|||||||
msgid "Manual schedule"
|
msgid "Manual schedule"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/data/ui/SchedulePage.ui:55
|
#: src/data/ui/SchedulePage.ui:57
|
||||||
msgid "Keyboard shortcut"
|
msgid "Keyboard shortcut"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -167,7 +171,23 @@ msgstr ""
|
|||||||
msgid ":"
|
msgid ":"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/preferences/BackgroundButton.js:69
|
#: src/modules/Timer.js:268
|
||||||
|
msgid "Unknown Location"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/modules/Timer.js:269
|
||||||
|
msgid "A manual schedule will be used to switch the dark mode."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/modules/Timer.js:274
|
||||||
|
msgid "Edit Manual Schedule"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/modules/Timer.js:278
|
||||||
|
msgid "Open Location Settings"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/preferences/BackgroundButton.js:86
|
||||||
msgid "This image format is not supported."
|
msgid "This image format is not supported."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user