| 338 |
338 |
| 339 static gint |
339 static gint |
| 340 pidgin_handle_local_options_cb(GApplication *app, GVariantDict *options, |
340 pidgin_handle_local_options_cb(GApplication *app, GVariantDict *options, |
| 341 gpointer user_data) |
341 gpointer user_data) |
| 342 { |
342 { |
| 343 #if !GLIB_CHECK_VERSION(2, 48, 0) |
|
| 344 gchar *app_id = NULL; |
343 gchar *app_id = NULL; |
| 345 #endif |
|
| 346 |
344 |
| 347 if (g_variant_dict_contains(options, "version")) { |
345 if (g_variant_dict_contains(options, "version")) { |
| 348 printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION, |
346 printf("%s %s (libpurple %s)\n", PIDGIN_NAME, DISPLAY_VERSION, |
| 349 purple_core_get_version()); |
347 purple_core_get_version()); |
| 350 return 0; |
348 return 0; |
| 351 } |
349 } |
| 352 |
350 |
| 353 #if !GLIB_CHECK_VERSION(2, 48, 0) |
|
| 354 if (g_variant_dict_lookup(options, "gapplication-app-id", |
351 if (g_variant_dict_lookup(options, "gapplication-app-id", |
| 355 "s", &app_id)) { |
352 "s", &app_id)) { |
| 356 g_variant_dict_remove(options, "gapplication-app-id"); |
353 g_variant_dict_remove(options, "gapplication-app-id"); |
| 357 g_application_set_application_id(app, app_id); |
354 g_application_set_application_id(app, app_id); |
| 358 g_free(app_id); |
355 g_free(app_id); |
| 359 } |
356 } |
| 360 #endif |
|
| 361 |
357 |
| 362 return -1; |
358 return -1; |
| 363 } |
359 } |
| 364 |
360 |
| 365 static void |
361 static void |
| 413 |
409 |
| 414 return TRUE; |
410 return TRUE; |
| 415 } |
411 } |
| 416 |
412 |
| 417 static GOptionEntry option_entries[] = { |
413 static GOptionEntry option_entries[] = { |
| 418 #if !GLIB_CHECK_VERSION(2, 48, 0) |
|
| 419 /* Support G_APPLICATION_CAN_OVERRIDE_APP_ID functionality |
414 /* Support G_APPLICATION_CAN_OVERRIDE_APP_ID functionality |
| 420 * even though we don't depend on version 2.48 yet |
415 * even though we don't depend on version 2.48 yet |
| 421 */ |
416 */ |
| 422 {"gapplication-app-id", '\0', 0, G_OPTION_ARG_STRING, NULL, |
417 {"gapplication-app-id", '\0', 0, G_OPTION_ARG_STRING, NULL, |
| 423 N_("Override the application's ID") }, |
418 N_("Override the application's ID") }, |
| 424 #endif |
|
| 425 {"config", 'c', 0, |
419 {"config", 'c', 0, |
| 426 G_OPTION_ARG_FILENAME, &opt_config_dir_arg, |
420 G_OPTION_ARG_FILENAME, &opt_config_dir_arg, |
| 427 N_("use DIR for config files"), N_("DIR")}, |
421 N_("use DIR for config files"), N_("DIR")}, |
| 428 {"login", 'l', G_OPTION_FLAG_OPTIONAL_ARG, |
422 {"login", 'l', G_OPTION_FLAG_OPTIONAL_ARG, |
| 429 G_OPTION_ARG_CALLBACK, &login_opt_arg_func, |
423 G_OPTION_ARG_CALLBACK, &login_opt_arg_func, |
| 729 #ifndef _WIN32 |
723 #ifndef _WIN32 |
| 730 pidgin_setup_error_handler(); |
724 pidgin_setup_error_handler(); |
| 731 #endif |
725 #endif |
| 732 |
726 |
| 733 app = G_APPLICATION(gtk_application_new("im.pidgin.Pidgin3", |
727 app = G_APPLICATION(gtk_application_new("im.pidgin.Pidgin3", |
| 734 #if GLIB_CHECK_VERSION(2, 48, 0) |
|
| 735 G_APPLICATION_CAN_OVERRIDE_APP_ID | |
728 G_APPLICATION_CAN_OVERRIDE_APP_ID | |
| 736 #endif |
|
| 737 G_APPLICATION_HANDLES_COMMAND_LINE)); |
729 G_APPLICATION_HANDLES_COMMAND_LINE)); |
| 738 |
730 |
| 739 g_application_add_main_option_entries(app, option_entries); |
731 g_application_add_main_option_entries(app, option_entries); |
| 740 g_application_add_option_group(app, purple_get_option_group()); |
732 g_application_add_option_group(app, purple_get_option_group()); |
| 741 g_application_add_option_group(app, gplugin_get_option_group()); |
733 g_application_add_option_group(app, gplugin_get_option_group()); |