summaryrefslogtreecommitdiffstats
path: root/indicator-keylock-3.1.0-gtkapplication.patch
blob: c950daa23ce7317e7661fde69bc684f9ff08e127 (plain)
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
https://bazaar.launchpad.net/~tsbarnes/indicator-keylock/trunk/revision/113

=== modified file 'configure.ac'
--- a/configure.ac	2015-09-22 00:05:09 +0000
+++ b/configure.ac	2018-05-20 02:54:56 +0000
@@ -24,12 +24,11 @@
 PKG_CHECK_MODULES(glib, [glib-2.0 >= 2.24.0])
 PKG_CHECK_MODULES(gtk, [gtk+-3.0 >= 3.2.0])
 PKG_CHECK_MODULES(appindicator, [appindicator3-0.1 >= 0.4.1])
-PKG_CHECK_MODULES(unique, [unique-3.0 >= 3.0.0])
 PKG_CHECK_MODULES(libnotify, [libnotify >= 0.7.4])
 PKG_CHECK_MODULES(x11, [x11 >= 1.0])
 
-PACKAGE_CFLAGS="$glib_CFLAGS $gtk_CFLAGS $appindicator_CFLAGS $unique_CFLAGS $libnotify_CFLAGS $x11_CFLAGS"
-PACKAGE_LIBS="$glib_LIBS $gtk_LIBS $appindicator_LIBS $unique_LIBS $libnotify_LIBS $x11_LIBS"
+PACKAGE_CFLAGS="$glib_CFLAGS $gtk_CFLAGS $appindicator_CFLAGS $libnotify_CFLAGS $x11_CFLAGS"
+PACKAGE_LIBS="$glib_LIBS $gtk_LIBS $appindicator_LIBS $libnotify_LIBS $x11_LIBS"
 AC_SUBST(PACKAGE_CFLAGS)
 AC_SUBST(PACKAGE_LIBS)
 

=== modified file 'src/globals.h'
--- a/src/globals.h	2011-11-09 20:31:37 +0000
+++ b/src/globals.h	2018-05-20 02:54:56 +0000
@@ -6,13 +6,12 @@
 #include <glib/gi18n.h>
 #include <gio/gio.h>
 #include <gtk/gtk.h>
-#include <unique/unique.h>
 #include <libappindicator/app-indicator.h>
 #include <libnotify/notify.h>
 
 extern GRand *			self_random;
 
-extern UniqueApp *		self_unique_app;
+extern GtkApplication *		self_gtk_app;
 
 extern gboolean			self_has_notify;
 extern NotifyNotification *	self_notification;

=== modified file 'src/main.c'
--- a/src/main.c	2012-04-04 15:20:54 +0000
+++ b/src/main.c	2018-05-20 02:54:56 +0000
@@ -6,7 +6,7 @@
 
 GRand *			self_random 		= NULL;
 
-UniqueApp *		self_unique_app 	= NULL;
+GtkApplication *		self_gtk_app 	= NULL;
 gboolean		self_has_notify 	= FALSE;
 NotifyNotification *	self_notification 	= NULL;
 
@@ -173,18 +173,15 @@
 	gtk_main_quit();
 }
 
-UniqueResponse on_self_unique_app_message_received(UniqueApp *app, gint command, UniqueMessageData *message_data, guint time_, gpointer user_data) {
-	if(command == INDICATOR_KEYLOCK_OPEN_PREFS) {
-		show_pref_dialog();
-	}
-	return(UNIQUE_RESPONSE_OK);
+void on_self_gtk_app_activate_received(GtkApplication *app) {
+	show_pref_dialog();
 }
 
 int main(int argc, char *argv[]) {
 	gtk_init_with_args(&argc, &argv, _("Indicator/Status Icon for keyboard lock keys"), NULL, NULL, NULL);
 	self_random = g_rand_new();
-	self_unique_app = unique_app_new_with_commands("org.desktop.indicator-keylock", NULL, "open-prefs", INDICATOR_KEYLOCK_OPEN_PREFS, NULL);
-	g_signal_connect(self_unique_app, "message-received", G_CALLBACK(on_self_unique_app_message_received), NULL);
+	self_gtk_app = gtk_application_new("org.desktop.indicator-keylock", 0);
+	g_signal_connect(self_gtk_app, "activate", G_CALLBACK(on_self_gtk_app_activate_received), NULL);
 
 	if (!init_xkb_extension(G_CALLBACK(on_xkb_event))) {
 		GtkWidget *dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, _("Could not initialize X Keyboard Extension."));
@@ -204,11 +201,6 @@
 
 	init_pref_dialog();
 
-	if (unique_app_is_running(self_unique_app) == TRUE) {
-		UniqueResponse response = unique_app_send_message(self_unique_app, INDICATOR_KEYLOCK_OPEN_PREFS, NULL);
-		return(response);
-	}
-
 	self_menu_caps = gtk_image_menu_item_new_with_label(_("Caps Lock"));
 	self_menu_caps_image = gtk_image_new_from_icon_name("caps-lock-off", GTK_ICON_SIZE_MENU);
 	gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(self_menu_caps), self_menu_caps_image);