Skip to content
Snippets Groups Projects
Commit 44d65837 authored by Julian Sparber's avatar Julian Sparber
Browse files

Merge branch 'autostart' into 'librem5-3-32'

Autostart

See merge request Librem5/gnome-clocks!4
parents 97f5c6f0 dd4613af
No related tags found
1 merge request!4Autostart
Pipeline #61623 passed
......@@ -37,6 +37,15 @@ custom_target('desktop-file',
]
)
desktop_daemon_file = i18n.merge_file(
input : 'org.gnome.clocks-daemon.desktop.in',
output : '@0@-daemon.desktop'.format(app_id),
type : 'desktop',
po_dir : '../po',
install : true,
install_dir : join_paths(get_option('sysconfdir'), 'xdg/autostart')
)
dbusconf = configuration_data()
dbusconf.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))
dbusconf.set('name', app_id)
......@@ -81,4 +90,4 @@ configure_file(
configuration: gsettingsconf,
install: true,
install_dir: join_paths(get_option('datadir'), 'glib-2.0', 'schemas'),
)
\ No newline at end of file
)
[Desktop Entry]
Name=Clocks
GenericName=Clocks
X-GNOME-FullName=GNOME Clocks
Comment=Clocks for world times, plus alarms, stopwatch and a timer
# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
Keywords=time;timer;alarm;world clock;stopwatch;time zone;
Exec=gnome-clocks --hidden
# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
Icon=@icon@
Terminal=false
Type=Application
Categories=GNOME;GTK;Utility;Clock;
StartupNotify=false
NoDisplay=true
X-GNOME-AutoRestart=true
......@@ -21,6 +21,7 @@ namespace Clocks {
public class Application : Gtk.Application {
const OptionEntry[] option_entries = {
{ "version", 'v', 0, OptionArg.NONE, null, N_("Print version information and exit"), null },
{ "hidden", 0, 0, OptionArg.NONE, null, N_("Start without showing a window"), null },
{ null }
};
......@@ -34,11 +35,13 @@ public class Application : Gtk.Application {
private SearchProvider search_provider;
private uint search_provider_id = 0;
private Window window;
private bool start_hidden = false;
private List<string> system_notifications;
private void ensure_window () {
if (window == null) {
window = new Window (this);
window.visible = false;
window.delete_event.connect(() => {
return window.hide_on_delete();
});
......@@ -84,7 +87,10 @@ public class Application : Gtk.Application {
base.activate ();
ensure_window ();
window.present ();
if (!start_hidden)
window.present ();
else
start_hidden = false;
window.focus_in_event.connect (() => {
withdraw_notifications ();
......@@ -127,6 +133,9 @@ public class Application : Gtk.Application {
print ("%s %s\n", Environment.get_application_name (), Config.VERSION);
return 0;
}
if (options.contains("hidden")) {
start_hidden = true;
}
return -1;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment