Package: connman-gtk / 1.1.1+git20180626.b72c6ab-4

fix-launch-to-tray Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
Description: Launch to system tray without display app window
Author: YOSHIOKA Takuma
Origin: upstream
Bug: https://github.com/jgke/connman-gtk/pull/39
Last-Update: 2022-02-11
---
--- a/src/main.c
+++ b/src/main.c
@@ -600,9 +600,11 @@
 {
 	g_bus_get(G_BUS_TYPE_SYSTEM, NULL, dbus_connected, NULL);
 
-	config_load(app);
 	if(no_icon)
 		status_icon_enabled = FALSE;
+	else if(launch_to_tray)
+		status_icon_enabled = TRUE;
+		no_icon = FALSE;
 
 	main_window = gtk_application_window_new(app);
 	g_signal_connect(app, "window-removed",
@@ -614,13 +616,9 @@
 	create_content();
 
 	g_signal_connect(G_OBJECT(main_window), "key_press_event", G_CALLBACK(handle_keyboard_shortcut), NULL);
-	gtk_widget_show_all(main_window);
 
 #ifdef USE_STATUS_ICON
 	if(status_icon_enabled && !no_icon) {
-		if(launch_to_tray)
-			gtk_widget_hide(main_window);
-
 		g_signal_connect(main_window, "delete-event",
 				 G_CALLBACK(gtk_widget_hide_on_delete),
 				 main_window);
@@ -632,8 +630,15 @@
 static void activate(GtkApplication *app, gpointer user_data)
 {
 #ifdef USE_STATUS_ICON
-	if(!launch_to_tray)
-		gtk_widget_show(main_window);
+	static gboolean window_has_shown = FALSE;
+	if(!launch_to_tray || !status_icon_enabled || no_icon) {
+		if(window_has_shown)
+			gtk_widget_show(main_window);
+		else
+			gtk_widget_show_all(main_window);
+
+		window_has_shown = TRUE;
+	}
 	launch_to_tray = FALSE;
 #endif
 }
@@ -687,6 +692,7 @@
 					 (GDestroyNotify)remove_service_struct);
 
 	app = gtk_application_new(NULL, G_APPLICATION_FLAGS_NONE);
+	config_load(app);
 	g_application_add_main_option_entries(G_APPLICATION(app), options);
 	g_signal_connect(app, "startup", G_CALLBACK(startup), NULL);
 	g_signal_connect(app, "activate", G_CALLBACK(activate), NULL);
--- a/data/net.connman.gtk.gschema.xml
+++ b/data/net.connman.gtk.gschema.xml
@@ -4,7 +4,7 @@
 			<default>true</default>
 		</key>
 		<key name="launch-to-tray" type="b">
-			<default>false</default>
+			<default>true</default>
 		</key>
 		<key name="openconnect-use-fsid-by-default" type="b">
 			<default>false</default>