gnome-session/gnome-session-bgo507101-tile-ui.patch
Vincent Untz e113dfc3af Accepting request 44653 from home:vuntz:branches:GNOME:Factory
Copy from home:vuntz:branches:GNOME:Factory/gnome-session via accept of submit request 44653 revision 2.
Request was accepted with message:
ok

OBS-URL: https://build.opensuse.org/request/show/44653
OBS-URL: https://build.opensuse.org/package/show/GNOME:Factory/gnome-session?expand=0&rev=94
2010-08-06 07:52:56 +00:00

708 lines
28 KiB
Diff

Index: gnome-session/gsm-manager.c
===================================================================
--- gnome-session/gsm-manager.c.orig
+++ gnome-session/gsm-manager.c
@@ -2748,7 +2748,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,
@@ -2758,6 +2759,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.orig
+++ gnome-session/gsm-util.c
@@ -21,6 +21,7 @@
#include <config.h>
#include <stdlib.h>
#include <ctype.h>
+#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/time.h>
@@ -503,3 +504,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.orig
+++ gnome-session/gsm-util.h
@@ -21,6 +21,7 @@
#define __GSM_UTIL_H__
#include <glib.h>
+#include <gtk/gtk.h>
G_BEGIN_DECLS
@@ -47,6 +48,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/Makefile.am
===================================================================
--- gnome-session/Makefile.am.orig
+++ gnome-session/Makefile.am
@@ -22,6 +22,7 @@ INCLUDES = \
-DDATA_DIR=\""$(datadir)/gnome-session"\" \
-DDBUS_LAUNCH=\"dbus-launch\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
+ -DDATADIR=\""$(datadir)"\" \
-DGTKBUILDER_DIR=\""$(pkgdatadir)"\" \
-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
-DGCONFTOOL_CMD=\"$(GCONFTOOL)\" \
Index: gnome-session/gsm-logout-dialog.c
===================================================================
--- gnome-session/gsm-logout-dialog.c.orig
+++ gnome-session/gsm-logout-dialog.c
@@ -38,8 +38,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,
@@ -48,11 +53,12 @@ typedef enum {
struct _GsmLogoutDialogPrivate
{
- GsmDialogLogoutType type;
-
UpClient *up_client;
GsmConsolekit *consolekit;
+ GtkWidget *info_label;
+ GtkWidget *cancel_button;
+
int timeout;
unsigned int timeout_id;
@@ -61,7 +67,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);
@@ -69,43 +76,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)
@@ -114,18 +88,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));
}
@@ -137,11 +99,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->up_client = up_client_new ();
logout_dialog->priv->consolekit = gsm_get_consolekit ();
@@ -237,40 +211,28 @@ 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_dialog_set_timeout (logout_dialog);
+ 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 gboolean
-gsm_logout_dialog_timeout (gpointer data)
+static void
+gsm_logout_set_info_text (GsmLogoutDialog *logout_dialog,
+ int seconds_to_show)
{
- GsmLogoutDialog *logout_dialog;
- char *seconds_warning;
- char *secondary_text;
- int seconds_to_show;
- static char *session_type = NULL;
+ const char *seconds_warning;
+ char *secondary_text;
+ char *buf;
+ char *markup;
+ static char *session_type = NULL;
- logout_dialog = (GsmLogoutDialog *) data;
-
- if (!logout_dialog->priv->timeout) {
- gtk_dialog_response (GTK_DIALOG (logout_dialog),
- logout_dialog->priv->default_response);
-
- return FALSE;
- }
-
- if (logout_dialog->priv->timeout <= 30) {
- seconds_to_show = logout_dialog->priv->timeout;
- } else {
- seconds_to_show = (logout_dialog->priv->timeout/10) * 10;
-
- if (logout_dialog->priv->timeout % 10)
- seconds_to_show += 10;
- }
-
- switch (logout_dialog->priv->type) {
- case GSM_DIALOG_LOGOUT_TYPE_LOGOUT:
+ switch (logout_dialog->priv->default_response) {
+ case GSM_LOGOUT_RESPONSE_LOGOUT:
seconds_warning = ngettext ("You will be automatically logged "
"out in %d second.",
"You will be automatically logged "
@@ -278,7 +240,7 @@ gsm_logout_dialog_timeout (gpointer data
seconds_to_show);
break;
- case GSM_DIALOG_LOGOUT_TYPE_SHUTDOWN:
+ case GSM_LOGOUT_RESPONSE_SHUTDOWN:
seconds_warning = ngettext ("This system will be automatically "
"shut down in %d second.",
"This system will be automatically "
@@ -286,6 +248,10 @@ gsm_logout_dialog_timeout (gpointer data
seconds_to_show);
break;
+ case GTK_RESPONSE_CANCEL:
+ seconds_warning = "";
+ break;
+
default:
g_assert_not_reached ();
}
@@ -320,25 +286,50 @@ gsm_logout_dialog_timeout (gpointer data
secondary_text = g_strdup (seconds_warning);
}
- gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (logout_dialog),
- secondary_text,
- seconds_to_show,
- NULL);
+ buf = g_strdup_printf (secondary_text, seconds_to_show);
+ markup = g_markup_printf_escaped ("<i>%s</i>", buf);
+ g_free (buf);
+ gtk_label_set_markup (GTK_LABEL (logout_dialog->priv->info_label),
+ markup);
+ g_free (markup);
+}
- logout_dialog->priv->timeout--;
+static gboolean
+gsm_logout_dialog_timeout (gpointer data)
+{
+ GsmLogoutDialog *logout_dialog;
+ int seconds_to_show;
+
+ logout_dialog = (GsmLogoutDialog *) data;
+
+ if (!logout_dialog->priv->timeout) {
+ gtk_dialog_response (GTK_DIALOG (logout_dialog),
+ logout_dialog->priv->default_response);
+
+ return FALSE;
+ }
+
+ if (logout_dialog->priv->timeout <= 30) {
+ seconds_to_show = logout_dialog->priv->timeout;
+ } else {
+ seconds_to_show = (logout_dialog->priv->timeout/10) * 10;
+
+ if (logout_dialog->priv->timeout % 10)
+ seconds_to_show += 10;
+ }
+
+ gsm_logout_set_info_text (logout_dialog, seconds_to_show);
- g_free (secondary_text);
+ logout_dialog->priv->timeout--;
return TRUE;
}
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);
@@ -350,14 +341,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 ("<span weight=\"bold\">%s</span>",
+ 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 = &GTK_WIDGET (button)->style->fg[GTK_STATE_INSENSITIVE];
+ markup = g_markup_printf_escaped ("<span size=\"small\" foreground=\"#%.2x%.2x%.2x\">%s</span>",
+ 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;
- GtkWidget *dialog_image;
- 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));
@@ -367,83 +462,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 ();
}
- dialog_image = gtk_message_dialog_get_image (GTK_MESSAGE_DIALOG (logout_dialog));
-
- gtk_image_set_from_icon_name (GTK_IMAGE (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_message_dialog_set_markup (GTK_MESSAGE_DIALOG (logout_dialog), 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);