Update to 3.1.3
This commit is contained in:
parent
78fb8d581c
commit
5da13b5216
1
.gitignore
vendored
1
.gitignore
vendored
@ -14,3 +14,4 @@ gnome-session-2.31.6.tar.bz2
|
||||
/gnome-session-3.0.0.tar.bz2
|
||||
/gnome-session-3.0.1.tar.bz2
|
||||
/gnome-session-3.1.2.tar.xz
|
||||
/gnome-session-3.1.3.tar.xz
|
||||
|
@ -1,596 +0,0 @@
|
||||
diff -up gnome-session-2.31.6/configure.ac.max-idle gnome-session-2.31.6/configure.ac
|
||||
--- gnome-session-2.31.6/configure.ac.max-idle 2010-08-04 07:35:41.000000000 -0400
|
||||
+++ gnome-session-2.31.6/configure.ac 2010-08-06 20:18:07.157048001 -0400
|
||||
@@ -50,6 +50,7 @@ AC_MSG_RESULT([$with_gtk])
|
||||
GLIB_REQUIRED=2.16.0
|
||||
DBUS_GLIB_REQUIRED=0.76
|
||||
UPOWER_REQUIRED=0.9.0
|
||||
+LIBNOTIFY_REQUIRED=0.7.0
|
||||
|
||||
case "$with_gtk" in
|
||||
2.0) GTK_API_VERSION=2.0
|
||||
@@ -71,6 +72,7 @@ PKG_CHECK_MODULES(GNOME_SESSION,
|
||||
gtk+-$GTK_API_VERSION >= $GTK_REQUIRED
|
||||
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||||
upower-glib >= $UPOWER_REQUIRED
|
||||
+ libnotify >= $LIBNOTIFY_REQUIRED
|
||||
)
|
||||
|
||||
PKG_CHECK_MODULES(SESSION_PROPERTIES,
|
||||
diff -up gnome-session-2.31.6/data/gnome-session.schemas.in.in.max-idle gnome-session-2.31.6/data/gnome-session.schemas.in.in
|
||||
--- gnome-session-2.31.6/data/gnome-session.schemas.in.in.max-idle 2010-08-04 07:22:30.000000000 -0400
|
||||
+++ gnome-session-2.31.6/data/gnome-session.schemas.in.in 2010-08-06 20:06:05.274048002 -0400
|
||||
@@ -39,6 +39,36 @@
|
||||
</locale>
|
||||
</schema>
|
||||
<schema>
|
||||
+ <key>/schemas/desktop/gnome/session/max_idle_action</key>
|
||||
+ <applyto>/desktop/gnome/session/max_idle_action</applyto>
|
||||
+ <owner>gnome</owner>
|
||||
+ <type>string</type>
|
||||
+ <default></default>
|
||||
+ <locale name="C">
|
||||
+ <short>The action to take after the maximum idle time</short>
|
||||
+ <long>
|
||||
+ The name of the action to take when the maximum allowed
|
||||
+ idle time has been reached. The Delay is specified in
|
||||
+ the "max_idle_time" key. Allowed values are: logout,
|
||||
+ forced-logout. An empty string disables the action.
|
||||
+ </long>
|
||||
+ </locale>
|
||||
+ </schema>
|
||||
+ <schema>
|
||||
+ <key>/schemas/desktop/gnome/session/max_idle_time</key>
|
||||
+ <applyto>/desktop/gnome/session/max_idle_time</applyto>
|
||||
+ <owner>gnome</owner>
|
||||
+ <type>int</type>
|
||||
+ <default>120</default>
|
||||
+ <locale name="C">
|
||||
+ <short>Amount of time a user can remain idle</short>
|
||||
+ <long>
|
||||
+ The number of minutes a user can remain idle before the
|
||||
+ max_idle_action is automatically taken.
|
||||
+ </long>
|
||||
+ </locale>
|
||||
+ </schema>
|
||||
+ <schema>
|
||||
<key>/schemas/desktop/gnome/session/default_session</key>
|
||||
<applyto>/desktop/gnome/session/default_session</applyto>
|
||||
<owner>gnome</owner>
|
||||
diff -up gnome-session-2.31.6/gnome-session/gsm-manager.c.max-idle gnome-session-2.31.6/gnome-session/gsm-manager.c
|
||||
--- gnome-session-2.31.6/gnome-session/gsm-manager.c.max-idle 2010-07-15 08:53:08.000000000 -0400
|
||||
+++ gnome-session-2.31.6/gnome-session/gsm-manager.c 2010-08-06 20:06:05.278048002 -0400
|
||||
@@ -39,6 +39,7 @@
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
|
||||
#include <upower.h>
|
||||
+#include <libnotify/notify.h>
|
||||
|
||||
#include <gtk/gtk.h> /* for logout dialog */
|
||||
#include <gconf/gconf-client.h>
|
||||
@@ -67,6 +68,10 @@
|
||||
#define GSM_MANAGER_DBUS_PATH "/org/gnome/SessionManager"
|
||||
#define GSM_MANAGER_DBUS_NAME "org.gnome.SessionManager"
|
||||
|
||||
+#define GS_NAME "org.gnome.ScreenSaver"
|
||||
+#define GS_PATH "/org/gnome/ScreenSaver"
|
||||
+#define GS_INTERFACE "org.gnome.ScreenSaver"
|
||||
+
|
||||
#define GSM_MANAGER_PHASE_TIMEOUT 10 /* seconds */
|
||||
|
||||
#define GDM_FLEXISERVER_COMMAND "gdmflexiserver"
|
||||
@@ -79,6 +84,8 @@
|
||||
|
||||
#define KEY_DESKTOP_DIR "/desktop/gnome/session"
|
||||
#define KEY_IDLE_DELAY KEY_DESKTOP_DIR "/idle_delay"
|
||||
+#define KEY_MAX_IDLE_TIME KEY_DESKTOP_DIR "/max_idle_time"
|
||||
+#define KEY_MAX_IDLE_ACTION KEY_DESKTOP_DIR "/max_idle_action"
|
||||
|
||||
#define KEY_GNOME_SESSION_DIR "/apps/gnome-session/options"
|
||||
#define KEY_AUTOSAVE KEY_GNOME_SESSION_DIR "/auto_save_session"
|
||||
@@ -114,6 +121,11 @@ struct GsmManagerPrivate
|
||||
gboolean forceful_logout;
|
||||
GSList *query_clients;
|
||||
guint query_timeout_id;
|
||||
+ guint max_idle_timeout_id;
|
||||
+ guint max_idle_warning_timeout_id;
|
||||
+ guint max_idle_time_secs;
|
||||
+ int max_idle_action;
|
||||
+ NotifyNotification *max_idle_notification;
|
||||
/* This is used for GSM_MANAGER_PHASE_END_SESSION only at the moment,
|
||||
* since it uses a sublist of all running client that replied in a
|
||||
* specific way */
|
||||
@@ -157,6 +169,19 @@ enum {
|
||||
|
||||
static guint signals [LAST_SIGNAL] = { 0 };
|
||||
|
||||
+typedef enum {
|
||||
+ ACTION_NONE = 0,
|
||||
+ ACTION_LOGOUT,
|
||||
+ ACTION_FORCED_LOGOUT,
|
||||
+} Action;
|
||||
+
|
||||
+static GConfEnumStringPair actions_enum_map [] = {
|
||||
+ { ACTION_NONE, "" },
|
||||
+ { ACTION_LOGOUT, "logout" },
|
||||
+ { ACTION_FORCED_LOGOUT, "forced-logout" },
|
||||
+ { 0, NULL }
|
||||
+};
|
||||
+
|
||||
static void gsm_manager_class_init (GsmManagerClass *klass);
|
||||
static void gsm_manager_init (GsmManager *manager);
|
||||
static void gsm_manager_finalize (GObject *object);
|
||||
@@ -2141,6 +2166,19 @@ gsm_manager_dispose (GObject *object)
|
||||
|
||||
g_debug ("GsmManager: disposing manager");
|
||||
|
||||
+ if (manager->priv->max_idle_notification != NULL) {
|
||||
+ g_object_unref (manager->priv->max_idle_notification);
|
||||
+ manager->priv->max_idle_notification = NULL;
|
||||
+ }
|
||||
+ if (manager->priv->max_idle_warning_timeout_id > 0) {
|
||||
+ g_source_remove (manager->priv->max_idle_warning_timeout_id);
|
||||
+ manager->priv->max_idle_warning_timeout_id = 0;
|
||||
+ }
|
||||
+ if (manager->priv->max_idle_timeout_id > 0) {
|
||||
+ g_source_remove (manager->priv->max_idle_timeout_id);
|
||||
+ manager->priv->max_idle_timeout_id = 0;
|
||||
+ }
|
||||
+
|
||||
if (manager->priv->clients != NULL) {
|
||||
g_signal_handlers_disconnect_by_func (manager->priv->clients,
|
||||
on_store_client_added,
|
||||
@@ -2337,6 +2375,321 @@ load_idle_delay_from_gconf (GsmManager *
|
||||
}
|
||||
|
||||
static void
|
||||
+load_max_idle_from_gconf (GsmManager *manager)
|
||||
+{
|
||||
+ GError *error;
|
||||
+ glong value;
|
||||
+ const char *str;
|
||||
+
|
||||
+ error = NULL;
|
||||
+ value = gconf_client_get_int (manager->priv->gconf_client,
|
||||
+ KEY_MAX_IDLE_TIME,
|
||||
+ &error);
|
||||
+ if (error == NULL) {
|
||||
+ manager->priv->max_idle_time_secs = 60 * value;
|
||||
+ } else {
|
||||
+ g_warning ("Error retrieving configuration key '%s': %s",
|
||||
+ KEY_MAX_IDLE_TIME,
|
||||
+ error->message);
|
||||
+ g_error_free (error);
|
||||
+ }
|
||||
+
|
||||
+ error = NULL;
|
||||
+ str = gconf_client_get_string (manager->priv->gconf_client,
|
||||
+ KEY_MAX_IDLE_ACTION,
|
||||
+ &error);
|
||||
+ if (error == NULL) {
|
||||
+ int action;
|
||||
+
|
||||
+ if (gconf_string_to_enum (actions_enum_map, str, &action)) {
|
||||
+ manager->priv->max_idle_action = action;
|
||||
+ } else {
|
||||
+ manager->priv->max_idle_action = ACTION_NONE;
|
||||
+ }
|
||||
+ } else {
|
||||
+ g_warning ("Error retrieving configuration key '%s': %s",
|
||||
+ KEY_MAX_IDLE_TIME,
|
||||
+ error->message);
|
||||
+ g_error_free (error);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+request_logout (GsmManager *manager,
|
||||
+ gboolean forceful_logout)
|
||||
+{
|
||||
+ g_debug ("GsmManager: requesting logout");
|
||||
+
|
||||
+ manager->priv->forceful_logout = forceful_logout;
|
||||
+ manager->priv->logout_type = GSM_MANAGER_LOGOUT_LOGOUT;
|
||||
+
|
||||
+ end_phase (manager);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+_on_max_idle_time_timeout (GsmManager *manager)
|
||||
+{
|
||||
+ manager->priv->max_idle_timeout_id = 0;
|
||||
+ g_debug ("GsmManager: max idle time reached");
|
||||
+
|
||||
+ if (manager->priv->max_idle_warning_timeout_id > 0) {
|
||||
+ g_source_remove (manager->priv->max_idle_warning_timeout_id);
|
||||
+ manager->priv->max_idle_warning_timeout_id = 0;
|
||||
+ }
|
||||
+
|
||||
+ switch (manager->priv->max_idle_action) {
|
||||
+ case ACTION_LOGOUT:
|
||||
+ g_debug ("GsmManager: max idle action: logout");
|
||||
+ /* begin non-forceful logout */
|
||||
+ request_logout (manager, FALSE);
|
||||
+ break;
|
||||
+ case ACTION_FORCED_LOGOUT:
|
||||
+ g_debug ("GsmManager: max idle action: force-logout");
|
||||
+ /* begin forceful logout */
|
||||
+ request_logout (manager, TRUE);
|
||||
+ break;
|
||||
+ case ACTION_NONE:
|
||||
+ g_debug ("GsmManager: no max idle action specified");
|
||||
+ break;
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+on_max_idle_notification_closed (NotifyNotification *notification,
|
||||
+ GsmManager *manager)
|
||||
+{
|
||||
+ if (manager->priv->max_idle_notification != NULL) {
|
||||
+ g_object_unref (manager->priv->max_idle_notification);
|
||||
+ manager->priv->max_idle_notification = NULL;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/* Adapted from totem_time_to_string_text */
|
||||
+static char *
|
||||
+time_to_string_text (long time)
|
||||
+{
|
||||
+ char *secs, *mins, *hours, *string;
|
||||
+ int sec, min, hour;
|
||||
+
|
||||
+ sec = time % 60;
|
||||
+ time = time - sec;
|
||||
+ min = (time % (60 * 60)) / 60;
|
||||
+ time = time - (min * 60);
|
||||
+ hour = time / (60 * 60);
|
||||
+
|
||||
+ hours = g_strdup_printf (ngettext ("%d hour", "%d hours", hour), hour);
|
||||
+
|
||||
+ mins = g_strdup_printf (ngettext ("%d minute",
|
||||
+ "%d minutes", min), min);
|
||||
+
|
||||
+ secs = g_strdup_printf (ngettext ("%d second",
|
||||
+ "%d seconds", sec), sec);
|
||||
+
|
||||
+ if (hour > 0) {
|
||||
+ /* hour:minutes:seconds */
|
||||
+ string = g_strdup_printf (_("%s %s %s"), hours, mins, secs);
|
||||
+ } else if (min > 0) {
|
||||
+ /* minutes:seconds */
|
||||
+ string = g_strdup_printf (_("%s %s"), mins, secs);
|
||||
+ } else if (sec > 0) {
|
||||
+ /* seconds */
|
||||
+ string = g_strdup_printf (_("%s"), secs);
|
||||
+ } else {
|
||||
+ /* 0 seconds */
|
||||
+ string = g_strdup (_("0 seconds"));
|
||||
+ }
|
||||
+
|
||||
+ g_free (hours);
|
||||
+ g_free (mins);
|
||||
+ g_free (secs);
|
||||
+
|
||||
+ return string;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+update_max_idle_notification (GsmManager *manager,
|
||||
+ long secs_remaining)
|
||||
+{
|
||||
+ char *summary;
|
||||
+ char *body;
|
||||
+ char *remaining;
|
||||
+ gboolean screensaver_active;
|
||||
+
|
||||
+ g_object_get (manager->priv->presence, "screensaver-active", &screensaver_active, NULL);
|
||||
+
|
||||
+ remaining = time_to_string_text (secs_remaining);
|
||||
+ summary = NULL;
|
||||
+ body = NULL;
|
||||
+
|
||||
+ switch (manager->priv->max_idle_action) {
|
||||
+ case ACTION_LOGOUT:
|
||||
+ case ACTION_FORCED_LOGOUT:
|
||||
+ summary = g_strdup_printf (_("Automatic logout in %s"), remaining);
|
||||
+ body = g_strdup (_("This session is configured to automatically log out after a period of inactivity."));
|
||||
+ break;
|
||||
+ default:
|
||||
+ g_assert_not_reached ();
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ g_free (remaining);
|
||||
+
|
||||
+ if (screensaver_active) {
|
||||
+ DBusGProxy *proxy;
|
||||
+ GError *error;
|
||||
+
|
||||
+ proxy = dbus_g_proxy_new_for_name (manager->priv->connection,
|
||||
+ GS_NAME,
|
||||
+ GS_PATH,
|
||||
+ GS_INTERFACE);
|
||||
+ error = NULL;
|
||||
+ if (! dbus_g_proxy_call (proxy, "ShowMessage", &error,
|
||||
+ G_TYPE_STRING, summary,
|
||||
+ G_TYPE_STRING, body,
|
||||
+ G_TYPE_STRING, "",
|
||||
+ G_TYPE_INVALID,
|
||||
+ G_TYPE_INVALID)) {
|
||||
+ g_debug ("ShowMessage failed: %s", error->message);
|
||||
+ g_error_free (error);
|
||||
+ }
|
||||
+
|
||||
+ g_object_unref (proxy);
|
||||
+ } else {
|
||||
+ if (manager->priv->max_idle_notification != NULL) {
|
||||
+ notify_notification_update (manager->priv->max_idle_notification,
|
||||
+ summary,
|
||||
+ body,
|
||||
+ NULL);
|
||||
+ } else {
|
||||
+ manager->priv->max_idle_notification
|
||||
+ = notify_notification_new (summary, body, NULL);
|
||||
+ notify_notification_set_timeout (manager->priv->max_idle_notification,
|
||||
+ NOTIFY_EXPIRES_NEVER);
|
||||
+
|
||||
+ g_signal_connect (manager->priv->max_idle_notification,
|
||||
+ "closed",
|
||||
+ G_CALLBACK (on_max_idle_notification_closed),
|
||||
+ manager);
|
||||
+ }
|
||||
+
|
||||
+ notify_notification_show (manager->priv->max_idle_notification, NULL);
|
||||
+ }
|
||||
+
|
||||
+ g_free (body);
|
||||
+ g_free (summary);
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+_on_max_idle_warning_2_timeout (GsmManager *manager)
|
||||
+{
|
||||
+ manager->priv->max_idle_warning_timeout_id = 0;
|
||||
+
|
||||
+ g_debug ("Note: will perform idle action in %f seconds",
|
||||
+ 0.02 * manager->priv->max_idle_time_secs);
|
||||
+ update_max_idle_notification (manager, 0.02 * manager->priv->max_idle_time_secs);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+_on_max_idle_warning_5_timeout (GsmManager *manager)
|
||||
+{
|
||||
+ long warn_secs;
|
||||
+
|
||||
+ warn_secs = 0.03 * manager->priv->max_idle_time_secs;
|
||||
+ manager->priv->max_idle_warning_timeout_id
|
||||
+ = g_timeout_add_seconds (warn_secs,
|
||||
+ (GSourceFunc)_on_max_idle_warning_2_timeout,
|
||||
+ manager);
|
||||
+ g_debug ("Note: will perform idle action in %f seconds",
|
||||
+ 0.05 * manager->priv->max_idle_time_secs);
|
||||
+ update_max_idle_notification (manager, 0.05 * manager->priv->max_idle_time_secs);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+_on_max_idle_warning_10_timeout (GsmManager *manager)
|
||||
+{
|
||||
+ long warn_secs;
|
||||
+
|
||||
+ warn_secs = 0.05 * manager->priv->max_idle_time_secs;
|
||||
+ manager->priv->max_idle_warning_timeout_id
|
||||
+ = g_timeout_add_seconds (warn_secs,
|
||||
+ (GSourceFunc)_on_max_idle_warning_5_timeout,
|
||||
+ manager);
|
||||
+ g_debug ("Note: will perform idle action in %f seconds",
|
||||
+ 0.1 * manager->priv->max_idle_time_secs);
|
||||
+ update_max_idle_notification (manager, 0.1 * manager->priv->max_idle_time_secs);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static gboolean
|
||||
+_on_max_idle_warning_20_timeout (GsmManager *manager)
|
||||
+{
|
||||
+ long warn_secs;
|
||||
+
|
||||
+ warn_secs = 0.1 * manager->priv->max_idle_time_secs;
|
||||
+ manager->priv->max_idle_warning_timeout_id
|
||||
+ = g_timeout_add_seconds (warn_secs,
|
||||
+ (GSourceFunc)_on_max_idle_warning_10_timeout,
|
||||
+ manager);
|
||||
+ g_debug ("Note: will perform idle action in %f seconds",
|
||||
+ 0.2 * manager->priv->max_idle_time_secs);
|
||||
+
|
||||
+ update_max_idle_notification (manager, 0.2 * manager->priv->max_idle_time_secs);
|
||||
+
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
+reset_max_idle_timer (GsmManager *manager)
|
||||
+{
|
||||
+ int status;
|
||||
+
|
||||
+ g_object_get (manager->priv->presence, "status", &status, NULL);
|
||||
+
|
||||
+
|
||||
+ g_debug ("Resetting max idle timer status=%d action=%d time=%ds",
|
||||
+ status, manager->priv->max_idle_action, manager->priv->max_idle_time_secs);
|
||||
+ if (manager->priv->max_idle_timeout_id > 0) {
|
||||
+ g_source_remove (manager->priv->max_idle_timeout_id);
|
||||
+ manager->priv->max_idle_timeout_id = 0;
|
||||
+ }
|
||||
+ if (manager->priv->max_idle_warning_timeout_id > 0) {
|
||||
+ g_source_remove (manager->priv->max_idle_warning_timeout_id);
|
||||
+ manager->priv->max_idle_warning_timeout_id = 0;
|
||||
+ }
|
||||
+
|
||||
+ if (status == GSM_PRESENCE_STATUS_IDLE
|
||||
+ && manager->priv->max_idle_action != ACTION_NONE) {
|
||||
+ long warn_secs;
|
||||
+
|
||||
+ /* start counting now. probably isn't quite
|
||||
+ right if we're handling a configuration
|
||||
+ value change but it may not matter */
|
||||
+
|
||||
+ manager->priv->max_idle_timeout_id
|
||||
+ = g_timeout_add_seconds (manager->priv->max_idle_time_secs,
|
||||
+ (GSourceFunc)_on_max_idle_time_timeout,
|
||||
+ manager);
|
||||
+
|
||||
+ /* start warning at 80% of the way through the idle */
|
||||
+ warn_secs = 0.8 * manager->priv->max_idle_time_secs;
|
||||
+ manager->priv->max_idle_warning_timeout_id
|
||||
+ = g_timeout_add_seconds (warn_secs,
|
||||
+ (GSourceFunc)_on_max_idle_warning_20_timeout,
|
||||
+ manager);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
on_gconf_key_changed (GConfClient *client,
|
||||
guint cnxn_id,
|
||||
GConfEntry *entry,
|
||||
@@ -2364,6 +2717,32 @@ on_gconf_key_changed (GConfClient *clien
|
||||
} else {
|
||||
invalid_type_warning (key);
|
||||
}
|
||||
+ } else if (strcmp (key, KEY_MAX_IDLE_TIME) == 0) {
|
||||
+ if (value->type == GCONF_VALUE_INT) {
|
||||
+ int t;
|
||||
+
|
||||
+ t = gconf_value_get_int (value);
|
||||
+
|
||||
+ manager->priv->max_idle_time_secs = t * 60;
|
||||
+ reset_max_idle_timer (manager);
|
||||
+ } else {
|
||||
+ invalid_type_warning (key);
|
||||
+ }
|
||||
+ } else if (strcmp (key, KEY_MAX_IDLE_ACTION) == 0) {
|
||||
+ if (value->type == GCONF_VALUE_STRING) {
|
||||
+ int action;
|
||||
+ const char *str;
|
||||
+
|
||||
+ str = gconf_value_get_string (value);
|
||||
+ if (gconf_string_to_enum (actions_enum_map, str, &action)) {
|
||||
+ manager->priv->max_idle_action = action;
|
||||
+ } else {
|
||||
+ manager->priv->max_idle_action = ACTION_NONE;
|
||||
+ }
|
||||
+ reset_max_idle_timer (manager);
|
||||
+ } else {
|
||||
+ invalid_type_warning (key);
|
||||
+ }
|
||||
} else if (strcmp (key, KEY_LOCK_DISABLE) == 0) {
|
||||
if (value->type == GCONF_VALUE_BOOL) {
|
||||
gboolean disabled;
|
||||
@@ -2401,6 +2780,7 @@ on_presence_status_changed (GsmPresence
|
||||
consolekit = gsm_get_consolekit ();
|
||||
gsm_consolekit_set_session_idle (consolekit,
|
||||
(status == GSM_PRESENCE_STATUS_IDLE));
|
||||
+ reset_max_idle_timer (manager);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2451,6 +2831,7 @@ gsm_manager_init (GsmManager *manager)
|
||||
NULL, NULL);
|
||||
|
||||
load_idle_delay_from_gconf (manager);
|
||||
+ load_max_idle_from_gconf (manager);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -2757,19 +3138,6 @@ request_hibernate (GsmManager *manager)
|
||||
gtk_widget_show (manager->priv->inhibit_dialog);
|
||||
}
|
||||
|
||||
-
|
||||
-static void
|
||||
-request_logout (GsmManager *manager,
|
||||
- gboolean forceful_logout)
|
||||
-{
|
||||
- g_debug ("GsmManager: requesting logout");
|
||||
-
|
||||
- manager->priv->forceful_logout = forceful_logout;
|
||||
- manager->priv->logout_type = GSM_MANAGER_LOGOUT_LOGOUT;
|
||||
-
|
||||
- end_phase (manager);
|
||||
-}
|
||||
-
|
||||
static void
|
||||
request_switch_user (GsmManager *manager)
|
||||
{
|
||||
diff -up gnome-session-2.31.6/gnome-session/gsm-presence.c.max-idle gnome-session-2.31.6/gnome-session/gsm-presence.c
|
||||
--- gnome-session-2.31.6/gnome-session/gsm-presence.c.max-idle 2010-02-09 08:22:01.000000000 -0500
|
||||
+++ gnome-session-2.31.6/gnome-session/gsm-presence.c 2010-08-06 20:06:05.281048002 -0400
|
||||
@@ -66,6 +66,7 @@ enum {
|
||||
PROP_STATUS_TEXT,
|
||||
PROP_IDLE_ENABLED,
|
||||
PROP_IDLE_TIMEOUT,
|
||||
+ PROP_SCREENSAVER_ACTIVE,
|
||||
};
|
||||
|
||||
|
||||
@@ -187,6 +188,7 @@ on_screensaver_active_changed (DBusGProx
|
||||
presence->priv->screensaver_active = is_active;
|
||||
reset_idle_watch (presence);
|
||||
set_session_idle (presence, is_active);
|
||||
+ g_object_notify (G_OBJECT (presence), "screensaver-active");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,6 +441,9 @@ gsm_presence_get_property (GObject *o
|
||||
case PROP_IDLE_TIMEOUT:
|
||||
g_value_set_uint (value, self->priv->idle_timeout);
|
||||
break;
|
||||
+ case PROP_SCREENSAVER_ACTIVE:
|
||||
+ g_value_set_boolean (value, self->priv->screensaver_active);
|
||||
+ break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@@ -532,6 +537,13 @@ gsm_presence_class_init (GsmPresenceClas
|
||||
G_MAXINT,
|
||||
300000,
|
||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
|
||||
+ g_object_class_install_property (object_class,
|
||||
+ PROP_SCREENSAVER_ACTIVE,
|
||||
+ g_param_spec_boolean ("screensaver-active",
|
||||
+ NULL,
|
||||
+ NULL,
|
||||
+ FALSE,
|
||||
+ G_PARAM_READABLE));
|
||||
|
||||
dbus_g_object_type_install_info (GSM_TYPE_PRESENCE, &dbus_glib_gsm_presence_object_info);
|
||||
dbus_g_error_domain_register (GSM_PRESENCE_ERROR, NULL, GSM_PRESENCE_TYPE_ERROR);
|
||||
diff -up gnome-session-2.31.6/gnome-session/main.c.max-idle gnome-session-2.31.6/gnome-session/main.c
|
||||
--- gnome-session-2.31.6/gnome-session/main.c.max-idle 2010-03-29 19:46:51.000000000 -0400
|
||||
+++ gnome-session-2.31.6/gnome-session/main.c 2010-08-06 20:06:05.282048002 -0400
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <dbus/dbus-glib.h>
|
||||
#include <dbus/dbus-glib-bindings.h>
|
||||
#include <dbus/dbus-glib-lowlevel.h>
|
||||
+#include <libnotify/notify.h>
|
||||
|
||||
#include "gdm-signal-handler.h"
|
||||
#include "gdm-log.h"
|
||||
@@ -471,6 +472,8 @@ main (int argc, char **argv)
|
||||
exit (1);
|
||||
}
|
||||
|
||||
+ notify_init ("GNOME session manager");
|
||||
+
|
||||
gdm_log_init ();
|
||||
gdm_log_set_debug (debug);
|
||||
|
@ -1,24 +0,0 @@
|
||||
From 01217f38addd7ea47e121fc5e31eb2a35a54f9f8 Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Tue, 8 Mar 2011 14:04:05 -0500
|
||||
Subject: [PATCH] Return 0 on success
|
||||
|
||||
Booleans and exist status don't go together well...
|
||||
---
|
||||
tools/gnome-session-check-accelerated.c | 2 +-
|
||||
1 files changed, 1 insertions(+), 1 deletions(-)
|
||||
|
||||
diff --git a/tools/gnome-session-check-accelerated.c b/tools/gnome-session-check-accelerated.c
|
||||
index 7b1cb5f..9d4e2d6 100644
|
||||
--- a/tools/gnome-session-check-accelerated.c
|
||||
+++ b/tools/gnome-session-check-accelerated.c
|
||||
@@ -99,5 +99,5 @@ main (int argc, char **argv)
|
||||
|
||||
gdk_display_sync (display);
|
||||
|
||||
- return is_accelerated;
|
||||
+ return is_accelerated ? 0 : 1;
|
||||
}
|
||||
--
|
||||
1.7.4.1
|
||||
|
@ -1,54 +0,0 @@
|
||||
From 6131a4cfba214b89d0197510a4f4cab33a160bfd Mon Sep 17 00:00:00 2001
|
||||
From: Matthias Clasen <mclasen@redhat.com>
|
||||
Date: Mon, 28 Feb 2011 19:43:32 -0500
|
||||
Subject: [PATCH] gsm_manager_get does not return a reference
|
||||
|
||||
This causes gnome-session to crash and burn whenever the new
|
||||
if-session condition is used.
|
||||
---
|
||||
gnome-session/gsm-autostart-app.c | 8 --------
|
||||
1 files changed, 0 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/gnome-session/gsm-autostart-app.c b/gnome-session/gsm-autostart-app.c
|
||||
index 81e66ce..05285d7 100644
|
||||
--- a/gnome-session/gsm-autostart-app.c
|
||||
+++ b/gnome-session/gsm-autostart-app.c
|
||||
@@ -548,8 +548,6 @@ setup_condition_monitor (GsmAutostartApp *app)
|
||||
g_signal_connect (manager, "notify::session-name",
|
||||
G_CALLBACK (if_session_condition_cb), app);
|
||||
g_free (session_name);
|
||||
-
|
||||
- g_object_unref (manager);
|
||||
} else if (kind == GSM_CONDITION_UNLESS_SESSION) {
|
||||
GsmManager *manager;
|
||||
char *session_name;
|
||||
@@ -563,8 +561,6 @@ setup_condition_monitor (GsmAutostartApp *app)
|
||||
g_signal_connect (manager, "notify::session-name",
|
||||
G_CALLBACK (unless_session_condition_cb), app);
|
||||
g_free (session_name);
|
||||
-
|
||||
- g_object_unref (manager);
|
||||
} else {
|
||||
disabled = TRUE;
|
||||
}
|
||||
@@ -869,8 +865,6 @@ is_conditionally_disabled (GsmApp *app)
|
||||
g_object_get (manager, "session-name", &session_name, NULL);
|
||||
disabled = strcmp (session_name, key) != 0;
|
||||
g_free (session_name);
|
||||
-
|
||||
- g_object_unref (manager);
|
||||
} else if (kind == GSM_CONDITION_UNLESS_SESSION) {
|
||||
GsmManager *manager;
|
||||
char *session_name;
|
||||
@@ -881,8 +875,6 @@ is_conditionally_disabled (GsmApp *app)
|
||||
g_object_get (manager, "session-name", &session_name, NULL);
|
||||
disabled = strcmp (session_name, key) == 0;
|
||||
g_free (session_name);
|
||||
-
|
||||
- g_object_unref (manager);
|
||||
} else {
|
||||
disabled = TRUE;
|
||||
}
|
||||
--
|
||||
1.7.4.1
|
||||
|
@ -1,36 +0,0 @@
|
||||
From 2bd1975803f1d7e03a7f98881e8332a2330c4146 Mon Sep 17 00:00:00 2001
|
||||
From: Vincent Untz <vuntz@gnome.org>
|
||||
Date: Fri, 14 Jan 2011 08:44:52 +0100
|
||||
Subject: [PATCH] tools: Do not consider Gallium's softpipe and llvmpipe as accelerated
|
||||
|
||||
Those are software renderers too. It might be that llvmpipe gets good
|
||||
enough in the future, but it's not the case at the moment.
|
||||
|
||||
Based on patch from Matthias Clasen <mclasen@redhat.com>.
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=639490
|
||||
---
|
||||
tools/gnome-session-is-accelerated.c | 7 +++++--
|
||||
1 files changed, 5 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/tools/gnome-session-is-accelerated.c b/tools/gnome-session-is-accelerated.c
|
||||
index 6b8b1a4..0729c14 100644
|
||||
--- a/tools/gnome-session-is-accelerated.c
|
||||
+++ b/tools/gnome-session-is-accelerated.c
|
||||
@@ -144,8 +144,11 @@ _has_hardware_gl (Display *display)
|
||||
|
||||
renderer = (const char *) glGetString (GL_RENDERER);
|
||||
/* The current Mesa software GL renderer string is
|
||||
- * "Software Rasterizer" */
|
||||
- if (strcasestr (renderer, "software rasterizer") != NULL)
|
||||
+ * "Software Rasterizer".
|
||||
+ * Gallium has softpipe and llvmpipe. */
|
||||
+ if (strcasestr (renderer, "software rasterizer") != NULL ||
|
||||
+ strcasestr (renderer, "softpipe") != NULL ||
|
||||
+ strcasestr (renderer, "llvmpipe") != NULL)
|
||||
goto out;
|
||||
|
||||
/* we need to get the max texture size while we have a context,
|
||||
--
|
||||
1.7.3.4
|
||||
|
@ -1,35 +0,0 @@
|
||||
From 0b71e3d369d1b922541c0f0fe764e576b54a8f1d Mon Sep 17 00:00:00 2001
|
||||
From: Colin Walters <walters@verbum.org>
|
||||
Date: Tue, 22 Feb 2011 14:57:58 -0500
|
||||
Subject: [PATCH] manager: Handle session name being NULL from gdm
|
||||
|
||||
https://bugzilla.gnome.org/show_bug.cgi?id=642988
|
||||
---
|
||||
gnome-session/gsm-manager.c | 4 ++--
|
||||
1 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
|
||||
index a021996..fe8e19e 100644
|
||||
--- a/gnome-session/gsm-manager.c
|
||||
+++ b/gnome-session/gsm-manager.c
|
||||
@@ -1267,7 +1267,7 @@ static void
|
||||
possibly_show_fallback_dialog (GsmManager *manager)
|
||||
{
|
||||
if (manager->priv->is_fallback_session &&
|
||||
- strcmp (manager->priv->session_name, "gnome-fallback") == 0 &&
|
||||
+ g_strcmp0 (manager->priv->session_name, "gnome-fallback") == 0 &&
|
||||
g_settings_get_boolean (manager->priv->settings,
|
||||
KEY_SHOW_FALLBACK_WARNING)) {
|
||||
show_fallback_dialog (_("GNOME 3 Failed to Load"),
|
||||
@@ -1277,7 +1277,7 @@ possibly_show_fallback_dialog (GsmManager *manager)
|
||||
"http://www.gnome3.org");
|
||||
g_settings_set_boolean (manager->priv->settings,
|
||||
KEY_SHOW_FALLBACK_WARNING, FALSE);
|
||||
- } else if (strcmp (manager->priv->session_name, "gnome") == 0 &&
|
||||
+ } else if (g_strcmp0 (manager->priv->session_name, "gnome") == 0 &&
|
||||
g_settings_get_boolean (manager->priv->settings,
|
||||
KEY_SHOW_FALLBACK_WARNING)) {
|
||||
/* Reset the setting if we ever manage to log into gnome 3 */
|
||||
--
|
||||
1.7.4.1
|
||||
|
@ -1,51 +0,0 @@
|
||||
diff -up gnome-session-2.19.6/data/gnome-session.schemas.in.window-manager gnome-session-2.19.6/data/gnome-session.schemas.in
|
||||
--- gnome-session-2.19.6/data/gnome-session.schemas.in.window-manager 2007-07-30 16:07:16.000000000 -0400
|
||||
+++ gnome-session-2.19.6/data/gnome-session.schemas.in 2007-08-09 17:47:42.000000000 -0400
|
||||
@@ -2,11 +2,22 @@
|
||||
<gconfschemafile>
|
||||
<schemalist>
|
||||
<schema>
|
||||
+ <key>/schemas/apps/gnome-session/rh/window_manager</key>
|
||||
+ <applyto>/apps/gnome-session/rh/window_manager</applyto>
|
||||
+ <owner>gnome</owner>
|
||||
+ <type>string</type>
|
||||
+ <default>metacity</default>
|
||||
+ <locale name="C">
|
||||
+ <short>Window Manager to start</short>
|
||||
+ <long>The Window manager that gnome-session will start. Valid values are "metacity" and "compiz".</long>
|
||||
+ </locale>
|
||||
+ </schema>
|
||||
+ <schema>
|
||||
<key>/schemas/apps/gnome-session/options/show_splash_screen</key>
|
||||
<applyto>/apps/gnome-session/options/show_splash_screen</applyto>
|
||||
<owner>gnome</owner>
|
||||
<type>bool</type>
|
||||
- <default>true</default>
|
||||
+ <default>false</default>
|
||||
<locale name="C">
|
||||
<short>Show the splash screen</short>
|
||||
<long>Show the splash screen when the session starts up</long>
|
||||
diff -up gnome-session-2.19.6/data/gnome-wm.window-manager gnome-session-2.19.6/data/gnome-wm
|
||||
--- gnome-session-2.19.6/data/gnome-wm.window-manager 2007-07-30 16:07:15.000000000 -0400
|
||||
+++ gnome-session-2.19.6/data/gnome-wm 2007-08-10 15:01:04.000000000 -0400
|
||||
@@ -3,7 +3,9 @@
|
||||
# The user can specify his prefered WM by setting the WINDOW_MANAGER
|
||||
# environment variable.
|
||||
#
|
||||
-# If this is not set, we search a list of known windowmanagers and use
|
||||
+# If this is not set, we check the /apps/gnome-session/rh/window_manager key
|
||||
+# and go off that. finally, if all else fails we search a list of known
|
||||
+# windowmanagers and use
|
||||
# the first one that is found in the users's PATH
|
||||
#
|
||||
|
||||
@@ -38,6 +40,9 @@ for n in "$@" ; do
|
||||
done
|
||||
|
||||
# WINDOW_MANAGER overrides all
|
||||
+if [ -z "$WINDOW_MANAGER" ] ; then
|
||||
+ WINDOW_MANAGER=$(gconftool-2 --get /apps/gnome-session/rh/window_manager)
|
||||
+fi
|
||||
|
||||
if [ -z "$WINDOW_MANAGER" ] ; then
|
||||
# Create a list of window manager we can handle, trying to only use the
|
@ -1,14 +0,0 @@
|
||||
diff -up gnome-session-2.32.0/gnome-session/Makefile.am.cflags gnome-session-2.32.0/gnome-session/Makefile.am
|
||||
--- gnome-session-2.32.0/gnome-session/Makefile.am.cflags 2010-09-30 08:19:16.757603002 -0400
|
||||
+++ gnome-session-2.32.0/gnome-session/Makefile.am 2010-09-30 08:19:50.708603005 -0400
|
||||
@@ -80,6 +80,10 @@ gnome_session_LDADD = \
|
||||
$(GCONF_LIBS) \
|
||||
$(EXECINFO_LIBS)
|
||||
|
||||
+libgsmutil_la_CFLAGS = \
|
||||
+ $(AM_CPPFLAGS) \
|
||||
+ $(GCONF_CFLAGS)
|
||||
+
|
||||
libgsmutil_la_SOURCES = \
|
||||
gsm-util.c \
|
||||
gsm-util.h
|
@ -1,22 +0,0 @@
|
||||
diff -up gnome-session-2.91.91/tools/Makefile.am.libs gnome-session-2.91.91/tools/Makefile.am
|
||||
--- gnome-session-2.91.91/tools/Makefile.am.libs 2011-03-07 23:08:58.320593583 -0500
|
||||
+++ gnome-session-2.91.91/tools/Makefile.am 2011-03-07 23:38:02.621786815 -0500
|
||||
@@ -31,7 +31,8 @@ gnome_session_check_accelerated_helper_C
|
||||
|
||||
gnome_session_check_accelerated_helper_LDADD = \
|
||||
$(GL_TEST_LIBS) \
|
||||
- $(X_LIBS)
|
||||
+ $(X_LIBS) \
|
||||
+ -lX11
|
||||
|
||||
gnome_session_check_accelerated_SOURCES = \
|
||||
gnome-session-check-accelerated.c
|
||||
@@ -42,6 +43,7 @@ gnome_session_check_accelerated_CPPFLAGS
|
||||
$(GTK3_CFLAGS)
|
||||
|
||||
gnome_session_check_accelerated_LDADD = \
|
||||
- $(GTK3_LIBS)
|
||||
+ $(GTK3_LIBS) \
|
||||
+ -lX11
|
||||
|
||||
-include $(top_srcdir)/git.mk
|
@ -2,7 +2,7 @@
|
||||
|
||||
Summary: GNOME session manager
|
||||
Name: gnome-session
|
||||
Version: 3.1.2
|
||||
Version: 3.1.3
|
||||
Release: 1%{?dist}
|
||||
URL: http://www.gnome.org
|
||||
#VCS: git:git://git.gnome.org/gnome-session
|
||||
@ -162,6 +162,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas || :
|
||||
%{_datadir}/glib-2.0/schemas/org.gnome.SessionManager.gschema.xml
|
||||
|
||||
%changelog
|
||||
* Mon Jul 04 2011 Bastien Nocera <bnocera@redhat.com> 3.1.3-1
|
||||
- Update to 3.1.3
|
||||
|
||||
* Wed Jun 15 2011 Tomas Bzatek <tbzatek@redhat.com> - 3.1.2-1
|
||||
- Update to 3.1.2
|
||||
|
||||
|
@ -1,154 +0,0 @@
|
||||
diff -up gnome-session-2.31.6/data/gnome-session.schemas.in.in.nag-root-user gnome-session-2.31.6/data/gnome-session.schemas.in.in
|
||||
--- gnome-session-2.31.6/data/gnome-session.schemas.in.in.nag-root-user 2010-08-06 20:18:36.000000000 -0400
|
||||
+++ gnome-session-2.31.6/data/gnome-session.schemas.in.in 2010-08-06 20:24:53.215048000 -0400
|
||||
@@ -3,6 +3,17 @@
|
||||
<schemalist>
|
||||
|
||||
<schema>
|
||||
+ <key>/schemas/apps/gnome-session/options/show_root_warning</key>
|
||||
+ <applyto>/apps/gnome-session/options/show_root_warning</applyto>
|
||||
+ <owner>gnome</owner>
|
||||
+ <type>bool</type>
|
||||
+ <default>true</default>
|
||||
+ <locale name="C">
|
||||
+ <short>Warn user against running gnome-session from root account</short>
|
||||
+ <long>If a user tries to login as root, show a dialog telling them it's a bad idea</long>
|
||||
+ </locale>
|
||||
+ </schema>
|
||||
+ <schema>
|
||||
<key>/schemas/apps/gnome-session/options/auto_save_session</key>
|
||||
<applyto>/apps/gnome-session/options/auto_save_session</applyto>
|
||||
<owner>gnome</owner>
|
||||
diff -up gnome-session-2.31.6/gnome-session/gsm-manager.c.nag-root-user gnome-session-2.31.6/gnome-session/gsm-manager.c
|
||||
--- gnome-session-2.31.6/gnome-session/gsm-manager.c.nag-root-user 2010-08-06 20:18:36.308048001 -0400
|
||||
+++ gnome-session-2.31.6/gnome-session/gsm-manager.c 2010-08-06 20:18:36.333048001 -0400
|
||||
@@ -92,6 +92,8 @@
|
||||
|
||||
#define KEY_SLEEP_LOCK "/apps/gnome-screensaver/lock_enabled"
|
||||
|
||||
+#define KEY_SHOW_ROOT_WARNING "/apps/gnome-session/options/show_root_warning"
|
||||
+
|
||||
#define IS_STRING_EMPTY(x) ((x)==NULL||(x)[0]=='\0')
|
||||
|
||||
typedef enum
|
||||
@@ -492,6 +494,26 @@ end_phase (GsmManager *manager)
|
||||
manager->priv->phase_timeout_id = 0;
|
||||
}
|
||||
|
||||
+ /* If we just finished the phase before the phase where applications
|
||||
+ * are started, then nag the user if they're root. We could do it earlier,
|
||||
+ * but that would mean showing a bare dialog with nothing around it
|
||||
+ * (and potentially without decorations, font settings loaded, etc). We
|
||||
+ * could do it later, but that would be mean things loading around it and
|
||||
+ * covering it up, etc.
|
||||
+ */
|
||||
+ if (manager->priv->phase + 1 == GSM_MANAGER_PHASE_APPLICATION) {
|
||||
+ if (getuid () == 0) {
|
||||
+ gsm_util_nag_message (KEY_SHOW_ROOT_WARNING, FALSE,
|
||||
+ _("You are currently trying to run as the "
|
||||
+ "root super user. The super user is a "
|
||||
+ "specialized account that is not designed "
|
||||
+ "to run a normal user session. Various programs "
|
||||
+ "will not function properly, and actions "
|
||||
+ "performed under this account can cause unrecoverable "
|
||||
+ "damage to the operating system."));
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
switch (manager->priv->phase) {
|
||||
case GSM_MANAGER_PHASE_STARTUP:
|
||||
case GSM_MANAGER_PHASE_INITIALIZATION:
|
||||
diff -up gnome-session-2.31.6/gnome-session/gsm-util.c.nag-root-user gnome-session-2.31.6/gnome-session/gsm-util.c
|
||||
--- gnome-session-2.31.6/gnome-session/gsm-util.c.nag-root-user 2010-02-09 08:22:01.000000000 -0500
|
||||
+++ gnome-session-2.31.6/gnome-session/gsm-util.c 2010-08-06 20:18:36.338048001 -0400
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <dbus/dbus-glib.h>
|
||||
|
||||
#include "gsm-util.h"
|
||||
+#include "gsm-gconf.h"
|
||||
|
||||
static gchar *_saved_session_dir = NULL;
|
||||
|
||||
@@ -373,6 +374,69 @@ gsm_util_init_error (gboolean fatal,
|
||||
}
|
||||
|
||||
/**
|
||||
+ * gsm_util_nag_message:
|
||||
+ * @key: gconf configuration key to save user's "don't nag me" state
|
||||
+ * @nag_only_once: Initial state of the "don't nag me" checkbox
|
||||
+ * @format: printf-style error message format
|
||||
+ * @...: error message args
|
||||
+ *
|
||||
+ * Displays a nag message to the user along with a check button that says something
|
||||
+ * like "Don't show this again". If @nag_only_once is %TRUE, the check button will
|
||||
+ * default to checked. The state of the dialog is stored as a boolean at the
|
||||
+ * gconf path specified by @key
|
||||
+ *
|
||||
+ * This should be called for informative messages that the user may or may
|
||||
+ * not care about.
|
||||
+ **/
|
||||
+void
|
||||
+gsm_util_nag_message (const char *key,
|
||||
+ gboolean nag_only_once,
|
||||
+ const char *format, ...)
|
||||
+{
|
||||
+ GtkWidget *dialog;
|
||||
+ GtkWidget *content_area;
|
||||
+ GtkWidget *check_button;
|
||||
+ char *msg;
|
||||
+ va_list args;
|
||||
+ GConfClient *client;
|
||||
+ gboolean should_nag;
|
||||
+
|
||||
+ client = gconf_client_get_default ();
|
||||
+ should_nag = gconf_client_get_bool (client, key, NULL);
|
||||
+
|
||||
+ if (!should_nag) {
|
||||
+ goto out;
|
||||
+ }
|
||||
+
|
||||
+ va_start (args, format);
|
||||
+ msg = g_strdup_vprintf (format, args);
|
||||
+ va_end (args);
|
||||
+
|
||||
+ dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR,
|
||||
+ GTK_BUTTONS_CLOSE, "%s", msg);
|
||||
+
|
||||
+ g_free (msg);
|
||||
+
|
||||
+ content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog));
|
||||
+ check_button = gtk_check_button_new_with_label (_("Do not show me this again"));
|
||||
+
|
||||
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_button), nag_only_once != FALSE);
|
||||
+ gtk_widget_show (check_button);
|
||||
+
|
||||
+ gtk_container_add (GTK_CONTAINER (content_area), check_button);
|
||||
+
|
||||
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
|
||||
+ gtk_dialog_run (GTK_DIALOG (dialog));
|
||||
+
|
||||
+ should_nag = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_button)) == FALSE;
|
||||
+ gconf_client_set_bool (client, key, should_nag != FALSE, NULL);
|
||||
+ gtk_widget_destroy (dialog);
|
||||
+
|
||||
+out:
|
||||
+ g_object_unref (client);
|
||||
+}
|
||||
+
|
||||
+/**
|
||||
* gsm_util_generate_startup_id:
|
||||
*
|
||||
* Generates a new SM client ID.
|
||||
diff -up gnome-session-2.31.6/gnome-session/gsm-util.h.nag-root-user gnome-session-2.31.6/gnome-session/gsm-util.h
|
||||
--- gnome-session-2.31.6/gnome-session/gsm-util.h.nag-root-user 2010-02-09 08:22:01.000000000 -0500
|
||||
+++ gnome-session-2.31.6/gnome-session/gsm-util.h 2010-08-06 20:18:36.340048001 -0400
|
||||
@@ -41,6 +41,9 @@ gboolean gsm_util_text_is_blank
|
||||
|
||||
void gsm_util_init_error (gboolean fatal,
|
||||
const char *format, ...);
|
||||
+void gsm_util_nag_message (const char *key,
|
||||
+ gboolean nag_only_once,
|
||||
+ const char *format, ...);
|
||||
|
||||
char * gsm_util_generate_startup_id (void);
|
||||
|
@ -1,184 +0,0 @@
|
||||
From bf1b6e8843b5e72d4f5a62a34eb322b82e33c2df Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 7 Nov 2010 11:49:33 -0500
|
||||
Subject: [PATCH 1/2] manager: don't ever show inhibitor dialog if logout is forced
|
||||
|
||||
If logout is forced, we don't want to show the inhibitor dialog.
|
||||
A forced logout is one that shouldn't be "cancelable".
|
||||
|
||||
This commit prevents inhibitors from getting added if logout is
|
||||
forced.
|
||||
---
|
||||
gnome-session/gsm-manager.c | 24 +++++++++++++++++++++---
|
||||
1 files changed, 21 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
|
||||
index c85cea6..d15402f 100644
|
||||
--- a/gnome-session/gsm-manager.c
|
||||
+++ b/gnome-session/gsm-manager.c
|
||||
@@ -1193,6 +1193,12 @@ _on_query_end_session_timeout (GsmManager *manager)
|
||||
g_warning ("Client '%s' failed to reply before timeout",
|
||||
gsm_client_peek_id (l->data));
|
||||
|
||||
+ /* Don't add "not responding" inhibitors if logout is forced
|
||||
+ */
|
||||
+ if (manager->priv->forceful_logout) {
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
/* Add JIT inhibit for unresponsive client */
|
||||
if (GSM_IS_DBUS_CLIENT (l->data)) {
|
||||
bus_name = gsm_dbus_client_get_bus_name (l->data);
|
||||
@@ -1248,8 +1254,8 @@ do_phase_query_end_session (GsmManager *manager)
|
||||
(GsmStoreFunc)_client_query_end_session,
|
||||
&data);
|
||||
|
||||
- /* This phase doesn't time out. This separate timer is only used to
|
||||
- * show UI. */
|
||||
+ /* This phase doesn't time out unless logout is forced. Typically, this
|
||||
+ * separate timer is only used to show UI. */
|
||||
manager->priv->query_timeout_id = g_timeout_add_seconds (1, (GSourceFunc)_on_query_end_session_timeout, manager);
|
||||
}
|
||||
|
||||
@@ -1877,7 +1883,7 @@ on_client_end_session_response (GsmClient *client,
|
||||
|
||||
manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client);
|
||||
|
||||
- if (! is_ok) {
|
||||
+ if (! is_ok && !manager->priv->forceful_logout) {
|
||||
guint cookie;
|
||||
GsmInhibitor *inhibitor;
|
||||
char *app_id;
|
||||
@@ -3172,6 +3178,18 @@ gsm_manager_inhibit (GsmManager *manager,
|
||||
reason,
|
||||
flags);
|
||||
|
||||
+ if (manager->priv->forceful_logout) {
|
||||
+ GError *new_error;
|
||||
+
|
||||
+ new_error = g_error_new (GSM_MANAGER_ERROR,
|
||||
+ GSM_MANAGER_ERROR_GENERAL,
|
||||
+ "Forced logout cannot be inhibited");
|
||||
+ g_debug ("GsmManager: Unable to inhibit: %s", new_error->message);
|
||||
+ dbus_g_method_return_error (context, new_error);
|
||||
+ g_error_free (new_error);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+
|
||||
if (IS_STRING_EMPTY (app_id)) {
|
||||
GError *new_error;
|
||||
|
||||
--
|
||||
1.7.3.1
|
||||
|
||||
|
||||
From 8e6afcf1789c02692cf3b1ff3ee0a792d57e17a3 Mon Sep 17 00:00:00 2001
|
||||
From: Ray Strode <rstrode@redhat.com>
|
||||
Date: Sun, 7 Nov 2010 12:32:17 -0500
|
||||
Subject: [PATCH 2/2] manager: remove client from query clients list on disconnect
|
||||
|
||||
When the session manager enters the query end session phase,
|
||||
it temporarily adds all clients to the "query clients" list.
|
||||
|
||||
This list is used to track the progression of clients quitting.
|
||||
|
||||
If a client quits during the query end session phase instead of
|
||||
waiting until the end session phase, then it will get destroyed
|
||||
but not get removed from the query clients list.
|
||||
|
||||
This commit removes it from the query clients list in
|
||||
this case. It does this by explicitly invoking the end session
|
||||
response handler (in effect, the client responded to the end
|
||||
session query by exiting).
|
||||
---
|
||||
gnome-session/gsm-manager.c | 53 ++++++++++++++++++++++++++++++++++++++-----
|
||||
1 files changed, 47 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
|
||||
index d15402f..d1fecb9 100644
|
||||
--- a/gnome-session/gsm-manager.c
|
||||
+++ b/gnome-session/gsm-manager.c
|
||||
@@ -164,6 +164,13 @@ static void gsm_manager_finalize (GObject *object);
|
||||
static gboolean auto_save_is_enabled (GsmManager *manager);
|
||||
static void maybe_save_session (GsmManager *manager);
|
||||
|
||||
+static void _handle_client_end_session_response (GsmManager *manager,
|
||||
+ GsmClient *client,
|
||||
+ gboolean is_ok,
|
||||
+ gboolean do_last,
|
||||
+ gboolean cancel,
|
||||
+ const char *reason);
|
||||
+
|
||||
static gpointer manager_object = NULL;
|
||||
|
||||
G_DEFINE_TYPE (GsmManager, gsm_manager, G_TYPE_OBJECT)
|
||||
@@ -1516,6 +1523,24 @@ _disconnect_client (GsmManager *manager,
|
||||
}
|
||||
}
|
||||
|
||||
+ if (manager->priv->phase == GSM_MANAGER_PHASE_QUERY_END_SESSION) {
|
||||
+ /* Instead of answering our end session query, the client just exited.
|
||||
+ * Treat that as an "okay, end the session" answer.
|
||||
+ *
|
||||
+ * This call implicitly removes any inhibitors for the client, along
|
||||
+ * with removing the client from the pending query list.
|
||||
+ */
|
||||
+ _handle_client_end_session_response (manager,
|
||||
+ client,
|
||||
+ TRUE,
|
||||
+ FALSE,
|
||||
+ FALSE,
|
||||
+ "Client exited in "
|
||||
+ "query end session phase "
|
||||
+ "instead of end session "
|
||||
+ "phase");
|
||||
+ }
|
||||
+
|
||||
if (app == NULL) {
|
||||
g_debug ("GsmManager: unable to find application for client - not restarting");
|
||||
goto out;
|
||||
@@ -1862,12 +1887,12 @@ out:
|
||||
}
|
||||
|
||||
static void
|
||||
-on_client_end_session_response (GsmClient *client,
|
||||
- gboolean is_ok,
|
||||
- gboolean do_last,
|
||||
- gboolean cancel,
|
||||
- const char *reason,
|
||||
- GsmManager *manager)
|
||||
+_handle_client_end_session_response (GsmManager *manager,
|
||||
+ GsmClient *client,
|
||||
+ gboolean is_ok,
|
||||
+ gboolean do_last,
|
||||
+ gboolean cancel,
|
||||
+ const char *reason)
|
||||
{
|
||||
/* just ignore if received outside of shutdown */
|
||||
if (manager->priv->phase < GSM_MANAGER_PHASE_QUERY_END_SESSION) {
|
||||
@@ -1952,6 +1977,22 @@ on_client_end_session_response (GsmClient *client,
|
||||
}
|
||||
|
||||
static void
|
||||
+on_client_end_session_response (GsmClient *client,
|
||||
+ gboolean is_ok,
|
||||
+ gboolean do_last,
|
||||
+ gboolean cancel,
|
||||
+ const char *reason,
|
||||
+ GsmManager *manager)
|
||||
+{
|
||||
+ _handle_client_end_session_response (manager,
|
||||
+ client,
|
||||
+ is_ok,
|
||||
+ do_last,
|
||||
+ cancel,
|
||||
+ reason);
|
||||
+}
|
||||
+
|
||||
+static void
|
||||
on_xsmp_client_logout_request (GsmXSMPClient *client,
|
||||
gboolean show_dialog,
|
||||
GsmManager *manager)
|
||||
--
|
||||
1.7.3.1
|
||||
|
Loading…
Reference in New Issue
Block a user