static UniqueResponse unique_message_cb (UniqueApp *app, UniqueCommand command, UniqueMessageData *message, guint time_, gpointer user_data) { GtkWindow *window = GTK_WINDOW (user_data); char **uris; switch (command) { case UNIQUE_ACTIVATE: gtk_window_set_screen (window, unique_message_data_get_screen (message)); gtk_window_present_with_time (window, time_); break; case COMMAND_CALLBACK: gtk_window_set_screen (window, unique_message_data_get_screen (message)); gtk_window_present_with_time (window, time_); uris = unique_message_data_get_uris (message); if (uris) handle_uri (BISHO_WINDOW (window), uris[0]); g_strfreev (uris); break; default: break; } return UNIQUE_RESPONSE_OK; }
static UniqueResponse unique_app_message_cb (UniqueApp *unique_app, gint command, UniqueMessageData *data, guint timestamp, gpointer user_data) { GtkWindow *window = user_data; DEBUG ("Other instance launched, presenting the main window. " "Command=%d, timestamp %u", command, timestamp); if (command == COMMAND_ACCOUNTS_DIALOG) { show_accounts_ui (window, TRUE); } else { /* We're requested to show stuff again, disable the start hidden global * in case the accounts wizard wants to pop up. */ start_hidden = FALSE; show_accounts_ui (window, FALSE); gtk_window_set_screen (GTK_WINDOW (window), unique_message_data_get_screen (data)); gtk_window_set_startup_id (GTK_WINDOW (window), unique_message_data_get_startup_id (data)); gtk_window_present_with_time (GTK_WINDOW (window), timestamp); } return UNIQUE_RESPONSE_OK; }
static UniqueResponse message_received_cb(UniqueApp* app, UniqueCommand command, UniqueMessageData* message, guint time, gpointer user_data) { UniqueResponse res; AppShellData* app_data = user_data; switch (command) { case UNIQUE_ACTIVATE: /* move the main window to the screen that sent us the command */ gtk_window_set_screen(GTK_WINDOW(app_data->main_app), unique_message_data_get_screen(message)); if (!app_data->main_app_window_shown_once) { show_shell(app_data); } gtk_window_present_with_time(GTK_WINDOW(app_data->main_app), time); gtk_widget_grab_focus(SLAB_SECTION(app_data->filter_section)->contents); res = UNIQUE_RESPONSE_OK; break; default: res = UNIQUE_RESPONSE_PASSTHROUGH; break; } return res; }
static UniqueResponse gnac_ui_message_received_cb(UniqueApp *app, gint command, UniqueMessageData *message, guint time, gpointer user_data) { GtkWindow *main_window = GTK_WINDOW(gnac_ui_get_widget("main_window")); switch (command) { case UNIQUE_ACTIVATE: gtk_widget_show_all(GTK_WIDGET(main_window)); gtk_window_set_screen(main_window, unique_message_data_get_screen(message)); gtk_window_present_with_time(main_window, time); break; case UNIQUE_CMD_ADD: { gchar **filenames = unique_message_data_get_uris(message); gnac_options_process_filenames(filenames); g_strfreev(filenames); gnac_ui_notify(_("Adding files...")); break; } case UNIQUE_CMD_DEBUG: gnac_ui_notify(_("Debug mode activated")); gnac_options_enable_debug(); break; case UNIQUE_CMD_VERBOSE: gnac_ui_notify(_("Verbose mode activated")); gnac_options_enable_verbose(); break; default: libgnac_debug("Received unknown libunique command: %d", command); break; } return UNIQUE_RESPONSE_OK; }
UniqueResponse message_cb(UniqueApp *a, gint id, UniqueMessageData *message_data, guint time, gpointer data) { (void) a; (void) id; (void) time; if (message_data) { lua_State *L = (lua_State*)data; /* get message text */ gchar *text = unique_message_data_get_text(message_data); lua_pushstring(L, text); g_free(text); /* get message screen */ GdkScreen *screen = unique_message_data_get_screen(message_data); lua_pushlightuserdata(L, screen); /* emit signal */ signal_object_emit(L, unique_class.signals, "message", 2, 0); } return UNIQUE_RESPONSE_OK; }