pidgin/libpidgin.c

changeset 39257
96f40c182cf1
parent 39256
0245b49e1231
child 39321
e4ba787be39c
--- a/pidgin/libpidgin.c	Tue Oct 02 18:36:39 2018 -0500
+++ b/pidgin/libpidgin.c	Tue Oct 02 18:38:22 2018 -0500
@@ -341,12 +341,25 @@
 pidgin_handle_local_options_cb(GApplication *app, GVariantDict *options,
 		gpointer user_data)
 {
+#if !GLIB_CHECK_VERSION(2, 48, 0)
+	gchar *app_id = NULL;
+#endif
+
 	if (g_variant_dict_contains(options, "version")) {
 		printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION,
 		                                 purple_core_get_version());
 		return 0;
 	}
 
+#if !GLIB_CHECK_VERSION(2, 48, 0)
+	if (g_variant_dict_lookup(options, "gapplication-app-id",
+			"s", &app_id)) {
+		g_variant_dict_remove(options, "gapplication-app-id");
+		g_application_set_application_id(app, app_id);
+		g_free(app_id);
+	}
+#endif
+
 	return -1;
 }
 
@@ -374,6 +387,13 @@
 }
 
 static GOptionEntry option_entries[] = {
+#if !GLIB_CHECK_VERSION(2, 48, 0)
+	/* Support G_APPLICATION_CAN_OVERRIDE_APP_ID functionality
+	 * even though we don't depend on version 2.48 yet
+	 */
+	{"gapplication-app-id", '\0', 0, G_OPTION_ARG_STRING, NULL,
+		N_("Override the application's ID") },
+#endif
 	{"config", 'c', 0,
 		G_OPTION_ARG_FILENAME, &opt_config_dir_arg,
 		N_("use DIR for config files"), N_("DIR")},
@@ -682,7 +702,12 @@
 #endif
 
 	app = G_APPLICATION(gtk_application_new("im.pidgin.Pidgin",
-				G_APPLICATION_FLAGS_NONE));
+#if GLIB_CHECK_VERSION(2, 48, 0)
+				G_APPLICATION_CAN_OVERRIDE_APP_ID
+#else
+				G_APPLICATION_FLAGS_NONE
+#endif
+				));
 
 	summary = g_strdup_printf("%s %s", PIDGIN_NAME, DISPLAY_VERSION);
 	g_application_set_option_context_summary(app, summary);

mercurial