623 lines
18 KiB
Diff
623 lines
18 KiB
Diff
--- gnome-session-2.19.6/gnome-session/logout.c
|
|
+++ gnome-session-2.19.6/gnome-session/logout.c
|
|
@@ -44,6 +44,14 @@
|
|
|
|
enum
|
|
{
|
|
+ GS_RESPONSE_LOGOUT,
|
|
+ GS_RESPONSE_SHUTDOWN,
|
|
+ GS_RESPONSE_RESTART,
|
|
+ GS_RESPONSE_LOCK
|
|
+};
|
|
+
|
|
+enum
|
|
+{
|
|
OPTION_LOGOUT,
|
|
OPTION_HALT,
|
|
OPTION_REBOOT,
|
|
@@ -260,82 +268,128 @@
|
|
fadeout_windows = NULL;
|
|
}
|
|
|
|
-static GtkWidget *
|
|
-make_title_label (const char *text)
|
|
+
|
|
+
|
|
+static GtkWidget*
|
|
+get_tile(GtkWidget *image, const gchar *title, const gchar *desc)
|
|
{
|
|
- GtkWidget *label;
|
|
- char *full;
|
|
+ GtkWidget *button;
|
|
+ GtkWidget *alignment;
|
|
+ GtkWidget *hbox;
|
|
+ GtkWidget *vbox;
|
|
|
|
- full = g_strdup_printf ("<span weight=\"bold\">%s</span>", text);
|
|
- label = gtk_label_new (full);
|
|
- g_free (full);
|
|
+ g_assert(title != NULL);
|
|
|
|
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
- gtk_label_set_use_markup (GTK_LABEL (label), TRUE);
|
|
+ button = GTK_WIDGET(gtk_button_new());
|
|
+ gtk_button_set_relief(GTK_BUTTON(button), GTK_RELIEF_NONE);
|
|
+// GTK_WIDGET_UNSET_FLAGS(button, GTK_HAS_FOCUS);
|
|
|
|
- return label;
|
|
-}
|
|
+ alignment = gtk_alignment_new(0, 0.5, 0, 0);
|
|
+ gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 0, 0, 6, 6);
|
|
+ gtk_container_add(GTK_CONTAINER(button), alignment);
|
|
|
|
-static int
|
|
-get_default_option (void)
|
|
-{
|
|
- GConfClient *gconf_client;
|
|
- char *str;
|
|
- int option;
|
|
+ hbox = gtk_hbox_new(FALSE, 12);
|
|
+ gtk_container_add(GTK_CONTAINER(alignment), hbox);
|
|
+ if(image != NULL)
|
|
+ gtk_box_pack_start(GTK_BOX(hbox), image, FALSE, FALSE, 0);
|
|
+
|
|
+ vbox = gtk_vbox_new(FALSE, 2);
|
|
+
|
|
+ if(title != NULL)
|
|
+ {
|
|
+ gchar *full;
|
|
+ GtkWidget *label;
|
|
+
|
|
+ full = g_strdup_printf ("<span weight=\"bold\">%s</span>", title);
|
|
+ label = gtk_label_new(full);
|
|
+ g_free (full);
|
|
+
|
|
+ gtk_label_set_use_markup (GTK_LABEL(label), TRUE);
|
|
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
+ gtk_label_set_use_underline(GTK_LABEL(label), TRUE);
|
|
+
|
|
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
|
+ }
|
|
+
|
|
+ if(desc != NULL)
|
|
+ {
|
|
+ gchar *full;
|
|
+ GtkWidget *label;
|
|
+
|
|
+ full = g_strdup_printf ("<span foreground=\"#777777\">%s</span>",
|
|
+ desc);
|
|
+ label = gtk_label_new(full);
|
|
+ g_free (full);
|
|
+
|
|
+ gtk_label_set_use_markup (GTK_LABEL(label), TRUE);
|
|
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
|
+ gtk_label_set_use_underline(GTK_LABEL(label), TRUE);
|
|
+ gtk_label_set_line_wrap(GTK_LABEL (label), TRUE);
|
|
|
|
- gconf_client = gsm_get_conf_client ();
|
|
- str = gconf_client_get_string (gconf_client, LOGOUT_OPTION_KEY, NULL);
|
|
+ gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
|
|
+ }
|
|
|
|
- if (str == NULL || !gconf_string_to_enum (logout_options_lookup_table, str, &option))
|
|
- option = OPTION_LOGOUT;
|
|
+ gtk_box_pack_start(GTK_BOX(hbox), vbox, FALSE, FALSE, 0);
|
|
|
|
- g_free (str);
|
|
- return option;
|
|
+ return button;
|
|
}
|
|
|
|
-static void
|
|
-set_default_option (int option)
|
|
+static void logout_button_clicked(GtkButton *button, gpointer user_data)
|
|
{
|
|
- GConfClient *gconf_client;
|
|
- const char *str;
|
|
+ gtk_dialog_response(GTK_DIALOG(user_data), GS_RESPONSE_LOGOUT);
|
|
+}
|
|
|
|
- gconf_client = gsm_get_conf_client ();
|
|
+static void shutdown_button_clicked(GtkButton *button, gpointer user_data)
|
|
+{
|
|
+ gtk_dialog_response(GTK_DIALOG(user_data), GS_RESPONSE_SHUTDOWN);
|
|
+}
|
|
|
|
- str = gconf_enum_to_string (logout_options_lookup_table, option);
|
|
- g_assert (str != NULL);
|
|
+static void restart_button_clicked(GtkButton *button, gpointer user_data)
|
|
+{
|
|
+ gtk_dialog_response(GTK_DIALOG(user_data), GS_RESPONSE_RESTART);
|
|
+}
|
|
|
|
- gconf_client_set_string (gconf_client, LOGOUT_OPTION_KEY, str, NULL);
|
|
+static void lock_button_clicked(GtkButton *button, gpointer user_data)
|
|
+{
|
|
+ gtk_dialog_response(GTK_DIALOG(user_data), GS_RESPONSE_LOCK);
|
|
}
|
|
|
|
+
|
|
+
|
|
static gboolean
|
|
display_gui (void)
|
|
{
|
|
GtkWidget *box;
|
|
- GtkWidget *title;
|
|
- GtkWidget *hbox;
|
|
+ //GtkWidget *title;
|
|
+ //GtkWidget *hbox;
|
|
GtkWidget *vbox;
|
|
GtkWidget *image;
|
|
- GtkWidget *toggle_button = NULL;
|
|
+ //GtkWidget *toggle_button = NULL;
|
|
gint response;
|
|
- GtkWidget *halt = NULL;
|
|
- GtkWidget *reboot = NULL;
|
|
- GtkWidget *suspend = NULL;
|
|
+ //GtkWidget *halt = NULL;
|
|
+ //GtkWidget *reboot = NULL;
|
|
+ //GtkWidget *suspend = NULL;
|
|
GtkWidget *invisible;
|
|
- gboolean halt_supported = FALSE;
|
|
- gboolean reboot_supported = FALSE;
|
|
- gboolean suspend_supported = FALSE;
|
|
+ //gboolean halt_supported = FALSE;
|
|
+ //gboolean reboot_supported = FALSE;
|
|
+ //gboolean suspend_supported = FALSE;
|
|
gboolean retval = FALSE;
|
|
- gboolean save_active = FALSE;
|
|
- gboolean halt_active = FALSE;
|
|
- gboolean reboot_active = FALSE;
|
|
- gboolean suspend_active = FALSE;
|
|
- GdmLogoutAction logout_action = GDM_LOGOUT_ACTION_NONE;
|
|
+ //gboolean save_active = FALSE;
|
|
+ //gboolean halt_active = FALSE;
|
|
+ //gboolean reboot_active = FALSE;
|
|
+ //gboolean suspend_active = FALSE;
|
|
+ //GdmLogoutAction logout_action = GDM_LOGOUT_ACTION_NONE;
|
|
gboolean iris_effect_enabled;
|
|
gboolean grab_xserver;
|
|
GError *error = NULL;
|
|
GdkScreen *screen;
|
|
int monitor;
|
|
- int selected_option;
|
|
+ //int selected_option;
|
|
+
|
|
+ GdkPixbuf *themePixbuf = NULL;
|
|
+ GtkIconTheme *iconTheme;
|
|
+ GtkWidget *tile;
|
|
+
|
|
|
|
gsm_verbose ("display_gui: showing logout dialog\n");
|
|
|
|
@@ -387,106 +441,190 @@
|
|
|
|
gtk_dialog_set_has_separator (GTK_DIALOG (box), FALSE);
|
|
|
|
+
|
|
+
|
|
+
|
|
+
|
|
+ // setup specs from Gnome HIG
|
|
+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (box)->vbox), 12);
|
|
+ gtk_container_set_border_width (GTK_CONTAINER(box), 6);
|
|
+
|
|
vbox = gtk_vbox_new (FALSE, 12);
|
|
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (box)->vbox), vbox, FALSE, FALSE, 0);
|
|
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (box)->vbox), 2);
|
|
- gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
|
|
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (box)->vbox), vbox,
|
|
+ FALSE, FALSE, 0);
|
|
+ gtk_container_set_border_width(GTK_CONTAINER (vbox), 6);
|
|
gtk_widget_show (vbox);
|
|
-
|
|
- hbox = gtk_hbox_new (FALSE, 12);
|
|
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
|
- gtk_widget_show (hbox);
|
|
-
|
|
- image = gtk_image_new_from_stock ("gtk-dialog-question", GTK_ICON_SIZE_DIALOG);
|
|
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
|
|
- gtk_widget_show (image);
|
|
-
|
|
- title = make_title_label (_("Are you sure you want to log out?"));
|
|
- gtk_box_pack_start (GTK_BOX (hbox), title, FALSE, FALSE, 0);
|
|
- gtk_misc_set_alignment (GTK_MISC (title), 0, 0.5);
|
|
- gtk_widget_show (title);
|
|
-
|
|
- gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_HELP, GTK_RESPONSE_HELP);
|
|
- gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
|
- gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_OK, GTK_RESPONSE_OK);
|
|
|
|
- gtk_dialog_set_default_response (GTK_DIALOG (box), GTK_RESPONSE_OK);
|
|
+
|
|
gtk_window_set_screen (GTK_WINDOW (box), screen);
|
|
- gtk_window_set_resizable (GTK_WINDOW (box), FALSE);
|
|
+ gtk_window_set_policy (GTK_WINDOW (box), FALSE, FALSE, TRUE);
|
|
+ gtk_window_set_keep_above(GTK_WINDOW(box), TRUE);
|
|
+ gtk_window_stick(GTK_WINDOW(box));
|
|
+
|
|
+ iconTheme = gtk_icon_theme_get_for_screen(screen);
|
|
+ //iconTheme = gtk_icon_theme_get_default ();
|
|
+
|
|
+ // add help button in every case
|
|
+ gtk_dialog_add_button (GTK_DIALOG (box), GTK_STOCK_HELP,
|
|
+ GTK_RESPONSE_HELP);
|
|
+
|
|
+ gtk_dialog_add_button (GTK_DIALOG (box),
|
|
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
|
|
+
|
|
+ // ============ LOGOUT TILE ============
|
|
+ image = NULL;
|
|
+ if(gtk_icon_theme_has_icon(iconTheme, "system-log-out"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "system-log-out", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ else if(gtk_icon_theme_has_icon(iconTheme, "gnome-logout"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "gnome-logout", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ if(image == NULL)
|
|
+ {
|
|
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
|
|
+ GTK_ICON_SIZE_DIALOG);
|
|
+ }
|
|
+ tile = get_tile(image, _("_Log Out"),
|
|
+ _("Ends your session and logs you out."));
|
|
+ g_signal_connect (G_OBJECT (tile), "clicked",
|
|
+ G_CALLBACK (logout_button_clicked), box);
|
|
+
|
|
+ gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0);
|
|
+ gtk_widget_show_all(tile);
|
|
+
|
|
+
|
|
+
|
|
+ // ============ LOCK TILE ============
|
|
+ image = NULL;
|
|
+ if(gtk_icon_theme_has_icon(iconTheme, "system-lock-screen"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "system-lock-screen", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ else if(gtk_icon_theme_has_icon(iconTheme, "gnome-lockscreen"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "gnome-lockscreen", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ if(image == NULL)
|
|
+ {
|
|
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
|
|
+ GTK_ICON_SIZE_DIALOG);
|
|
+ }
|
|
+ tile = get_tile(image, _("Loc_k Screen"),
|
|
+ _("Locks this computer's screen."));
|
|
+ g_signal_connect (G_OBJECT (tile), "clicked",
|
|
+ G_CALLBACK (lock_button_clicked), box);
|
|
+
|
|
+ gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0);
|
|
+ gtk_widget_show_all(tile);
|
|
+
|
|
+
|
|
+
|
|
+ // ============ SHUTDOWN TILE ============
|
|
+ image = NULL;
|
|
+ if(gtk_icon_theme_has_icon(iconTheme, "system-shutdown"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "system-shutdown", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ else if(gtk_icon_theme_has_icon(iconTheme, "gnome-shutdown"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "gnome-shutdown", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ if(image == NULL)
|
|
+ {
|
|
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
|
|
+ GTK_ICON_SIZE_DIALOG);
|
|
+ }
|
|
+ tile = get_tile(image, _("_Shutdown"),
|
|
+ _("Ends your session and turns off the computer."));
|
|
+ g_signal_connect (G_OBJECT (tile), "clicked",
|
|
+ G_CALLBACK (shutdown_button_clicked), box);
|
|
+
|
|
+ //if(panel_power_manager_can_power_down (powerManager))
|
|
+ if(!gdm_supports_logout_action (GDM_LOGOUT_ACTION_SHUTDOWN))
|
|
+ {
|
|
+ gtk_widget_set_sensitive(tile, FALSE);
|
|
+ }
|
|
+
|
|
+ gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0);
|
|
+ gtk_widget_show_all(tile);
|
|
+
|
|
+
|
|
+
|
|
+ // ============ RESTART TILE ============
|
|
+ image = NULL;
|
|
+ if(gtk_icon_theme_has_icon(iconTheme, "stock_refresh"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "stock_refresh", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ else if(gtk_icon_theme_has_icon(iconTheme, "gnome-reboot"))
|
|
+ {
|
|
+ themePixbuf = gtk_icon_theme_load_icon(iconTheme,
|
|
+ "gnome-reboot", 48, 0, &error);
|
|
+ if(themePixbuf != NULL)
|
|
+ image = gtk_image_new_from_pixbuf(themePixbuf);
|
|
+ else
|
|
+ image = NULL;
|
|
+ }
|
|
+ if(image == NULL)
|
|
+ {
|
|
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_QUESTION,
|
|
+ GTK_ICON_SIZE_DIALOG);
|
|
+ }
|
|
+ tile = get_tile(image, _("_Restart"),
|
|
+ _("Ends your session and restarts the computer."));
|
|
+ g_signal_connect (G_OBJECT (tile), "clicked",
|
|
+ G_CALLBACK (restart_button_clicked), box);
|
|
+
|
|
+ //if(panel_power_manager_can_power_down (powerManager))
|
|
+ if(!gdm_supports_logout_action (GDM_LOGOUT_ACTION_REBOOT))
|
|
+ {
|
|
+ gtk_widget_set_sensitive(tile, FALSE);
|
|
+ }
|
|
|
|
- gtk_container_set_border_width (GTK_CONTAINER (box), 5);
|
|
+ gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0);
|
|
+ gtk_widget_show_all(tile);
|
|
|
|
- if (!autosave)
|
|
- {
|
|
- toggle_button = gtk_check_button_new_with_mnemonic (_("Remember running applications"));
|
|
- gtk_widget_show (toggle_button);
|
|
- gtk_box_pack_start (GTK_BOX (vbox),
|
|
- toggle_button,
|
|
- FALSE, TRUE, 0);
|
|
- }
|
|
-
|
|
- halt_supported = gdm_supports_logout_action (GDM_LOGOUT_ACTION_SHUTDOWN);
|
|
- reboot_supported = gdm_supports_logout_action (GDM_LOGOUT_ACTION_REBOOT);
|
|
- suspend_supported = gdm_supports_logout_action (GDM_LOGOUT_ACTION_SUSPEND);
|
|
-
|
|
- if (halt_supported || reboot_supported || suspend_supported)
|
|
- {
|
|
- GtkWidget *title, *spacer;
|
|
- GtkWidget *action_vbox, *hbox;
|
|
- GtkWidget *category_vbox;
|
|
- GtkWidget *r;
|
|
-
|
|
- selected_option = get_default_option ();
|
|
-
|
|
- category_vbox = gtk_vbox_new (FALSE, 6);
|
|
- gtk_box_pack_start (GTK_BOX (vbox), category_vbox, TRUE, TRUE, 0);
|
|
- gtk_widget_show (category_vbox);
|
|
-
|
|
- title = make_title_label (_("Action"));
|
|
- gtk_box_pack_start (GTK_BOX (category_vbox),
|
|
- title, FALSE, FALSE, 0);
|
|
- gtk_widget_show (title);
|
|
-
|
|
- hbox = gtk_hbox_new (FALSE, 0);
|
|
- gtk_box_pack_start (GTK_BOX (category_vbox), hbox, TRUE, TRUE, 0);
|
|
- gtk_widget_show (hbox);
|
|
-
|
|
- spacer = gtk_label_new (" ");
|
|
- gtk_box_pack_start (GTK_BOX (hbox), spacer, FALSE, FALSE, 0);
|
|
- gtk_widget_show (spacer);
|
|
-
|
|
- action_vbox = gtk_vbox_new (FALSE, 6);
|
|
- gtk_box_pack_start (GTK_BOX (hbox), action_vbox, TRUE, TRUE, 0);
|
|
- gtk_widget_show (action_vbox);
|
|
-
|
|
- r = gtk_radio_button_new_with_mnemonic (NULL, _("_Log out"));
|
|
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (r), (selected_option == OPTION_LOGOUT));
|
|
- gtk_box_pack_start (GTK_BOX (action_vbox), r, FALSE, FALSE, 0);
|
|
- gtk_widget_show (r);
|
|
|
|
- if (halt_supported)
|
|
- {
|
|
- r = halt = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (r), _("Sh_ut down"));
|
|
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (r), (selected_option == OPTION_HALT));
|
|
- gtk_box_pack_start (GTK_BOX (action_vbox), r, FALSE, FALSE, 0);
|
|
- gtk_widget_show (r);
|
|
- }
|
|
+ gtk_dialog_set_default_response (GTK_DIALOG (box),
|
|
+ GTK_RESPONSE_CANCEL);
|
|
|
|
- if (reboot_supported)
|
|
- {
|
|
- r = reboot = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (r), _("_Restart the computer"));
|
|
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (r), (selected_option == OPTION_REBOOT));
|
|
- gtk_box_pack_start (GTK_BOX (action_vbox), r, FALSE, FALSE, 0);
|
|
- gtk_widget_show (r);
|
|
- }
|
|
- if (suspend_supported)
|
|
- {
|
|
- r = suspend = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (r), _("_Suspend the computer"));
|
|
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (r), (selected_option == OPTION_SUSPEND));
|
|
- gtk_box_pack_start (GTK_BOX (action_vbox), r, FALSE, FALSE, 0);
|
|
- gtk_widget_show (r);
|
|
- }
|
|
- }
|
|
|
|
gsm_center_window_on_screen (GTK_WINDOW (box), screen, monitor);
|
|
|
|
@@ -518,27 +656,6 @@
|
|
|
|
response = gtk_dialog_run (GTK_DIALOG (box));
|
|
|
|
- if (halt)
|
|
- halt_active = GTK_TOGGLE_BUTTON (halt)->active;
|
|
-
|
|
- if (reboot)
|
|
- reboot_active = GTK_TOGGLE_BUTTON (reboot)->active;
|
|
-
|
|
- if (suspend)
|
|
- suspend_active = GTK_TOGGLE_BUTTON (suspend)->active;
|
|
-
|
|
- if (toggle_button)
|
|
- save_active = GTK_TOGGLE_BUTTON (toggle_button)->active;
|
|
-
|
|
- if (reboot_active)
|
|
- selected_option = OPTION_REBOOT;
|
|
- else if (halt_active)
|
|
- selected_option = OPTION_HALT;
|
|
- else if (suspend_active)
|
|
- selected_option = OPTION_SUSPEND;
|
|
- else
|
|
- selected_option = OPTION_LOGOUT;
|
|
-
|
|
gtk_widget_destroy (box);
|
|
gtk_widget_destroy (invisible);
|
|
|
|
@@ -558,62 +675,62 @@
|
|
}
|
|
|
|
switch (response) {
|
|
- case GTK_RESPONSE_OK:
|
|
- /* We want to know if we should trash changes (and lose forever)
|
|
- * or save them */
|
|
- retval = TRUE;
|
|
- if(save_active)
|
|
- save_selected = save_active;
|
|
- if (halt_active)
|
|
- logout_action = GDM_LOGOUT_ACTION_SHUTDOWN;
|
|
- else if (reboot_active)
|
|
- logout_action = GDM_LOGOUT_ACTION_REBOOT;
|
|
- else if (suspend_active)
|
|
- {
|
|
- logout_action = GDM_LOGOUT_ACTION_SUSPEND;
|
|
- g_spawn_command_line_async ("powersave --suspend-to-disk", NULL);
|
|
- retval = FALSE;
|
|
- }
|
|
- set_default_option (selected_option);
|
|
- break;
|
|
- default:
|
|
- case GTK_RESPONSE_CANCEL:
|
|
- retval = FALSE;
|
|
- break;
|
|
- case GTK_RESPONSE_HELP:
|
|
- gnome_help_display_desktop_on_screen (NULL, "user-guide",
|
|
- "user-guide.xml",
|
|
- "gosgetstarted-73",
|
|
- screen,
|
|
- &error);
|
|
-
|
|
- if (error)
|
|
- {
|
|
- GtkWidget *dialog;
|
|
-
|
|
- dialog = gtk_message_dialog_new (NULL,
|
|
- GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
- GTK_MESSAGE_ERROR,
|
|
- GTK_BUTTONS_CLOSE,
|
|
- ("There was an error displaying help: \n%s"),
|
|
- error->message);
|
|
-
|
|
- g_signal_connect (G_OBJECT (dialog), "response",
|
|
- G_CALLBACK (gtk_widget_destroy),
|
|
- NULL);
|
|
-
|
|
- gtk_window_set_screen (GTK_WINDOW (dialog), screen);
|
|
-
|
|
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
|
- gtk_widget_show (dialog);
|
|
- g_error_free (error);
|
|
- }
|
|
-
|
|
- retval = FALSE;
|
|
- break;
|
|
- }
|
|
-
|
|
- gdm_set_logout_action (logout_action);
|
|
+ case GS_RESPONSE_LOGOUT:
|
|
+ gdm_set_logout_action (GDM_LOGOUT_ACTION_NONE);
|
|
+ retval = TRUE;
|
|
+ break;
|
|
+ case GS_RESPONSE_SHUTDOWN:
|
|
+ gdm_set_logout_action (GDM_LOGOUT_ACTION_SHUTDOWN);
|
|
+ retval = TRUE;
|
|
+ break;
|
|
+ case GS_RESPONSE_RESTART:
|
|
+ gdm_set_logout_action (GDM_LOGOUT_ACTION_REBOOT);
|
|
+ retval = TRUE;
|
|
+ break;
|
|
+ case GS_RESPONSE_LOCK:
|
|
+ g_spawn_command_line_async(
|
|
+ "gnome-screensaver-command --lock", NULL);
|
|
+ retval = FALSE;
|
|
+ break;
|
|
+ case GTK_RESPONSE_HELP:
|
|
+ gnome_help_display_desktop_on_screen (NULL, "user-guide",
|
|
+ "user-guide.xml",
|
|
+ "gosgetstarted-73",
|
|
+ screen,
|
|
+ &error);
|
|
+
|
|
+ if (error)
|
|
+ {
|
|
+ GtkWidget *dialog;
|
|
+
|
|
+ dialog = gtk_message_dialog_new (NULL,
|
|
+ GTK_DIALOG_DESTROY_WITH_PARENT,
|
|
+ GTK_MESSAGE_ERROR,
|
|
+ GTK_BUTTONS_CLOSE,
|
|
+ ("There was an error displaying help: \n%s"),
|
|
+ error->message);
|
|
+
|
|
+ g_signal_connect (G_OBJECT (dialog), "response",
|
|
+ G_CALLBACK (gtk_widget_destroy),
|
|
+ NULL);
|
|
+
|
|
+ gtk_window_set_screen (GTK_WINDOW (dialog), screen);
|
|
+
|
|
+ gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
|
|
+ gtk_widget_show (dialog);
|
|
+ g_error_free (error);
|
|
+ }
|
|
+
|
|
+ retval = FALSE;
|
|
+ break;
|
|
+ case GTK_RESPONSE_NONE:
|
|
+ case GTK_RESPONSE_DELETE_EVENT:
|
|
+ case GTK_RESPONSE_CANCEL:
|
|
+ retval = FALSE;
|
|
+ break;
|
|
+ default:
|
|
+ g_assert_not_reached();
|
|
+ }
|
|
|
|
return retval;
|
|
}
|