phosh-arch/gnome-clocks-mobile/0010-add-option-to-start-hidden.patch
2024-08-13 08:17:11 -07:00

64 lines
2 KiB
Diff

From d09089c22fa81abac887006e1942674bcad736a9 Mon Sep 17 00:00:00 2001
From: Julian Sparber <julian@sparber.net>
Date: Thu, 3 Dec 2020 22:54:42 +0100
Subject: [PATCH 10/16] add option to start hidden
---
src/application.vala | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/application.vala b/src/application.vala
index 92aba34..4bc24c6 100644
--- a/src/application.vala
+++ b/src/application.vala
@@ -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 },
{ (string) null }
};
@@ -36,6 +37,7 @@ public class Application : Gtk.Application {
private World.ShellWorldClocks world_clocks;
private uint world_clocks_id = 0;
private Window? window;
+ private bool start_hidden = false;
private List<string> system_notifications;
private Window ensure_window () ensures (window != null) {
@@ -96,7 +98,11 @@ public class Application : Gtk.Application {
base.activate ();
var win = ensure_window ();
- win.present ();
+ if (!start_hidden) {
+ win.present ();
+ } else {
+ start_hidden = false;
+ }
win.focus_in_event.connect (() => {
withdraw_notifications ();
@@ -142,6 +148,9 @@ public class Application : Gtk.Application {
print ("%s %s\n", (string) Environment.get_application_name (), Config.VERSION);
return 0;
}
+ if (options.contains("hidden")) {
+ start_hidden = true;
+ }
return -1;
}
@@ -155,6 +164,7 @@ public class Application : Gtk.Application {
win.show_world ();
win.present ();
+
var world = GWeather.Location.get_world ();
if (world != null) {
// The result is actually nullable
--
2.34.1