summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Jon McCann <jmccann@redhat.com>2011-02-24 17:38:13 -0500
committerWilliam Jon McCann <jmccann@redhat.com>2011-02-24 17:56:03 -0500
commit8663860ff44b9a5e441e4909a49eee4cfa08378d (patch)
tree21e5e58a0d6ef70bd82a1c3fc08b39b29789c1ef
parentcba6e372e3f9130b22d7d614d376c3c9ae898ce7 (diff)
downloadgnome-session-8663860ff44b9a5e441e4909a49eee4cfa08378d.tar.gz
rename gnome-session-save to gnome-session-quit
Is much less misleading since it doesn't save anything.
-rw-r--r--doc/man/Makefile.am2
-rw-r--r--doc/man/gnome-session-quit.125
-rw-r--r--doc/man/gnome-session-save.140
-rw-r--r--po/POTFILES.in2
-rw-r--r--tools/Makefile.am10
-rw-r--r--tools/gnome-session-quit.c (renamed from tools/gnome-session-save.c)116
6 files changed, 51 insertions, 144 deletions
diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am
index 72f9a93b..e42430a9 100644
--- a/doc/man/Makefile.am
+++ b/doc/man/Makefile.am
@@ -1,7 +1,7 @@
man_MANS = \
gnome-session.1 \
gnome-session-properties.1 \
- gnome-session-save.1
+ gnome-session-quit.1
EXTRA_DIST = \
$(man_MANS)
diff --git a/doc/man/gnome-session-quit.1 b/doc/man/gnome-session-quit.1
new file mode 100644
index 00000000..2f6df849
--- /dev/null
+++ b/doc/man/gnome-session-quit.1
@@ -0,0 +1,25 @@
+.\"
+.\" gnome-session-quit manual page.
+.\" (C) 2000 Miguel de Icaza (miguel@helixcode.com)
+.\" (C) 2009-2010 Vincent Untz (vuntz@gnome.org)
+.\"
+.TH GNOME-SESSION-QUIT 1 "GNOME"
+.SH NAME
+gnome-session-quit \- End the current GNOME session
+.SH SYNOPSIS
+.B gnome-session-quit [\-\-logout] [\-\-power-off] [\-\-no-prompt]
+.SH DESCRIPTION
+The \fIgnome-session-quit\fP program can be used to end a GNOME session.
+.PP
+If called with the \fB\-\-logout\fP option the user will be prompted
+to confirm logout. The \fB\-\-no\-prompt\fP option can be used to end
+the session without user interaction.
+.PP
+When the \fB\-\-power\-off\fP option is given the user will be
+prompted to confirm system power off. The \fB\-\-no\-prompt\fP option
+can be used to power off without user interaction.
+.SH BUGS
+If you find bugs in the \fIgnome-session-quit\fP program, please report
+these on https://bugzilla.gnome.org.
+.SH SEE ALSO
+.BR gnome-session(1)
diff --git a/doc/man/gnome-session-save.1 b/doc/man/gnome-session-save.1
deleted file mode 100644
index bdea8f91..00000000
--- a/doc/man/gnome-session-save.1
+++ /dev/null
@@ -1,40 +0,0 @@
-.\"
-.\" gnome-session-save manual page.
-.\" (C) 2000 Miguel de Icaza (miguel@helixcode.com)
-.\" (C) 2009-2010 Vincent Untz (vuntz@gnome.org)
-.\"
-.TH GNOME-SESSION-SAVE 1 "GNOME"
-.SH NAME
-gnome-session-save \- End or save the current GNOME session
-.SH SYNOPSIS
-.B gnome-session-save [\-\-logout] [\-\-force\-logout] [\-\-logout\-dialog] [\-\-shutdown\-dialog] [\-\-gui] [\-\-kill [\-\-silent]]
-.SH DESCRIPTION
-The \fIgnome-session-save\fP program can be used from a GNOME session to
-save a snapshot of the currently running applications. This session will
-be later restored at your next GNOME session.
-.PP
-The \fB\-\-gui\fP option will report errors in dialog boxes instead of
-printing to stderr.
-.PP
-If called with the \fB\-\-logout\fP option, the current GNOME session will be
-ended, unless logging out has been inhibited by an application. The
-\fB\-\-force\-logout\fP option can be used to end the session regardless of
-the inhibition state.
-.PP
-When the \fB\-\-logout\-dialog\fP option is given, the standard dialog
-displaying logout options is displayed. When \fB\-\-shutdown\-dialog\fP
-option is given, the standard dialog displaying shutdown options is
-displayed.
-.PP
-The \fB\-\-kill\fP and \fB\-\-silent\fP options are deprecated. The
-\fB\-\-kill\fP option is equivalent to the \fB\-\-logout\-dialog\fP
-option. If \fB\-\-silent\fP is used with \fB\-\-kill\fR, then it will
-behave as if \fB\-\-logout\fP was used.
-.PP
-The session is not saved when \fIgnome-session-save\fP is called with any of
-the options ending the session.
-.SH BUGS
-If you find bugs in the \fIgnome-session-save\fP program, please report
-these on https://bugzilla.gnome.org.
-.SH SEE ALSO
-.BR gnome-session(1)
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 4b3a1a12..1e7491db 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -20,4 +20,4 @@ gnome-session/gsm-xsmp-client.c
gnome-session/gsm-xsmp-server.c
gnome-session/gsm-util.c
gnome-session/main.c
-tools/gnome-session-save.c
+tools/gnome-session-quit.c
diff --git a/tools/Makefile.am b/tools/Makefile.am
index fbc41b58..f53a0124 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -1,14 +1,14 @@
-bin_PROGRAMS = gnome-session-save
+bin_PROGRAMS = gnome-session-quit
libexec_PROGRAMS = gnome-session-is-accelerated
AM_CPPFLAGS =
AM_CFLAGS = $(WARN_CFLAGS)
-gnome_session_save_SOURCES = \
- gnome-session-save.c
+gnome_session_quit_SOURCES = \
+ gnome-session-quit.c
-gnome_session_save_CPPFLAGS = \
+gnome_session_quit_CPPFLAGS = \
$(AM_CPPFLAGS) \
$(GNOME_SESSION_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
@@ -16,7 +16,7 @@ gnome_session_save_CPPFLAGS = \
-DLOCALE_DIR=\""$(datadir)/locale"\" \
$(DISABLE_DEPRECATED_CFLAGS)
-gnome_session_save_LDADD = \
+gnome_session_quit_LDADD = \
$(SM_LIBS) \
$(ICE_LIBS) \
$(GNOME_SESSION_LIBS) \
diff --git a/tools/gnome-session-save.c b/tools/gnome-session-quit.c
index 28f6443d..f5d18382 100644
--- a/tools/gnome-session-save.c
+++ b/tools/gnome-session-quit.c
@@ -43,54 +43,23 @@ enum {
GSM_LOGOUT_MODE_FORCE
};
-/* True if killing. This is deprecated, but we keep it for compatibility
- * reasons. */
-static gboolean kill_session = FALSE;
-
-/* The real options that should be used now. They are not ambiguous. */
static gboolean logout = FALSE;
-static gboolean force_logout = FALSE;
-static gboolean logout_dialog = FALSE;
-static gboolean shutdown_dialog = FALSE;
-
-/* True if we should use dialog boxes */
-static gboolean show_error_dialogs = FALSE;
-
-/* True if we should do the requested action without confirmation */
-static gboolean no_interaction = FALSE;
-
-static char *session_name = NULL;
+static gboolean power_off = FALSE;
+static gboolean no_prompt = FALSE;
+static gboolean force = FALSE;
static GOptionEntry options[] = {
{"logout", '\0', 0, G_OPTION_ARG_NONE, &logout, N_("Log out"), NULL},
- {"force-logout", '\0', 0, G_OPTION_ARG_NONE, &force_logout, N_("Log out, ignoring any existing inhibitors"), 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},
- {"gui", '\0', 0, G_OPTION_ARG_NONE, &show_error_dialogs, N_("Use dialog boxes for errors"), NULL},
- /* deprecated options */
- {"session-name", 's', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_STRING, &session_name, N_("Set the current session name"), N_("NAME")},
- {"kill", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &kill_session, N_("Kill session"), NULL},
- {"silent", '\0', G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &no_interaction, N_("Do not require confirmation"), NULL},
+ {"power-off", '\0', 0, G_OPTION_ARG_NONE, &power_off, N_("Power off"), NULL},
+ {"force", '\0', 0, G_OPTION_ARG_NONE, &force, N_("Ignoring any existing inhibitors"), NULL},
+ {"no-prompt", '\0', 0, G_OPTION_ARG_NONE, &no_prompt, N_("Don't prompt for user confirmation"), NULL},
{NULL}
};
static void
display_error (const char *message)
{
- if (show_error_dialogs && !no_interaction) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s", message);
-
- /*gtk_window_set_default_icon_name (GTK_STOCK_SAVE);*/
-
- gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_widget_destroy (dialog);
- } else {
- g_printerr ("%s\n", message);
- }
+ g_printerr ("%s\n", message);
}
static DBusGConnection *
@@ -134,43 +103,6 @@ get_sm_proxy (void)
return sm_proxy;
}
-#if 0
-static void
-set_session_name (const char *session_name)
-{
- DBusGProxy *sm_proxy;
- GError *error;
- gboolean res;
-
- sm_proxy = get_sm_proxy ();
- if (sm_proxy == NULL) {
- return;
- }
-
- error = NULL;
- res = dbus_g_proxy_call (sm_proxy,
- "SetName",
- &error,
- G_TYPE_STRING, session_name,
- G_TYPE_INVALID, G_TYPE_INVALID);
-
- if (!res) {
- if (error != NULL) {
- g_warning ("Failed to set session name '%s': %s",
- session_name, error->message);
- g_error_free (error);
- } else {
- g_warning ("Failed to set session name '%s'",
- session_name);
- }
- }
-
- if (sm_proxy != NULL) {
- g_object_unref (sm_proxy);
- }
-}
-#endif
-
static void
do_logout (unsigned int mode)
{
@@ -207,7 +139,7 @@ do_logout (unsigned int mode)
}
static void
-do_shutdown_dialog (void)
+do_power_off (void)
{
DBusGProxy *sm_proxy;
GError *error;
@@ -259,34 +191,24 @@ main (int argc, char *argv[])
}
conflicting_options = 0;
- if (kill_session)
- conflicting_options++;
if (logout)
conflicting_options++;
- if (force_logout)
- conflicting_options++;
- if (logout_dialog)
- conflicting_options++;
- if (shutdown_dialog)
+ if (power_off)
conflicting_options++;
if (conflicting_options > 1)
display_error (_("Program called with conflicting options"));
- if (kill_session) {
- if (no_interaction)
- force_logout = TRUE;
- else
- logout_dialog = TRUE;
- }
+ if (power_off) {
+ do_power_off ();
+ } else {
+ /* default to logout */
- if (logout) {
- do_logout (GSM_LOGOUT_MODE_NO_CONFIRMATION);
- } else if (force_logout) {
- do_logout (GSM_LOGOUT_MODE_FORCE);
- } else if (logout_dialog) {
- do_logout (GSM_LOGOUT_MODE_NORMAL);
- } else if (shutdown_dialog) {
- do_shutdown_dialog ();
+ if (force)
+ do_logout (GSM_LOGOUT_MODE_FORCE);
+ else if (no_prompt)
+ do_logout (GSM_LOGOUT_MODE_NO_CONFIRMATION);
+ else
+ do_logout (GSM_LOGOUT_MODE_NORMAL);
}
return 0;