diff --git a/.gitattributes b/.gitattributes index b5117e0..9371149 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,5 +22,6 @@ *.zip filter=lfs diff=lfs merge=lfs -text *.zst filter=lfs diff=lfs merge=lfs -text ## Specific LFS patterns +gnome-session-sleep.svg filter=lfs diff=lfs merge=lfs -text suse-help.svg filter=lfs diff=lfs merge=lfs -text suse.svg filter=lfs diff=lfs merge=lfs -text diff --git a/gnome-session-bgo507101-tile-ui.patch b/gnome-session-bgo507101-tile-ui.patch new file mode 100644 index 0000000..247b178 --- /dev/null +++ b/gnome-session-bgo507101-tile-ui.patch @@ -0,0 +1,865 @@ +Index: gnome-session/gsm-manager.c +=================================================================== +--- gnome-session/gsm-manager.c (révision 5027) ++++ gnome-session/gsm-manager.c (copie de travail) +@@ -2178,7 +2178,8 @@ logout_dialog_response (GsmLogoutDialog + { + g_debug ("GsmManager: Logout dialog response: %d", response_id); + +- gtk_widget_destroy (GTK_WIDGET (logout_dialog)); ++ if (response_id != GTK_RESPONSE_HELP) ++ gtk_widget_destroy (GTK_WIDGET (logout_dialog)); + + /* In case of dialog cancel, switch user, hibernate and + * suspend, we just perform the respective action and return, +@@ -2188,6 +2189,10 @@ logout_dialog_response (GsmLogoutDialog + case GTK_RESPONSE_NONE: + case GTK_RESPONSE_DELETE_EVENT: + break; ++ case GTK_RESPONSE_HELP: ++ gsm_util_help_display (GTK_WINDOW (logout_dialog), ++ "gosgetstarted-73"); ++ break; + case GSM_LOGOUT_RESPONSE_SWITCH_USER: + request_switch_user (manager); + break; +Index: gnome-session/gsm-util.c +=================================================================== +--- gnome-session/gsm-util.c (révision 5027) ++++ gnome-session/gsm-util.c (copie de travail) +@@ -21,6 +21,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -288,3 +289,75 @@ gsm_util_setenv (const char *variable, + g_error_free (bus_error); + } + } ++ ++void ++gsm_util_help_display (GtkWindow *parent, ++ const char *link_id) ++{ ++ GError *error = NULL; ++ char *command; ++ const char *lang; ++ char *uri = NULL; ++ GdkScreen *gscreen; ++ gboolean found; ++ ++ int i; ++ ++ const char * const * langs = g_get_language_names (); ++ ++ uri = NULL; ++ found = FALSE; ++ ++ for (i = 0; langs[i]; i++) { ++ lang = langs[i]; ++ if (strchr (lang, '.')) { ++ continue; ++ } ++ ++ uri = g_build_filename (DATADIR, ++ "/gnome/help/user-guide/", ++ lang, ++ "/user-guide.xml", ++ NULL); ++ ++ if (g_file_test (uri, G_FILE_TEST_EXISTS)) { ++ found = TRUE; ++ break; ++ } ++ } ++ ++ if (found) { ++ if (link_id) { ++ command = g_strconcat ("gnome-open ghelp://", uri, "?", link_id, NULL); ++ } else { ++ command = g_strconcat ("gnome-open ghelp://", uri, NULL); ++ } ++ ++ gscreen = gdk_screen_get_default (); ++ gdk_spawn_command_line_on_screen (gscreen, command, &error); ++ } else ++ command = NULL; ++ ++ if (!found || error != NULL) { ++ GtkWidget *d; ++ const char *errmsg; ++ ++ if (!found) ++ errmsg = _("Cannot find help."); ++ else { ++ errmsg = error->message; ++ g_error_free (error); ++ } ++ ++ d = gtk_message_dialog_new (parent, ++ GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, ++ GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, ++ "%s", errmsg); ++ gtk_widget_show (GTK_WIDGET (d)); ++ g_signal_connect (d, "response", ++ G_CALLBACK (gtk_widget_destroy), NULL); ++ } ++ ++ g_free (command); ++ g_free (uri); ++} +Index: gnome-session/gsm-util.h +=================================================================== +--- gnome-session/gsm-util.h (révision 5027) ++++ gnome-session/gsm-util.h (copie de travail) +@@ -21,6 +21,7 @@ + #define __GSM_UTIL_H__ + + #include ++#include + + G_BEGIN_DECLS + +@@ -37,6 +38,9 @@ char * gsm_util_generate_startup_id + void gsm_util_setenv (const char *variable, + const char *value); + ++void gsm_util_help_display (GtkWindow *parent, ++ const char * link_id); ++ + G_END_DECLS + + #endif /* __GSM_UTIL_H__ */ +Index: gnome-session/test-logout.c +=================================================================== +--- gnome-session/test-logout.c (révision 0) ++++ gnome-session/test-logout.c (révision 0) +@@ -0,0 +1,117 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2008 Novell, Inc. ++ * ++ * This program is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, but ++ * WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, write to the Free Software ++ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA ++ * 02111-1307, USA. ++ * ++ */ ++ ++#include "config.h" ++ ++#include ++ ++#include ++ ++#include "gsm-logout-dialog.h" ++ ++static void ++logout_dialog_response (GsmLogoutDialog *logout_dialog, ++ guint response_id, ++ gpointer data) ++{ ++ /* In case of dialog cancel, switch user, hibernate and ++ * suspend, we just perform the respective action and return, ++ * without shutting down the session. */ ++ switch (response_id) { ++ case GTK_RESPONSE_CANCEL: ++ case GTK_RESPONSE_NONE: ++ case GTK_RESPONSE_DELETE_EVENT: ++ g_print ("Cancel\n"); ++ break; ++ case GTK_RESPONSE_HELP: ++ g_print ("Help\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_SWITCH_USER: ++ g_print ("Switch user\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_HIBERNATE: ++ g_print ("Hibernate\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_SLEEP: ++ g_print ("Suspend\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_SHUTDOWN: ++ g_print ("Shutdown\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_REBOOT: ++ g_print ("Reboot\n"); ++ break; ++ case GSM_LOGOUT_RESPONSE_LOGOUT: ++ g_print ("Logout\n"); ++ break; ++ default: ++ g_assert_not_reached (); ++ break; ++ } ++ ++ gtk_main_quit (); ++} ++ ++ ++int ++main (int argc, ++ char *argv[]) ++{ ++ GtkWidget *dialog; ++ GError *error; ++ ++ static gboolean logout; ++ static gboolean shutdown; ++ ++ static GOptionEntry entries[] = { ++ { "logout", 'l', 0, G_OPTION_ARG_NONE, &logout, "Test logout dialog", NULL }, ++ { "shutdown", 's', 0, G_OPTION_ARG_NONE, &shutdown, "Test shutdown dialog", NULL }, ++ { NULL, 0, 0, 0, NULL, NULL, NULL } ++ }; ++ ++ logout = shutdown = FALSE; ++ error = NULL; ++ ++ gtk_init_with_args (&argc, &argv, ++ (char *) " - test logout/shutdown dialogs", ++ entries, NULL, ++ &error); ++ if (error != NULL) { ++ g_warning ("%s", error->message); ++ g_error_free (error); ++ exit (1); ++ } ++ ++ if (!shutdown) ++ dialog = gsm_get_logout_dialog (gdk_screen_get_default (), ++ GDK_CURRENT_TIME); ++ else ++ dialog = gsm_get_shutdown_dialog (gdk_screen_get_default (), ++ GDK_CURRENT_TIME); ++ ++ g_signal_connect (dialog, "response", ++ G_CALLBACK (logout_dialog_response), NULL); ++ gtk_widget_show (dialog); ++ ++ gtk_main (); ++ ++ return 0; ++} +Index: gnome-session/Makefile.am +=================================================================== +--- gnome-session/Makefile.am (révision 5027) ++++ gnome-session/Makefile.am (copie de travail) +@@ -7,6 +7,7 @@ noinst_LTLIBRARIES = libgsmutil.la + noinst_PROGRAMS = \ + test-client-dbus \ + test-inhibit \ ++ test-logout \ + $(NULL) + + INCLUDES = \ +@@ -21,6 +22,7 @@ INCLUDES = \ + -DDATA_DIR=\""$(datadir)/gnome-session"\" \ + -DDBUS_LAUNCH=\"dbus-launch\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ ++ -DDATADIR=\""$(datadir)"\" \ + -DGLADEDIR=\""$(pkgdatadir)"\" \ + -DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \ + -DGCONFTOOL_CMD=\"$(GCONFTOOL)\" +@@ -42,6 +44,24 @@ test_client_dbus_LDADD = \ + $(DBUS_GLIB_LIBS) \ + $(NULL) + ++test_logout_SOURCES = \ ++ test-logout.c \ ++ gdm.c \ ++ gdm.h \ ++ gsm-consolekit.c \ ++ gsm-consolekit.h \ ++ gsm-logout-dialog.c \ ++ gsm-logout-dialog.h \ ++ gsm-power-manager.c \ ++ gsm-power-manager.h \ ++ $(NULL) ++ ++test_logout_LDADD = \ ++ $(GNOME_SESSION_LIBS) \ ++ $(DBUS_GLIB_LIBS) \ ++ $(POLKIT_GNOME_LIBS) \ ++ $(NULL) ++ + gnome_session_LDADD = \ + -lSM -lICE \ + libgsmutil.la \ +Index: gnome-session/gsm-logout-dialog.c +=================================================================== +--- gnome-session/gsm-logout-dialog.c (révision 5027) ++++ gnome-session/gsm-logout-dialog.c (copie de travail) +@@ -37,8 +37,13 @@ + + #define AUTOMATIC_ACTION_TIMEOUT 60 + +-#define GSM_ICON_LOGOUT "system-log-out" +-#define GSM_ICON_SHUTDOWN "system-shutdown" ++#define GSM_ICON_LOGOUT "system-log-out" ++#define GSM_ICON_SWITCH "system-users" ++#define GSM_ICON_SHUTDOWN "system-shutdown" ++#define GSM_ICON_REBOOT "view-refresh" ++/* TODO: use gpm icons? */ ++#define GSM_ICON_HIBERNATE "drive-harddisk" ++#define GSM_ICON_SLEEP "gnome-session-sleep" + + typedef enum { + GSM_DIALOG_LOGOUT_TYPE_LOGOUT, +@@ -47,11 +52,12 @@ typedef enum { + + struct _GsmLogoutDialogPrivate + { +- GsmDialogLogoutType type; +- + GsmPowerManager *power_manager; + GsmConsolekit *consolekit; + ++ GtkWidget *info_label; ++ GtkWidget *cancel_button; ++ + int timeout; + unsigned int timeout_id; + +@@ -60,7 +66,8 @@ struct _GsmLogoutDialogPrivate + + static GsmLogoutDialog *current_dialog = NULL; + +-static void gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog); ++static void gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog, ++ int seconds); + + static void gsm_logout_dialog_destroy (GsmLogoutDialog *logout_dialog, + gpointer data); +@@ -68,43 +75,10 @@ static void gsm_logout_dialog_destroy ( + static void gsm_logout_dialog_show (GsmLogoutDialog *logout_dialog, + gpointer data); + +-enum { +- PROP_0, +- PROP_MESSAGE_TYPE +-}; +- +-G_DEFINE_TYPE (GsmLogoutDialog, gsm_logout_dialog, GTK_TYPE_MESSAGE_DIALOG); ++static void gsm_logout_set_info_text (GsmLogoutDialog *logout_dialog, ++ int seconds); + +-static void +-gsm_logout_dialog_set_property (GObject *object, +- guint prop_id, +- const GValue *value, +- GParamSpec *pspec) +-{ +- switch (prop_id) { +- case PROP_MESSAGE_TYPE: +- break; +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} +- +-static void +-gsm_logout_dialog_get_property (GObject *object, +- guint prop_id, +- GValue *value, +- GParamSpec *pspec) +-{ +- switch (prop_id) { +- case PROP_MESSAGE_TYPE: +- g_value_set_enum (value, GTK_MESSAGE_WARNING); +- break; +- default: +- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); +- break; +- } +-} ++G_DEFINE_TYPE (GsmLogoutDialog, gsm_logout_dialog, GTK_TYPE_DIALOG); + + static void + gsm_logout_dialog_class_init (GsmLogoutDialogClass *klass) +@@ -113,18 +87,6 @@ gsm_logout_dialog_class_init (GsmLogoutD + + gobject_class = G_OBJECT_CLASS (klass); + +- /* This is a workaround to avoid a stupid crash: libgnomeui +- * listens for the "show" signal on all GtkMessageDialog and +- * gets the "message-type" of the dialogs. We will crash when +- * it accesses this property if we don't override it since we +- * didn't define it. */ +- gobject_class->set_property = gsm_logout_dialog_set_property; +- gobject_class->get_property = gsm_logout_dialog_get_property; +- +- g_object_class_override_property (gobject_class, +- PROP_MESSAGE_TYPE, +- "message-type"); +- + g_type_class_add_private (klass, sizeof (GsmLogoutDialogPrivate)); + } + +@@ -146,11 +108,23 @@ gsm_logout_dialog_init (GsmLogoutDialog + logout_dialog->priv->timeout_id = 0; + logout_dialog->priv->timeout = 0; + logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL; ++ logout_dialog->priv->info_label = NULL; + +- gtk_window_set_skip_taskbar_hint (GTK_WINDOW (logout_dialog), TRUE); ++ gtk_window_set_resizable (GTK_WINDOW (logout_dialog), FALSE); ++ gtk_dialog_set_has_separator (GTK_DIALOG (logout_dialog), FALSE); + gtk_window_set_keep_above (GTK_WINDOW (logout_dialog), TRUE); + gtk_window_stick (GTK_WINDOW (logout_dialog)); + ++ /* use HIG spacings */ ++ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (logout_dialog)->vbox), 12); ++ gtk_container_set_border_width (GTK_CONTAINER (logout_dialog), 6); ++ ++ gtk_dialog_add_button (GTK_DIALOG (logout_dialog), GTK_STOCK_HELP, ++ GTK_RESPONSE_HELP); ++ logout_dialog->priv->cancel_button = ++ gtk_dialog_add_button (GTK_DIALOG (logout_dialog), ++ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); ++ + logout_dialog->priv->power_manager = gsm_get_power_manager (); + + logout_dialog->priv->consolekit = gsm_get_consolekit (); +@@ -247,17 +221,76 @@ gsm_logout_supports_shutdown (GsmLogoutD + } + + static void +-gsm_logout_dialog_show (GsmLogoutDialog *logout_dialog, gpointer user_data) ++gsm_logout_dialog_show (GsmLogoutDialog *logout_dialog, ++ gpointer user_data) ++{ ++ gsm_logout_set_info_text (logout_dialog, AUTOMATIC_ACTION_TIMEOUT); ++ ++ if (logout_dialog->priv->default_response != GTK_RESPONSE_CANCEL) ++ gsm_logout_dialog_set_timeout (logout_dialog, ++ AUTOMATIC_ACTION_TIMEOUT); ++} ++ ++static void ++gsm_logout_set_info_text (GsmLogoutDialog *logout_dialog, ++ int seconds) + { +- gsm_logout_dialog_set_timeout (logout_dialog); ++ const char *info_text; ++ char *buf; ++ char *markup; ++ const char *name; ++ ++ switch (logout_dialog->priv->default_response) { ++ case GSM_LOGOUT_RESPONSE_LOGOUT: ++ info_text = ngettext ("You are currently logged in as " ++ "\"%s\".\n" ++ "You will be automatically logged out " ++ "in %d second.", ++ "You are currently logged in as " ++ "\"%s\".\n" ++ "You will be automatically logged out " ++ "in %d seconds.", ++ seconds); ++ break; ++ ++ case GSM_LOGOUT_RESPONSE_SHUTDOWN: ++ info_text = ngettext ("You are currently logged in as " ++ "\"%s\".\n" ++ "This system will be automatically shut " ++ "down in %d second.", ++ "You are currently logged in as " ++ "\"%s\".\n" ++ "This system will be automatically shut " ++ "down in %d seconds.", ++ seconds); ++ break; ++ ++ case GTK_RESPONSE_CANCEL: ++ info_text = _("You are currently logged in as \"%s\".\n"); ++ break; ++ ++ default: ++ g_assert_not_reached (); ++ } ++ ++ name = g_get_real_name (); ++ ++ if (!name || name[0] == '\0') { ++ name = g_get_user_name (); ++ } ++ ++ buf = g_strdup_printf (info_text, name, seconds); ++ markup = g_markup_printf_escaped ("%s", buf); ++ g_free (buf); ++ gtk_label_set_markup (GTK_LABEL (logout_dialog->priv->info_label), ++ markup); ++ g_free (markup); + } + + static gboolean + gsm_logout_dialog_timeout (gpointer data) + { + GsmLogoutDialog *logout_dialog; +- char *secondary_text; +- const char *name; + int seconds_to_show; + + logout_dialog = (GsmLogoutDialog *) data; +@@ -278,46 +311,7 @@ gsm_logout_dialog_timeout (gpointer data + seconds_to_show += 10; + } + +- switch (logout_dialog->priv->type) { +- case GSM_DIALOG_LOGOUT_TYPE_LOGOUT: +- secondary_text = ngettext ("You are currently logged in as " +- "\"%s\".\n" +- "You will be automatically logged " +- "out in %d second.", +- "You are currently logged in as " +- "\"%s\".\n" +- "You will be automatically logged " +- "out in %d seconds.", +- seconds_to_show); +- break; +- +- case GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN: +- secondary_text = ngettext ("You are currently logged in as " +- "\"%s\".\n" +- "This system will be automatically " +- "shut down in %d second.", +- "You are currently logged in as " +- "\"%s\".\n" +- "This system will be automatically " +- "shut down in %d seconds.", +- seconds_to_show); +- break; +- +- default: +- g_assert_not_reached (); +- } +- +- name = g_get_real_name (); +- +- if (!name || name[0] == '\0') { +- name = g_get_user_name (); +- } +- +- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (logout_dialog), +- secondary_text, +- name, +- seconds_to_show, +- NULL); ++ gsm_logout_set_info_text (logout_dialog, seconds_to_show); + + logout_dialog->priv->timeout--; + +@@ -325,12 +319,10 @@ gsm_logout_dialog_timeout (gpointer data + } + + static void +-gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog) ++gsm_logout_dialog_set_timeout (GsmLogoutDialog *logout_dialog, ++ int seconds) + { +- logout_dialog->priv->timeout = AUTOMATIC_ACTION_TIMEOUT; +- +- /* Sets the secondary text */ +- gsm_logout_dialog_timeout (logout_dialog); ++ logout_dialog->priv->timeout = seconds; + + if (logout_dialog->priv->timeout_id != 0) { + g_source_remove (logout_dialog->priv->timeout_id); +@@ -342,13 +334,118 @@ gsm_logout_dialog_set_timeout (GsmLogout + } + + static GtkWidget * ++gsm_logout_tile_new (const char *icon_name, ++ const char *title, ++ const char *description) ++{ ++ GtkWidget *button; ++ GtkWidget *alignment; ++ GtkWidget *hbox; ++ GtkWidget *vbox; ++ GtkWidget *image; ++ GtkWidget *label; ++ char *markup; ++ ++ g_assert (title != NULL); ++ ++ button = GTK_WIDGET (gtk_button_new ()); ++ gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); ++ ++ 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); ++ ++ hbox = gtk_hbox_new (FALSE, 12); ++ gtk_container_add (GTK_CONTAINER (alignment), hbox); ++ if (icon_name != NULL) { ++ image = gtk_image_new_from_icon_name (icon_name, ++ GTK_ICON_SIZE_DIALOG); ++ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0); ++ } ++ ++ vbox = gtk_vbox_new (FALSE, 2); ++ ++ markup = g_markup_printf_escaped ("%s", ++ title); ++ label = gtk_label_new (markup); ++ g_free (markup); ++ ++ 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 (description != NULL) { ++ gchar *markup; ++ GdkColor *color; ++ GtkWidget *label; ++ ++ color = >K_WIDGET (button)->style->fg[GTK_STATE_INSENSITIVE]; ++ markup = g_markup_printf_escaped ("%s", ++ color->red, ++ color->green, ++ color->blue, ++ description); ++ label = gtk_label_new (markup); ++ g_free (markup); ++ ++ 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); ++ ++ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); ++ } ++ ++ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0); ++ ++ return button; ++} ++ ++static void ++gsm_logout_tile_clicked (GtkWidget *tile, ++ gpointer response_p) ++{ ++ GtkWidget *dialog; ++ ++ dialog = gtk_widget_get_toplevel (tile); ++ g_assert (GTK_IS_DIALOG (dialog)); ++ gtk_dialog_response (GTK_DIALOG (dialog), ++ GPOINTER_TO_UINT (response_p)); ++} ++ ++static GtkWidget * ++gsm_logout_append_tile (GtkWidget *vbox, ++ unsigned int response, ++ const char *icon_name, ++ const char *title, ++ const char *description) ++{ ++ GtkWidget *tile; ++ ++ tile = gsm_logout_tile_new (icon_name, title, description); ++ gtk_box_pack_start (GTK_BOX (vbox), tile, TRUE, TRUE, 0); ++ gtk_widget_show_all (tile); ++ ++ g_signal_connect (tile, ++ "clicked", ++ G_CALLBACK (gsm_logout_tile_clicked), ++ GUINT_TO_POINTER (response)); ++ ++ return tile; ++} ++ ++static GtkWidget * + gsm_get_dialog (GsmDialogLogoutType type, + GdkScreen *screen, + guint32 activate_time) + { + GsmLogoutDialog *logout_dialog; +- const char *primary_text; ++ GtkWidget *vbox; ++ GtkWidget *tile; + const char *icon_name; ++ const char *title; + + if (current_dialog != NULL) { + gtk_widget_destroy (GTK_WIDGET (current_dialog)); +@@ -358,82 +455,119 @@ gsm_get_dialog (GsmDialogLogoutType type + + current_dialog = logout_dialog; + +- gtk_window_set_title (GTK_WINDOW (logout_dialog), ""); +- +- logout_dialog->priv->type = type; ++ vbox = gtk_vbox_new (FALSE, 12); ++ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (logout_dialog)->vbox), vbox, ++ FALSE, FALSE, 0); ++ gtk_container_set_border_width (GTK_CONTAINER (vbox), 6); ++ gtk_widget_show (vbox); + + icon_name = NULL; +- primary_text = NULL; ++ title = NULL; + + switch (type) { + case GSM_DIALOG_LOGOUT_TYPE_LOGOUT: + icon_name = GSM_ICON_LOGOUT; +- primary_text = _("Log out of this system now?"); ++ title = _("Log Out of the Session"); + + logout_dialog->priv->default_response = GSM_LOGOUT_RESPONSE_LOGOUT; + +- if (gsm_logout_supports_switch_user (logout_dialog)) { +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), ++ ++ gsm_logout_append_tile (vbox, GSM_LOGOUT_RESPONSE_LOGOUT, ++ GSM_ICON_LOGOUT, _("_Log Out"), ++ _("Ends your session and logs you " ++ "out.")); ++ ++ tile = gsm_logout_append_tile (vbox, ++ GSM_LOGOUT_RESPONSE_SWITCH_USER, ++ GSM_ICON_SWITCH, + _("_Switch User"), +- GSM_LOGOUT_RESPONSE_SWITCH_USER); ++ _("Suspends your session, " ++ "allowing another user to " ++ "log in and use the " ++ "computer.")); ++ if (!gsm_logout_supports_switch_user (logout_dialog)) { ++ gtk_widget_set_sensitive (tile, FALSE); + } + +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- GTK_STOCK_CANCEL, +- GTK_RESPONSE_CANCEL); +- +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- _("_Log Out"), +- GSM_LOGOUT_RESPONSE_LOGOUT); +- + break; + case GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN: + icon_name = GSM_ICON_SHUTDOWN; +- primary_text = _("Shut down this system now?"); ++ title = _("Shut Down the Computer"); + + logout_dialog->priv->default_response = GSM_LOGOUT_RESPONSE_SHUTDOWN; + +- if (gsm_logout_supports_system_suspend (logout_dialog)) { +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- _("S_uspend"), +- GSM_LOGOUT_RESPONSE_SLEEP); ++ tile = gsm_logout_append_tile (vbox, ++ GSM_LOGOUT_RESPONSE_SHUTDOWN, ++ GSM_ICON_SHUTDOWN, ++ _("_Shut Down"), ++ _("Ends your session and turns " ++ "off the computer.")); ++ if (!gsm_logout_supports_shutdown (logout_dialog)) { ++ gtk_widget_set_sensitive (tile, FALSE); ++ /* If shutdown is not available, let's just fallback ++ * on cancel as the default action. We could fallback ++ * on reboot first, then suspend and then hibernate ++ * but it's not that useful, really */ ++ logout_dialog->priv->default_response = GTK_RESPONSE_CANCEL; + } + +- if (gsm_logout_supports_system_hibernate (logout_dialog)) { +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- _("_Hibernate"), +- GSM_LOGOUT_RESPONSE_HIBERNATE); ++ tile = gsm_logout_append_tile (vbox, ++ GSM_LOGOUT_RESPONSE_REBOOT, ++ GSM_ICON_REBOOT, _("_Restart"), ++ _("Ends your session and " ++ "restarts the computer.")); ++ if (!gsm_logout_supports_reboot (logout_dialog)) { ++ gtk_widget_set_sensitive (tile, FALSE); + } + +- if (gsm_logout_supports_reboot (logout_dialog)) { +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- _("_Restart"), +- GSM_LOGOUT_RESPONSE_REBOOT); ++ /* We don't set those options insensitive if they are no ++ * supported (like we do for shutdown/restart) since some ++ * hardware just don't support suspend/hibernate. So we ++ * don't show those options in this case. */ ++ if (gsm_logout_supports_system_suspend (logout_dialog)) { ++ gsm_logout_append_tile (vbox, ++ GSM_LOGOUT_RESPONSE_SLEEP, ++ GSM_ICON_SLEEP, _("S_uspend"), ++ _("Suspends your session " ++ "quickly, using minimal " ++ "power while the computer " ++ "stands by.")); + } + +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- GTK_STOCK_CANCEL, +- GTK_RESPONSE_CANCEL); +- +- if (gsm_logout_supports_shutdown (logout_dialog)) { +- gtk_dialog_add_button (GTK_DIALOG (logout_dialog), +- _("_Shut Down"), +- GSM_LOGOUT_RESPONSE_SHUTDOWN); ++ if (gsm_logout_supports_system_hibernate (logout_dialog)) { ++ gsm_logout_append_tile (vbox, ++ GSM_LOGOUT_RESPONSE_HIBERNATE, ++ GSM_ICON_HIBERNATE, ++ _("_Hibernate"), ++ _("Suspends your session, " ++ "using no power until the " ++ "computer is restarted.")); + } ++ + break; + default: + g_assert_not_reached (); + } + +- gtk_image_set_from_icon_name (GTK_IMAGE (GTK_MESSAGE_DIALOG (logout_dialog)->image), +- icon_name, GTK_ICON_SIZE_DIALOG); ++ logout_dialog->priv->info_label = gtk_label_new (""); ++ gtk_label_set_line_wrap (GTK_LABEL (logout_dialog->priv->info_label), ++ TRUE); ++ gtk_box_pack_start (GTK_BOX (vbox), logout_dialog->priv->info_label, ++ TRUE, TRUE, 0); ++ gtk_widget_show (logout_dialog->priv->info_label); ++ + gtk_window_set_icon_name (GTK_WINDOW (logout_dialog), icon_name); +- gtk_window_set_position (GTK_WINDOW (logout_dialog), GTK_WIN_POS_CENTER_ALWAYS); +- gtk_label_set_text (GTK_LABEL (GTK_MESSAGE_DIALOG (logout_dialog)->label), +- primary_text); ++ gtk_window_set_title (GTK_WINDOW (logout_dialog), title); ++ gtk_window_set_position (GTK_WINDOW (logout_dialog), ++ GTK_WIN_POS_CENTER_ALWAYS); + + gtk_dialog_set_default_response (GTK_DIALOG (logout_dialog), + logout_dialog->priv->default_response); ++ /* Note that focus is on the widget for the default response by default ++ * (since they're the first widget, except when it's Cancel */ ++ if (logout_dialog->priv->default_response == GTK_RESPONSE_CANCEL) ++ gtk_window_set_focus (GTK_WINDOW (logout_dialog), ++ logout_dialog->priv->cancel_button); + + gtk_window_set_screen (GTK_WINDOW (logout_dialog), screen); + diff --git a/gnome-session-bgo550211-gnome-session-save-logout.patch b/gnome-session-bgo550211-gnome-session-save-logout.patch new file mode 100644 index 0000000..7b33d7e --- /dev/null +++ b/gnome-session-bgo550211-gnome-session-save-logout.patch @@ -0,0 +1,110 @@ +Index: tools/gnome-session-save.c +=================================================================== +--- tools/gnome-session-save.c (révision 5026) ++++ tools/gnome-session-save.c (copie de travail) +@@ -38,7 +38,10 @@ + #define GSM_INTERFACE_DBUS "org.gnome.SessionManager" + + /* True if killing. */ +-static gboolean do_logout = FALSE; ++static gboolean kill = FALSE; ++ ++static gboolean logout_dialog = FALSE; ++static gboolean shutdown_dialog = FALSE; + + /* True if we should use dialog boxes */ + static gboolean gui = FALSE; +@@ -50,7 +53,9 @@ static char *session_name = NULL; + + static GOptionEntry options[] = { + {"session-name", 's', 0, G_OPTION_ARG_STRING, &session_name, N_("Set the current session name"), N_("NAME")}, +- {"kill", '\0', 0, G_OPTION_ARG_NONE, &do_logout, N_("Kill session"), NULL}, ++ {"logout-dialog", '\0', 0, G_OPTION_ARG_NONE, &logout_dialog, N_("Show logout dialog"), NULL}, ++ {"shutdown-dialog", '\0', 0, G_OPTION_ARG_NONE, &shutdown_dialog, N_("Show shutdown dialog"), NULL}, ++ {"kill", '\0', 0, G_OPTION_ARG_NONE, &kill, N_("Kill session"), NULL}, + {"gui", '\0', 0, G_OPTION_ARG_NONE, &gui, N_("Use dialog boxes for errors"), NULL}, + {"silent", '\0', 0, G_OPTION_ARG_NONE, &silent, N_("Do not require confirmation"), NULL}, + {NULL} +@@ -208,10 +213,58 @@ logout_session (gboolean show_confirmati + } + } + ++static void ++do_shutdown_dialog (void) ++{ ++ DBusGConnection *bus; ++ DBusGProxy *sm_proxy; ++ GError *error; ++ gboolean res; ++ ++ sm_proxy = NULL; ++ ++ bus = get_session_bus (); ++ if (bus == NULL) { ++ display_error (_("Could not connect to the session manager")); ++ goto out; ++ } ++ ++ sm_proxy = get_sm_proxy (bus); ++ if (sm_proxy == NULL) { ++ display_error (_("Could not connect to the session manager")); ++ goto out; ++ } ++ ++ error = NULL; ++ res = dbus_g_proxy_call (sm_proxy, ++ "Shutdown", ++ &error, ++ G_TYPE_INVALID, ++ G_TYPE_INVALID); ++ ++ if (!res) { ++ if (error != NULL) { ++ g_warning ("Failed to call shutdown: %s", ++ error->message); ++ g_error_free (error); ++ } else { ++ g_warning ("Failed to call shutdown"); ++ } ++ ++ goto out; ++ } ++ ++ out: ++ if (sm_proxy != NULL) { ++ g_object_unref (sm_proxy); ++ } ++} ++ + int + main (int argc, char *argv[]) + { + GError *error; ++ int conflicting_options; + + /* Initialize the i18n stuff */ + bindtextdomain (GETTEXT_PACKAGE, LOCALE_DIR); +@@ -225,8 +278,22 @@ main (int argc, char *argv[]) + exit (1); + } + +- if (do_logout) { ++ conflicting_options = 0; ++ if (kill) ++ conflicting_options++; ++ if (logout_dialog) ++ conflicting_options++; ++ if (shutdown_dialog) ++ conflicting_options++; ++ if (conflicting_options > 1) ++ display_error (_("Program called with conflicting options")); ++ ++ if (kill) { + logout_session (! silent); ++ } else if (logout_dialog) { ++ logout_session (TRUE); ++ } else if (shutdown_dialog) { ++ do_shutdown_dialog (); + } + + return exit_status; diff --git a/gnome-session-sleep.svg b/gnome-session-sleep.svg new file mode 100644 index 0000000..6a593e7 --- /dev/null +++ b/gnome-session-sleep.svg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:ab422ac8218380c08f22c285714b2a837ee9bee123553c3f80d5d0047cd4827c +size 8154 diff --git a/gnome-session-tile-ui.patch b/gnome-session-tile-ui.patch deleted file mode 100644 index aa7c250..0000000 --- a/gnome-session-tile-ui.patch +++ /dev/null @@ -1,622 +0,0 @@ ---- 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 ("%s", 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 ("%s", 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 ("%s", -+ 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; - } diff --git a/gnome-session.changes b/gnome-session.changes index 68f237d..b4e96f3 100644 --- a/gnome-session.changes +++ b/gnome-session.changes @@ -1,3 +1,17 @@ +------------------------------------------------------------------- +Mon Sep 1 16:25:49 CEST 2008 - vuntz@novell.com + +- Remove gnome-session-tile-ui.patch and add instead + gnome-session-bgo507101-tile-ui.patch that implements the + tile-based logout dialog. It's a patch I did for upstream. +- Add gnome-session-sleep.svg as a temporary suspend icon. It + comes from libssui. We'll be able to remove it when upstream + ships with a suspend icon in gnome-icon-theme. +- Add gnome-session-bgo550211-gnome-session-save-logout.patch to + add gnome-session-save command line options. +- The goal of this update is to make it possible to get rid of + libssui. + ------------------------------------------------------------------- Thu Aug 21 14:51:09 CEST 2008 - vuntz@novell.com diff --git a/gnome-session.spec b/gnome-session.spec index dd5553b..e8e2981 100644 --- a/gnome-session.spec +++ b/gnome-session.spec @@ -23,7 +23,7 @@ BuildRequires: control-center2-devel fdupes gnome-common gnome-desktop-devel gn License: GPL v2 or later; LGPL v2.1 or later Group: System/GUI/GNOME Version: 2.23.90 -Release: 1 +Release: 8 Summary: Session Tools for the GNOME 2.x Desktop Url: http://www.gnome.org Source: %{name}-%{version}.tar.bz2 @@ -37,21 +37,24 @@ Source4: SuSE.desktop Source5: suse-help.svg #PATCH-FIX-OPENSUSE Install files needed by /usr/bin/gnome suse.svg bnc388735 sbrabec@suse.cz Source6: suse.svg +# Temporarly needed until we get upstream to ship the right icon for suspend +Source7: gnome-session-sleep.svg # PATCH-FIX-UPSTREAM gnome-session-ice-auth-for-suid.patch hpj@novell.com -- Carries ICE auth over to other UIDs in this session using an env var. Patch0: gnome-session-ice-auth-for-suid.patch # PATCH-FIX-UPSTREAM gnome-session-kdm-support.patch hpj@novell.com -- Adds support for KDM logout commands. Patch1: gnome-session-kdm-support.patch #PATCH-FIX-OPENSUSE gnome-session-wm-switch.patch bnc180506 danw@novell.com -- Fixes legacy sessions to use gnome-wm instead of metacity/compiz. Patch2: gnome-session-wm-switch.patch -#PATCH-NEEDS-REBASE (was: #PATCH-FEATURE-OPENSUSE gnome-session-tile-ui.patch cgaisford@novell.com -- Feature from SLED 10 SP1) -# Not sure about this one. Needs major porting. -Patch3: gnome-session-tile-ui.patch +#PATCH-FIX-UPSTREAM gnome-session-bgo507101-tile-ui.patch bgo507101 vuntz@novell.com -- Tile UI for logout dialog +Patch3: gnome-session-bgo507101-tile-ui.patch #PATCH-FEATURE-OPENSUSE gnome-session-gnome-wm-compiz-manager.patch vuntz@novell.com -- Launch compiz-manager when configured. Patch4: gnome-session-gnome-wm-compiz-manager.patch #PATCH-FIX-OPENSUSE gnome-session-bnc389137-splash-layout.patch bnc389137 vuntz@novell.com -- Improve layout with our splash screen. Patch5: gnome-session-bnc389137-splash-layout.patch #PATCH-FIX-UPSTREAM gnome-session-launch-dbus.patch bgo546863 vuntz@novell.com -- Launch dbus if it's not already running Patch6: gnome-session-launch-dbus.patch +#PATCH-FIX-UPSTREAM gnome-session-bgo550211-gnome-session-save-logout.patch bgo550211 vuntz@novell.com -- Add --{logout,shutdown}-dialog to gnome-session-save +Patch7: gnome-session-bgo550211-gnome-session-save-logout.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Recommends: control-center2 Obsoletes: gnome-core @@ -111,10 +114,11 @@ Authors: %patch0 -p1 %patch1 -p1 %patch2 -p1 -# %patch3 -p1 +%patch3 -p0 %patch4 -p1 %patch5 -p1 %patch6 +%patch7 -p0 #gnome-patch-translation-update %build @@ -134,6 +138,7 @@ install -d -m755 $RPM_BUILD_ROOT%{_bindir} install -m755 %SOURCE1 $RPM_BUILD_ROOT%{_bindir}/gnome install -d -m755 $RPM_BUILD_ROOT%{_datadir}/xsessions install -m644 %SOURCE2 $RPM_BUILD_ROOT%{_datadir}/xsessions/gnome.desktop +install -m644 %{S:7} $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/scalable/apps/ %suse_update_desktop_file session-properties X-SuSE-ControlCenter-System %find_lang %{name}-2.0 %find_gconf_schemas @@ -183,6 +188,17 @@ rm -rf $RPM_BUILD_ROOT %files lang -f %{name}-2.0.lang %changelog +* Mon Sep 01 2008 vuntz@novell.com +- Remove gnome-session-tile-ui.patch and add instead + gnome-session-bgo507101-tile-ui.patch that implements the + tile-based logout dialog. It's a patch I did for upstream. +- Add gnome-session-sleep.svg as a temporary suspend icon. It + comes from libssui. We'll be able to remove it when upstream + ships with a suspend icon in gnome-icon-theme. +- Add gnome-session-bgo550211-gnome-session-save-logout.patch to + add gnome-session-save command line options. +- The goal of this update is to make it possible to get rid of + libssui. * Thu Aug 21 2008 vuntz@novell.com - Update to version 2.23.90: + Remove inhibitors for the client when it disconnects