static void session_command_autoresume (EphySession *session, guint32 user_time) { EphySessionPrivate *priv = session->priv; GFile *saved_session_file; char *saved_session_file_path; gboolean crashed_session; EphyPrefsRestoreSessionPolicy policy; LOG ("ephy_session_autoresume"); saved_session_file = get_session_file (SESSION_STATE); saved_session_file_path = g_file_get_path (saved_session_file); g_object_unref (saved_session_file); crashed_session = g_file_test (saved_session_file_path, G_FILE_TEST_EXISTS); g_free (saved_session_file_path); policy = g_settings_get_enum (EPHY_SETTINGS_MAIN, EPHY_PREFS_RESTORE_SESSION_POLICY); if (crashed_session == FALSE || policy == EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER || priv->windows != NULL || priv->tool_windows != NULL) { /* If we are auto-resuming, and we never want to * restore the session, clobber the session state * file. */ if (policy == EPHY_PREFS_RESTORE_SESSION_POLICY_NEVER) session_delete (session, SESSION_STATE); ephy_session_queue_command (session, EPHY_SESSION_CMD_MAYBE_OPEN_WINDOW, NULL, NULL, user_time, FALSE); return; } if (priv->resume_window) { gtk_window_present_with_time (GTK_WINDOW (priv->resume_window), user_time); return; } ephy_session_queue_command (session, EPHY_SESSION_CMD_LOAD_SESSION, SESSION_STATE, NULL, user_time, TRUE); }
void applet_info_dialog_show (NMApplet *applet) { GtkWidget *dialog; dialog = info_dialog_update (applet); if (!dialog) return; g_signal_connect (dialog, "delete-event", G_CALLBACK (gtk_widget_hide_on_delete), dialog); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_hide), dialog); gtk_widget_realize (dialog); gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); }
void nma_wireless_dialog_show (NMAWirelessDialog *dialog) { GtkWidget *widget; g_return_if_fail (NMA_IS_WIRELESS_DIALOG (dialog)); widget = GTK_WIDGET (dialog); /* Prevent focus stealing */ gtk_widget_realize (widget); gtk_widget_show (widget); gtk_window_present_with_time (GTK_WINDOW (widget), gdk_x11_get_server_time (widget->window)); }
static void photos_application_activate (GApplication *application) { PhotosApplication *self = PHOTOS_APPLICATION (application); PhotosApplicationPrivate *priv = self->priv; if (priv->main_window == NULL) { photos_application_create_window (self); photos_mode_controller_set_window_mode (priv->mode_cntrlr, PHOTOS_WINDOW_MODE_OVERVIEW); } gtk_window_present_with_time (GTK_WINDOW (priv->main_window), priv->activation_timestamp); priv->activation_timestamp = GDK_CURRENT_TIME; }
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; }
GtkWidget * applet_warning_dialog_show (const char *message) { GtkWidget *dialog; dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, message, NULL); /* Bash focus-stealing prevention in the face */ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER_ALWAYS); gtk_window_set_default_icon_name (GTK_STOCK_DIALOG_ERROR); gtk_window_set_title (GTK_WINDOW (dialog), _("Missing resources")); gtk_widget_realize (dialog); gtk_widget_show (dialog); gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog); return dialog; }
/** * eog_application_open_file_list: * @application: An #EogApplication. * @file_list: (element-type GFile): A list of #GFile<!-- -->s. * @timestamp: The timestamp of the user interaction which triggered this call * (see gtk_window_present_with_time()). * @flags: A set of #EogStartupFlags influencing a new windows' state. * @error: Return location for a #GError, or NULL to ignore errors. * * Opens a list of files in a #EogWindow. If an #EogWindow displaying the first * image in the list is already open, this will be used. Otherwise, an empty * #EogWindow is used, either already existing or newly created. * If the EOG_STARTUP_SINGLE_WINDOW flag is set, the files are opened in the * first #EogWindow and no new one is opened. * * Returns: Currently always %TRUE. **/ gboolean eog_application_open_file_list (EogApplication *application, GSList *file_list, guint timestamp, EogStartupFlags flags, GError **error) { EogWindow *new_window = NULL; if (file_list != NULL) { if(flags & EOG_STARTUP_SINGLE_WINDOW) new_window = eog_application_get_first_window (application); else new_window = eog_application_get_file_window (application, (GFile *) file_list->data); } if (new_window != NULL) { if(flags & EOG_STARTUP_SINGLE_WINDOW) eog_window_open_file_list (new_window, file_list); else gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp); return TRUE; } new_window = eog_application_get_empty_window (application); if (new_window == NULL) { new_window = EOG_WINDOW (eog_window_new (flags)); } g_signal_connect (new_window, "prepared", G_CALLBACK (eog_application_show_window), GUINT_TO_POINTER (timestamp)); eog_window_open_file_list (new_window, file_list); return TRUE; }
void applet_mobile_pin_dialog_present (GtkWidget *dialog, gboolean now) { GladeXML *xml; GtkWidget *widget; g_return_if_fail (dialog != NULL); xml = g_object_get_data (G_OBJECT (dialog), "xml"); g_return_if_fail (xml != NULL); gtk_widget_show_all (dialog); widget = glade_xml_get_widget (xml, "progress_hbox"); gtk_widget_hide (widget); /* Hide inactive entries */ widget = glade_xml_get_widget (xml, "code2_entry"); if (!g_object_get_data (G_OBJECT (widget), "active")) { gtk_widget_hide (widget); widget = glade_xml_get_widget (xml, "code2_label"); gtk_widget_hide (widget); } widget = glade_xml_get_widget (xml, "code3_entry"); if (!g_object_get_data (G_OBJECT (widget), "active")) { gtk_widget_hide (widget); widget = glade_xml_get_widget (xml, "code3_label"); gtk_widget_hide (widget); } /* Need to resize the dialog after hiding widgets */ gtk_window_resize (GTK_WINDOW (dialog), 400, 100); /* Show the dialog */ gtk_widget_realize (dialog); if (now) gtk_window_present_with_time (GTK_WINDOW (dialog), gdk_x11_get_server_time (dialog->window)); else gtk_window_present (GTK_WINDOW (dialog)); }
/** * eog_application_open_window: * @application: An #EogApplication. * @timestamp: The timestamp of the user interaction which triggered this call * (see gtk_window_present_with_time()). * @flags: A set of #EogStartupFlags influencing a new windows' state. * @error: Return location for a #GError, or NULL to ignore errors. * * Opens and presents an empty #EogWindow to the user. If there is * an empty window already open, this will be used. Otherwise, a * new one will be instantiated. * * Returns: %FALSE if @application is invalid, %TRUE otherwise **/ gboolean eog_application_open_window (EogApplication *application, guint32 timestamp, EogStartupFlags flags, GError **error) { GtkWidget *new_window = NULL; new_window = GTK_WIDGET (eog_application_get_empty_window (application)); if (new_window == NULL) { new_window = eog_window_new (flags); } g_return_val_if_fail (EOG_IS_APPLICATION (application), FALSE); gtk_window_present_with_time (GTK_WINDOW (new_window), timestamp); return TRUE; }
static void ev_application_open_uri_in_window (EvApplication *application, const char *uri, EvWindow *ev_window, GdkScreen *screen, EvLinkDest *dest, EvWindowRunMode mode, const gchar *search_string, guint timestamp) { #ifdef GDK_WINDOWING_X11 GdkWindow *gdk_window; #endif if (screen) { ev_stock_icons_set_screen (screen); gtk_window_set_screen (GTK_WINDOW (ev_window), screen); } /* We need to load uri before showing the window, so we can restore window size without flickering */ ev_window_open_uri (ev_window, uri, dest, mode, search_string); if (!gtk_widget_get_realized (GTK_WIDGET (ev_window))) gtk_widget_realize (GTK_WIDGET (ev_window)); #ifdef GDK_WINDOWING_X11 gdk_window = gtk_widget_get_window (GTK_WIDGET (ev_window)); if (timestamp <= 0) timestamp = gdk_x11_get_server_time (gdk_window); gdk_x11_window_set_user_time (gdk_window, timestamp); gtk_window_present (GTK_WINDOW (ev_window)); #else gtk_window_present_with_time (GTK_WINDOW (ev_window), timestamp); #endif /* GDK_WINDOWING_X11 */ }
/* Ask X to move to the desktop on which @window currently is * and the present @window. */ void empathy_move_to_window_desktop (GtkWindow *window, guint32 timestamp) { GdkScreen *screen; Screen *xscreen; GdkWindow *gdk_window; int workspace; screen = gtk_window_get_screen (window); xscreen = gdk_x11_screen_get_xscreen (screen); gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); workspace = window_get_workspace (xscreen, gdk_x11_window_get_xid (gdk_window)); if (workspace == -1) goto out; _wnck_activate_workspace (xscreen, workspace, timestamp); out: gtk_window_present_with_time (window, timestamp); }
/* The code that handles single-instance and startup notification is * copied from gedit. * * Copyright (C) 2005 - Paolo Maggi */ static void on_bacon_message_received (const char *message, gpointer data) { GtkWidget *window = data; guint32 startup_timestamp; g_return_if_fail (message != NULL); DEBUG ("Other instance launched, presenting the main window. message='%s'", message); if (strcmp (message, "accounts") == 0) { /* accounts dialog requested */ empathy_accounts_dialog_show (GTK_WINDOW (window), NULL); } else { startup_timestamp = atoi (message); /* Set the proper interaction time on the window. * Fall back to roundtripping to the X server when we * don't have the timestamp, e.g. when launched from * terminal. We also need to make sure that the window * has been realized otherwise it will not work. lame. */ if (startup_timestamp == 0) { /* Work if launched from the terminal */ DEBUG ("Using X server timestamp as a fallback"); if (!GTK_WIDGET_REALIZED (window)) { gtk_widget_realize (GTK_WIDGET (window)); } startup_timestamp = gdk_x11_get_server_time (window->window); } gtk_window_present_with_time (GTK_WINDOW (window), startup_timestamp); } }
/* Takes care of moving the window to the current workspace. */ void tpaw_window_present_with_time (GtkWindow *window, guint32 timestamp) { GdkWindow *gdk_window; g_return_if_fail (GTK_IS_WINDOW (window)); /* Move the window to the current workspace before trying to show it. * This is the behaviour people expect when clicking on the statusbar icon. */ gdk_window = gtk_widget_get_window (GTK_WIDGET (window)); if (gdk_window) { gint x, y; gint w, h; #ifdef GDK_WINDOWING_X11 /* Has no effect if the WM has viewports, like compiz */ if (GDK_IS_X11_WINDOW (gdk_window)) gdk_x11_window_move_to_current_desktop (gdk_window); #endif /* If window is still off-screen, hide it to force it to * reposition on the current workspace. */ gtk_window_get_position (window, &x, &y); gtk_window_get_size (window, &w, &h); if (!TPAW_RECT_IS_ON_SCREEN (x, y, w, h)) gtk_widget_hide (GTK_WIDGET (window)); } if (timestamp == GDK_CURRENT_TIME) gtk_window_present (window); else gtk_window_present_with_time (window, timestamp); }
static void eog_application_show_window (EogWindow *window, gpointer user_data) { gtk_window_present_with_time (GTK_WINDOW (window), GPOINTER_TO_UINT (user_data)); }
static void gtr_window_present (GtkWindow * window) { gtk_window_present_with_time (window, gtk_get_current_event_time ()); }
void preferences_dialog_show (PreferencesDialog *dialog) { gtk_window_present_with_time (GTK_WINDOW (dialog->dialog), gtk_get_current_event_time ()); }