Merged in default (pull request #429)

Sat, 24 Nov 2018 08:48:37 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Sat, 24 Nov 2018 08:48:37 +0000
changeset 39322
0d0d1ab4eba6
parent 39320
c412d5619fe2 (current diff)
parent 39321
e4ba787be39c (diff)
child 39323
a1bec7e58cba
child 39324
cf7fb0fb510a
child 39326
459e31e859c7
child 39328
4a49d2904542
child 39330
650003822919
child 39332
1e991df183c2
child 39340
153f202dbf04
child 39358
67d2df968e67

Merged in default (pull request #429)

libpidgin: Handle command line URIs using GApplication

Approved-by: Gary Kramlich

--- a/pidgin/libpidgin.c	Sat Nov 24 08:30:47 2018 +0000
+++ b/pidgin/libpidgin.c	Sat Nov 24 08:48:37 2018 +0000
@@ -369,6 +369,26 @@
 	purple_blist_set_visible(TRUE);
 }
 
+static gint
+pidgin_command_line_cb(GApplication *application,
+		GApplicationCommandLine *cmdline, gpointer user_data)
+{
+	gchar **argv;
+	int argc;
+	int i;
+
+	argv = g_application_command_line_get_arguments(cmdline, &argc);
+
+	/* Start at 1 to skip the executable name */
+	for (i = 1; i < argc; ++i) {
+		purple_got_protocol_handler_uri(argv[i]);
+	}
+
+	g_strfreev(argv);
+
+	return 0;
+}
+
 static gchar *opt_config_dir_arg = NULL;
 static gboolean opt_nologin = FALSE;
 static gboolean opt_login = FALSE;
@@ -703,11 +723,9 @@
 
 	app = G_APPLICATION(gtk_application_new("im.pidgin.Pidgin",
 #if GLIB_CHECK_VERSION(2, 48, 0)
-				G_APPLICATION_CAN_OVERRIDE_APP_ID
-#else
-				G_APPLICATION_FLAGS_NONE
+				G_APPLICATION_CAN_OVERRIDE_APP_ID |
 #endif
-				));
+				G_APPLICATION_HANDLES_COMMAND_LINE));
 
 	summary = g_strdup_printf("%s %s", PIDGIN_NAME, DISPLAY_VERSION);
 	g_application_set_option_context_summary(app, summary);
@@ -727,6 +745,8 @@
 			G_CALLBACK(pidgin_startup_cb), NULL);
 	g_signal_connect(app, "activate",
 			G_CALLBACK(pidgin_activate_cb), NULL);
+	g_signal_connect(app, "command-line",
+			G_CALLBACK(pidgin_command_line_cb), NULL);
 
 	ret = g_application_run(app, argc, argv);
 

mercurial