static int trg_gtk_app_command_line(GApplication * application, GApplicationCommandLine * cmdline) { GList *windows = gtk_application_get_windows(GTK_APPLICATION(application)); TrgMainWindow *window; gchar **argv; if (!windows || !windows->data) return 1; window = TRG_MAIN_WINDOW(windows->data); argv = g_application_command_line_get_arguments(cmdline, NULL); if (g_application_command_line_get_is_remote(cmdline)) { if (!argv[0]) { gtk_window_present(GTK_WINDOW(window)); g_strfreev(argv); } else { return trg_add_from_filename(window, argv); } } else { trg_main_window_set_start_args(window, argv); auto_connect_if_required(TRG_MAIN_WINDOW(windows->data)); } return 0; }
enum { COMMAND_0, COMMAND_ADD }; static UniqueResponse message_received_cb(UniqueApp * app G_GNUC_UNUSED, gint command, UniqueMessageData * message, guint time_, gpointer user_data) { TrgMainWindow *win; UniqueResponse res; gchar **uris; win = TRG_MAIN_WINDOW(user_data); switch (command) { case UNIQUE_ACTIVATE: gtk_window_set_screen(GTK_WINDOW(user_data), unique_message_data_get_screen(message)); gtk_window_present_with_time(GTK_WINDOW(user_data), time_); res = UNIQUE_RESPONSE_OK; break; case COMMAND_ADD: uris = unique_message_data_get_uris(message); res = trg_add_from_filename(win, uris) ? UNIQUE_RESPONSE_OK : UNIQUE_RESPONSE_FAIL; break;