copy F12 work over

This commit is contained in:
Matthias Clasen 2009-11-02 05:06:56 +00:00
parent 86c7ce28a0
commit 10e0e68ecd
6 changed files with 267 additions and 708 deletions

View File

@ -10,7 +10,7 @@
Summary: GNOME session manager
Name: gnome-session
Version: 2.28.0
Release: 1%{?dist}
Release: 2%{?dist}
URL: http://www.gnome.org
Source0: http://download.gnome.org/sources/gnome-session/2.28/%{name}-%{version}.tar.bz2
Source2: gnome.desktop
@ -67,6 +67,12 @@ Requires(pre): GConf2 >= %{gconf2_version}
Requires(post): GConf2 >= %{gconf2_version}
Requires(preun): GConf2 >= %{gconf2_version}
# https://bugzilla.gnome.org/show_bug.cgi?id=592520
#Patch0: unresponsive-timeout.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=592519
#Patch1: show-lock.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=598211
Patch2: xsmp-stop.patch
%description
gnome-session manages a GNOME desktop or GDM login session. It starts up
@ -82,6 +88,9 @@ Desktop file to add GNOME to display manager session menu.
%prep
%setup -q
#%patch0 -p1 -b .unresponsive-timeout
#%patch1 -p1 -b .show-lock
%patch2 -p1 -b .xsmp-stop
echo "ACLOCAL_AMFLAGS = -I m4" >> Makefile.am
@ -169,6 +178,9 @@ fi
%changelog
* Fri Oct 23 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-2
- Avoid a crash on certain xsmp error conditions
* Wed Sep 23 2009 Matthias Clasen <mclasen@redhat.com> - 2.28.0-1
- Update to 2.28.0

View File

@ -1,695 +0,0 @@
diff -up gnome-session-2.27.5/configure.in.polkit1 gnome-session-2.27.5/configure.in
--- gnome-session-2.27.5/configure.in.polkit1 2009-07-28 21:51:22.000000000 -0400
+++ gnome-session-2.27.5/configure.in 2009-07-28 23:05:25.662498945 -0400
@@ -33,7 +33,7 @@ AC_ARG_WITH(at-spi-registryd-directory,
AT_SPI_REGISTRYD_DIR=$with_at_spi_registryd_directory
AC_SUBST(AT_SPI_REGISTRYD_DIR)
-GNOME_COMPILE_WARNINGS(maximum)
+
AC_ARG_ENABLE(deprecations,
[AC_HELP_STRING([--enable-deprecations],
@@ -49,7 +49,6 @@ GLIB_REQUIRED=2.16.0
LIBGNOMEUI_REQUIRED=2.2.0
GTK_REQUIRED=2.12.0
DBUS_GLIB_REQUIRED=0.76
-POLKIT_GNOME_REQUIRED=0.7
DEVKIT_POWER_REQUIRED=008
dnl ====================================================================
@@ -89,22 +88,6 @@ PKG_CHECK_MODULES(GCONF, gconf-2.0)
PKG_CHECK_MODULES(EGG_SMCLIENT, gtk+-2.0)
-have_polkit=no
-AC_ARG_ENABLE([polkit],
- AC_HELP_STRING([--enable-polkit], [Enable PolicyKit support (default auto)]),
- enable_polkit=$enableval,
- enable_polkit=auto)
-if test "x$enable_polkit" != "xno"; then
- PKG_CHECK_MODULES(POLKIT_GNOME, polkit-gnome >= $POLKIT_GNOME_REQUIRED, have_polkit=yes, have_polkit=no)
- if test "x$enable_polkit" = "xyes" -a "x$have_polkit" = "xno"; then
- AC_MSG_ERROR([PolicyKit support explicitly requested but dependencies not found])
- fi
-fi
-
-if test "x$have_polkit" = "xyes"; then
- AC_DEFINE(HAVE_POLKIT_GNOME, [1], [whether PolKit GNOME was found])
-fi
-
dnl ====================================================================
dnl Option to set the default window manager
dnl ====================================================================
diff -up gnome-session-2.27.5/gnome-session/gsm-consolekit.c.polkit1 gnome-session-2.27.5/gnome-session/gsm-consolekit.c
--- gnome-session-2.27.5/gnome-session/gsm-consolekit.c.polkit1 2009-07-28 21:29:27.000000000 -0400
+++ gnome-session-2.27.5/gnome-session/gsm-consolekit.c 2009-07-28 22:58:49.369736767 -0400
@@ -31,10 +31,6 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus-glib-lowlevel.h>
-#ifdef HAVE_POLKIT_GNOME
-#include <polkit-gnome/polkit-gnome.h>
-#endif
-
#include "gsm-marshal.h"
#include "gsm-consolekit.h"
@@ -465,177 +461,6 @@ emit_stop_complete (GsmConsolekit *manag
}
}
-#ifdef HAVE_POLKIT_GNOME
-static void
-system_restart_auth_cb (PolKitAction *action,
- gboolean gained_privilege,
- GError *error,
- GsmConsolekit *manager)
-{
- GError *local_error;
- gboolean res;
-
- if (!gained_privilege) {
- if (error != NULL) {
- emit_restart_complete (manager, error);
- }
-
- return;
- }
-
- local_error = NULL;
-
- res = try_system_restart (manager->priv->dbus_connection, &local_error);
-
- if (!res) {
- g_warning ("Unable to restart system: %s", local_error->message);
- emit_restart_complete (manager, local_error);
- g_error_free (local_error);
- } else {
- emit_restart_complete (manager, NULL);
- }
-}
-
-static void
-system_stop_auth_cb (PolKitAction *action,
- gboolean gained_privilege,
- GError *error,
- GsmConsolekit *manager)
-{
- GError *local_error;
- gboolean res;
-
- if (!gained_privilege) {
- if (error != NULL) {
- emit_stop_complete (manager, error);
- }
-
- return;
- }
-
- local_error = NULL;
-
- res = try_system_stop (manager->priv->dbus_connection, &local_error);
-
- if (!res) {
- g_warning ("Unable to stop system: %s", local_error->message);
- emit_stop_complete (manager, local_error);
- g_error_free (local_error);
- } else {
- emit_stop_complete (manager, NULL);
- }
-}
-
-static PolKitAction *
-get_action_from_error (GError *error)
-{
- PolKitAction *action;
- char *paction;
-
- action = polkit_action_new ();
-
- paction = NULL;
- if (g_str_has_prefix (error->message, "Not privileged for action: ")) {
- paction = g_strdup (error->message + strlen ("Not privileged for action: "));
- if (paction != NULL) {
- char *p;
-
- /* after 0.2.10 the error also includes the PK results */
- p = strchr (paction, ' ');
- if (p != NULL) {
- *p = '\0';
- }
- }
- }
-
- polkit_action_set_action_id (action, paction);
-
- g_free (paction);
-
- return action;
-}
-#endif /* HAVE_POLKIT_GNOME */
-
-static void
-request_restart_priv (GsmConsolekit *manager,
- GError *error)
-{
-#ifdef HAVE_POLKIT_GNOME
- PolKitAction *action;
- pid_t pid;
- gboolean res = FALSE;
- guint xid;
- GError *local_error;
-
- action = get_action_from_error (error);
-
- xid = 0;
- pid = getpid ();
-
- local_error = NULL;
- res = polkit_gnome_auth_obtain (action,
- xid,
- pid,
- (PolKitGnomeAuthCB) system_restart_auth_cb,
- manager,
- &local_error);
-
- polkit_action_unref (action);
-
- if (!res) {
- if (local_error != NULL) {
- g_warning ("Unable to obtain auth to restart system: %s",
- local_error->message);
-
- emit_restart_complete (manager, local_error);
- g_error_free (local_error);
- }
- }
-#else
- g_assert_not_reached ();
-#endif /* HAVE POLKIT */
-}
-
-static void
-request_stop_priv (GsmConsolekit *manager,
- GError *error)
-{
-#ifdef HAVE_POLKIT_GNOME
- PolKitAction *action;
- pid_t pid;
- gboolean res = FALSE;
- guint xid;
- GError *local_error;
-
- action = get_action_from_error (error);
-
- xid = 0;
- pid = getpid ();
-
- local_error = NULL;
- res = polkit_gnome_auth_obtain (action,
- xid,
- pid,
- (PolKitGnomeAuthCB) system_stop_auth_cb,
- manager,
- &local_error);
-
- polkit_action_unref (action);
-
- if (!res) {
- if (local_error != NULL) {
- g_warning ("Unable to obtain auth to stop system: %s",
- local_error->message);
-
- emit_stop_complete (manager, local_error);
- g_error_free (local_error);
- }
- }
-#else
- g_assert_not_reached ();
-#endif /* HAVE POLKIT */
-}
-
void
gsm_consolekit_attempt_restart (GsmConsolekit *manager)
{
@@ -652,16 +477,16 @@ gsm_consolekit_attempt_restart (GsmConso
return;
}
- res = try_system_restart (manager->priv->dbus_connection, &error);
+ res = dbus_g_proxy_call_with_timeout (manager->priv->ck_proxy,
+ "Restart",
+ INT_MAX,
+ error,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
if (!res) {
- if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
- request_restart_priv (manager, error);
- } else {
- g_warning ("Unable to restart system: %s", error->message);
- emit_restart_complete (manager, error);
- }
-
+ g_warning ("Unable to restart system: %s", error->message);
+ emit_restart_complete (manager, error);
g_error_free (error);
} else {
emit_restart_complete (manager, NULL);
@@ -684,16 +509,16 @@ gsm_consolekit_attempt_stop (GsmConsolek
return;
}
- res = try_system_stop (manager->priv->dbus_connection, &error);
+ res = dbus_g_proxy_call_with_timeout (manager->priv->ck_proxy,
+ "Stop",
+ INT_MAX,
+ error,
+ G_TYPE_INVALID,
+ G_TYPE_INVALID);
if (!res) {
- if (dbus_g_error_has_name (error, "org.freedesktop.ConsoleKit.Manager.NotPrivileged")) {
- request_stop_priv (manager, error);
- } else {
- g_warning ("Unable to stop system: %s", error->message);
- emit_stop_complete (manager, error);
- }
-
+ g_warning ("Unable to stop system: %s", error->message);
+ emit_stop_complete (manager, error);
g_error_free (error);
} else {
emit_stop_complete (manager, NULL);
@@ -969,347 +794,78 @@ gsm_consolekit_can_switch_user (GsmConso
return ret;
}
-#ifdef HAVE_POLKIT_GNOME
-static PolKitResult
-gsm_consolekit_get_result_for_action (GsmConsolekit *manager,
- const char *action_id)
-{
- PolKitGnomeContext *gnome_context;
- PolKitAction *action;
- PolKitCaller *caller;
- DBusError dbus_error;
- PolKitError *error;
- PolKitResult result;
-
- gnome_context = polkit_gnome_context_get (NULL);
-
- if (gnome_context == NULL) {
- return POLKIT_RESULT_UNKNOWN;
- }
-
- if (gnome_context->pk_tracker == NULL) {
- return POLKIT_RESULT_UNKNOWN;
- }
-
- dbus_error_init (&dbus_error);
- caller = polkit_tracker_get_caller_from_pid (gnome_context->pk_tracker,
- getpid (),
- &dbus_error);
- dbus_error_free (&dbus_error);
-
- if (caller == NULL) {
- return POLKIT_RESULT_UNKNOWN;
- }
+gboolean
+gsm_consolekit_get_restart_privileges (GsmConsolekit *manager)
+{
+ g_signal_emit (G_OBJECT (manager),
+ signals [PRIVILEGES_COMPLETED],
+ 0, TRUE, TRUE, NULL);
- action = polkit_action_new ();
- if (!polkit_action_set_action_id (action, action_id)) {
- polkit_action_unref (action);
- polkit_caller_unref (caller);
- return POLKIT_RESULT_UNKNOWN;
- }
+ return TRUE;
+}
- error = NULL;
- result = polkit_context_is_caller_authorized (gnome_context->pk_context,
- action, caller, FALSE,
- &error);
- if (polkit_error_is_set (error)) {
- polkit_error_free (error);
- }
- polkit_action_unref (action);
- polkit_caller_unref (caller);
+gboolean
+gsm_consolekit_get_stop_privileges (GsmConsolekit *manager)
+{
+ g_signal_emit (G_OBJECT (manager),
+ signals [PRIVILEGES_COMPLETED],
+ 0, TRUE, TRUE, NULL);
- return result;
+ return TRUE;
}
-static gboolean
-gsm_consolekit_can_do_action (GsmConsolekit *manager,
- const char *action_id)
+gboolean
+gsm_consolekit_can_restart (GsmConsolekit *manager)
{
- PolKitResult result;
- gboolean res;
- GError *error;
+ gboolean res;
+ gboolean can_restart;
+ GError *error;
error = NULL;
- res = gsm_consolekit_ensure_ck_connection (manager, &error);
- if (!res) {
+
+ if (!gsm_consolekit_ensure_ck_connection (manager, &error)) {
g_warning ("Could not connect to ConsoleKit: %s",
error->message);
g_error_free (error);
- return FALSE;
+ return;
}
- result = gsm_consolekit_get_result_for_action (manager, action_id);
-
- return result != POLKIT_RESULT_NO && result != POLKIT_RESULT_UNKNOWN;
-}
-
-static gboolean
-gsm_consolekit_is_session_for_other_user (GsmConsolekit *manager,
- const char *object_path,
- unsigned int current_uid)
-{
- DBusGProxy *proxy;
- gboolean res;
- char *type;
- unsigned int uid;
-
- proxy = dbus_g_proxy_new_for_name (manager->priv->dbus_connection,
- CK_NAME,
- object_path,
- CK_SESSION_INTERFACE);
-
- res = dbus_g_proxy_call_with_timeout (proxy,
- "GetUnixUser",
- INT_MAX,
- NULL,
- /* parameters: */
- G_TYPE_INVALID,
- /* return values: */
- G_TYPE_UINT, &uid,
- G_TYPE_INVALID);
-
- /* error is bad: we consider there's another user */
- if (!res)
- return TRUE;
-
- if (uid == current_uid)
- return FALSE;
-
- /* filter out login sessions */
- res = dbus_g_proxy_call_with_timeout (proxy,
- "GetSessionType",
+ res = dbus_g_proxy_call_with_timeout (manager->priv->ck_proxy,
+ "CanRestart",
INT_MAX,
- NULL,
- /* parameters: */
+ error,
G_TYPE_INVALID,
- /* return values: */
- G_TYPE_STRING, &type,
+ G_TYPE_BOOLEAN, &can_restart,
G_TYPE_INVALID);
- /* error is bad: we consider there's another user */
- if (!res)
- return TRUE;
-
- if (g_strcmp0 (type, GSM_CONSOLEKIT_SESSION_TYPE_LOGIN_WINDOW) == 0) {
- g_free (type);
- return FALSE;
- }
-
- g_free (type);
-
- return TRUE;
+ return can_restart;
}
-static gboolean
-gsm_consolekit_is_single_user (GsmConsolekit *manager)
+gboolean
+gsm_consolekit_can_stop (GsmConsolekit *manager)
{
- DBusGProxy *proxy;
- GError *error;
- gboolean res;
- gboolean single;
- GPtrArray *array;
- unsigned int current_uid;
- int i;
-
- /* We use the same logic than the one used by ConsoleKit here -- it'd
- * be nice to have a ConsoleKit API to help us, but well...
- * If there's any error, we just assume it's multiple users. */
-
- proxy = dbus_g_proxy_new_for_name (manager->priv->dbus_connection,
- CK_NAME,
- CK_MANAGER_PATH,
- CK_MANAGER_INTERFACE);
+ gboolean res;
+ gboolean can_stop;
+ GError *error;
error = NULL;
- res = dbus_g_proxy_call_with_timeout (proxy,
- "GetSessions",
- INT_MAX,
- &error,
- /* parameters: */
- G_TYPE_INVALID,
- /* return values: */
- dbus_g_type_get_collection ("GPtrArray", DBUS_TYPE_G_OBJECT_PATH), &array,
- G_TYPE_INVALID);
-
- if (!res) {
- g_warning ("Unable to list sessions: %s", error->message);
- g_error_free (error);
- return FALSE;
- }
-
- single = TRUE;
- current_uid = getuid ();
-
- for (i = 0; i < array->len; i++) {
- char *object_path;
-
- object_path = g_ptr_array_index (array, i);
-
- if (gsm_consolekit_is_session_for_other_user (manager,
- object_path,
- current_uid)) {
- single = FALSE;
- break;
- }
- }
-
- g_ptr_array_foreach (array, (GFunc) g_free, NULL);
- g_ptr_array_free (array, TRUE);
-
- return single;
-}
-static void
-obtain_privileges_cb (PolKitAction *action,
- gboolean gained_privilege,
- GError *error,
- GsmConsolekit *manager)
-{
- g_signal_emit (G_OBJECT (manager),
- signals [PRIVILEGES_COMPLETED],
- 0, gained_privilege, FALSE, error);
-}
-
-static gboolean
-gsm_consolekit_obtain_privileges_for_action (GsmConsolekit *manager,
- const char *action_id)
-{
- PolKitAction *action;
- pid_t pid;
- guint xid;
- gboolean res;
-
- action = polkit_action_new ();
- polkit_action_set_action_id (action, action_id);
-
- xid = 0;
- pid = getpid ();
-
- res = polkit_gnome_auth_obtain (action,
- xid,
- pid,
- (PolKitGnomeAuthCB) obtain_privileges_cb,
- manager,
- NULL);
-
- polkit_action_unref (action);
-
- return res;
-}
-
-static gboolean
-gsm_consolekit_get_privileges_for_actions (GsmConsolekit *manager,
- const char *single_action_id,
- const char *multiple_action_id)
-{
- PolKitResult result;
- gboolean res;
- GError *error;
- const char *action_id;
-
- error = NULL;
- res = gsm_consolekit_ensure_ck_connection (manager, &error);
- if (!res) {
+ if (!gsm_consolekit_ensure_ck_connection (manager, &error)) {
g_warning ("Could not connect to ConsoleKit: %s",
error->message);
g_error_free (error);
- return FALSE;
- }
-
- if (gsm_consolekit_is_single_user (manager)) {
- action_id = single_action_id;
- } else {
- action_id = multiple_action_id;
- }
-
- result = gsm_consolekit_get_result_for_action (manager, action_id);
-
- switch (result) {
- case POLKIT_RESULT_UNKNOWN:
- case POLKIT_RESULT_NO:
- return FALSE;
- case POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH:
- case POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_SESSION:
- case POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_KEEP_ALWAYS:
- case POLKIT_RESULT_ONLY_VIA_SELF_AUTH:
- case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_SESSION:
- case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_KEEP_ALWAYS:
- if (!gsm_consolekit_obtain_privileges_for_action (manager,
- action_id)) {
- /* if the call doesn't work, then we were not even able
- * to do the call requesting the privileges: the setup
- * is likely broken */
- return FALSE;
- }
- break;
- case POLKIT_RESULT_YES:
- g_signal_emit (G_OBJECT (manager),
- signals [PRIVILEGES_COMPLETED],
- 0, TRUE, FALSE, NULL);
- break;
- case POLKIT_RESULT_ONLY_VIA_ADMIN_AUTH_ONE_SHOT:
- case POLKIT_RESULT_ONLY_VIA_SELF_AUTH_ONE_SHOT:
- g_signal_emit (G_OBJECT (manager),
- signals [PRIVILEGES_COMPLETED],
- 0, TRUE, TRUE, NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
+ return;
}
- return TRUE;
-}
-#endif
-
-gboolean
-gsm_consolekit_get_restart_privileges (GsmConsolekit *manager)
-{
-#ifdef HAVE_POLKIT_GNOME
- return gsm_consolekit_get_privileges_for_actions (manager,
- "org.freedesktop.consolekit.system.restart",
- "org.freedesktop.consolekit.system.restart-multiple-users");
-#else
- g_debug ("GsmConsolekit: built without PolicyKit-gnome support");
- return FALSE;
-#endif
-}
-
-gboolean
-gsm_consolekit_get_stop_privileges (GsmConsolekit *manager)
-{
-#ifdef HAVE_POLKIT_GNOME
- return gsm_consolekit_get_privileges_for_actions (manager,
- "org.freedesktop.consolekit.system.stop",
- "org.freedesktop.consolekit.system.stop-multiple-users");
-#else
- g_debug ("GsmConsolekit: built without PolicyKit-gnome support");
- return FALSE;
-#endif
-}
-
-gboolean
-gsm_consolekit_can_restart (GsmConsolekit *manager)
-{
-#ifdef HAVE_POLKIT_GNOME
- return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart") ||
- gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.restart-multiple-users");
-#else
- g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot restart system");
- return FALSE;
-#endif
-}
+ res = dbus_g_proxy_call_with_timeout (manager->priv->ck_proxy,
+ "CanStop",
+ INT_MAX,
+ error,
+ G_TYPE_INVALID,
+ G_TYPE_BOOLEAN, &can_stop,
+ G_TYPE_INVALID);
-gboolean
-gsm_consolekit_can_stop (GsmConsolekit *manager)
-{
-#ifdef HAVE_POLKIT_GNOME
- return gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop") ||
- gsm_consolekit_can_do_action (manager, "org.freedesktop.consolekit.system.stop-multiple-users");
-#else
- g_debug ("GsmConsolekit: built without PolicyKit-gnome support - cannot stop system");
- return FALSE;
-#endif
+ return can_stop;
}
gchar *
diff -up gnome-session-2.27.5/gnome-session/Makefile.am.polkit1 gnome-session-2.27.5/gnome-session/Makefile.am
--- gnome-session-2.27.5/gnome-session/Makefile.am.polkit1 2009-07-28 21:51:22.000000000 -0400
+++ gnome-session-2.27.5/gnome-session/Makefile.am 2009-07-28 22:58:49.370735427 -0400
@@ -16,7 +16,6 @@ INCLUDES = \
$(ICE_CFLAGS) \
$(GNOME_SESSION_CFLAGS) \
$(GCONF_CFLAGS) \
- $(POLKIT_GNOME_CFLAGS) \
-I$(top_srcdir)/egg \
-DLOCALE_DIR=\""$(datadir)/locale"\" \
-DDATA_DIR=\""$(datadir)/gnome-session"\" \
@@ -50,7 +49,6 @@ gnome_session_LDADD = \
$(ICE_LIBS) \
$(GNOME_SESSION_LIBS) \
$(GCONF_LIBS) \
- $(POLKIT_GNOME_LIBS) \
$(XRENDER_LIBS) \
$(XTEST_LIBS) \
$(EXECINFO_LIBS) \

114
show-lock.patch Normal file
View File

@ -0,0 +1,114 @@
diff -up gnome-session-2.28.0/gnome-session/gsm-inhibit-dialog.c.show-lock gnome-session-2.28.0/gnome-session/gsm-inhibit-dialog.c
--- gnome-session-2.28.0/gnome-session/gsm-inhibit-dialog.c.show-lock 2009-08-25 04:03:42.000000000 -0400
+++ gnome-session-2.28.0/gnome-session/gsm-inhibit-dialog.c 2009-10-14 10:50:42.337489281 -0400
@@ -71,13 +71,16 @@ struct GsmInhibitDialogPrivate
gboolean have_xrender;
int xrender_event_base;
int xrender_error_base;
+ gboolean show_lock;
+ GtkWidget *lock_button;
};
enum {
PROP_0,
PROP_ACTION,
PROP_INHIBITOR_STORE,
- PROP_CLIENT_STORE
+ PROP_CLIENT_STORE,
+ PROP_SHOW_LOCK
};
enum {
@@ -134,6 +137,15 @@ gsm_inhibit_dialog_set_action (GsmInhibi
dialog->priv->action = action;
}
+static void
+gsm_inhibit_dialog_set_show_lock (GsmInhibitDialog *dialog,
+ gboolean show_lock)
+{
+ dialog->priv->show_lock = show_lock;
+ gtk_widget_set_no_show_all (dialog->priv->lock_button, TRUE);
+ gtk_widget_set_visible (dialog->priv->lock_button, show_lock);
+}
+
static gboolean
find_inhibitor (GsmInhibitDialog *dialog,
const char *id,
@@ -809,6 +821,9 @@ gsm_inhibit_dialog_set_property (GObject
case PROP_CLIENT_STORE:
gsm_inhibit_dialog_set_client_store (dialog, g_value_get_object (value));
break;
+ case PROP_SHOW_LOCK:
+ gsm_inhibit_dialog_set_show_lock (dialog, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -833,6 +848,9 @@ gsm_inhibit_dialog_get_property (GObject
case PROP_CLIENT_STORE:
g_value_set_object (value, dialog->priv->clients);
break;
+ case PROP_SHOW_LOCK:
+ g_value_set_boolean (value, dialog->priv->show_lock);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -920,9 +938,10 @@ setup_dialog (GsmInhibitDialog *dialog)
break;
}
- gtk_dialog_add_button (GTK_DIALOG (dialog),
- _("Lock Screen"),
- DIALOG_RESPONSE_LOCK_SCREEN);
+ dialog->priv->lock_button =
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("Lock Screen"),
+ DIALOG_RESPONSE_LOCK_SCREEN);
gtk_dialog_add_button (GTK_DIALOG (dialog),
_("Cancel"),
GTK_RESPONSE_CANCEL);
@@ -1006,6 +1025,7 @@ gsm_inhibit_dialog_constructor (GType
setup_dialog (dialog);
gtk_widget_show_all (GTK_WIDGET (dialog));
+ gsm_inhibit_dialog_set_show_lock (dialog, TRUE);
return G_OBJECT (dialog);
}
@@ -1082,6 +1102,14 @@ gsm_inhibit_dialog_class_init (GsmInhibi
GSM_TYPE_STORE,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
+ PROP_SHOW_LOCK,
+ g_param_spec_boolean ("show-lock",
+ NULL,
+ NULL,
+ TRUE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+
g_type_class_add_private (klass, sizeof (GsmInhibitDialogPrivate));
}
@@ -1094,6 +1122,8 @@ gsm_inhibit_dialog_init (GsmInhibitDialo
dialog->priv = GSM_INHIBIT_DIALOG_GET_PRIVATE (dialog);
+ dialog->priv->show_lock = TRUE;
+
dialog->priv->xml = gtk_builder_new ();
gtk_builder_set_translation_domain (dialog->priv->xml, GETTEXT_PACKAGE);
diff -up gnome-session-2.28.0/gnome-session/gsm-manager.c.show-lock gnome-session-2.28.0/gnome-session/gsm-manager.c
--- gnome-session-2.28.0/gnome-session/gsm-manager.c.show-lock 2009-10-14 10:50:42.313467505 -0400
+++ gnome-session-2.28.0/gnome-session/gsm-manager.c 2009-10-14 10:51:32.889465604 -0400
@@ -1200,6 +1200,7 @@ query_end_session_complete (GsmManager *
G_CALLBACK (inhibit_dialog_response),
manager);
if (! gsm_manager_has_responsive_inhibitor (manager)) {
+ g_object_set (manager->priv->inhibit_dialog, "show-lock", FALSE, NULL);
manager->priv->inhibit_timeout_id =
g_timeout_add_seconds (120, on_inhibit_dialog_timeout, manager);
}

119
unresponsive-timeout.patch Normal file
View File

@ -0,0 +1,119 @@
diff -up gnome-session-2.28.0/gnome-session/gsm-manager.c.unresponsive-timeout gnome-session-2.28.0/gnome-session/gsm-manager.c
--- gnome-session-2.28.0/gnome-session/gsm-manager.c.unresponsive-timeout 2009-09-18 12:36:04.000000000 -0400
+++ gnome-session-2.28.0/gnome-session/gsm-manager.c 2009-10-14 10:49:34.724468379 -0400
@@ -122,6 +122,7 @@ struct GsmManagerPrivate
GsmManagerLogoutType logout_type;
GtkWidget *inhibit_dialog;
+ guint inhibit_timeout_id;
/* List of clients which were disconnected due to disabled condition
* and shouldn't be automatically restarted */
@@ -797,6 +798,24 @@ inhibitor_has_flag (gpointer key,
}
static gboolean
+is_responsive_inhibitor (gpointer key,
+ GsmInhibitor *inhibitor,
+ gpointer data)
+{
+ guint flag;
+ guint flags;
+ const gchar *reason;
+
+ flag = GPOINTER_TO_UINT (data);
+
+ flags = gsm_inhibitor_peek_flags (inhibitor);
+ reason = gsm_inhibitor_peek_reason (inhibitor);
+
+ return (flags & flag) &&
+ g_strcmp0 (_("Not responding"), reason) != 0;
+}
+
+static gboolean
gsm_manager_is_logout_inhibited (GsmManager *manager)
{
GsmInhibitor *inhibitor;
@@ -833,6 +852,24 @@ gsm_manager_is_idle_inhibited (GsmManage
}
static gboolean
+gsm_manager_has_responsive_inhibitor (GsmManager *manager)
+{
+ GsmInhibitor *inhibitor;
+
+ if (manager->priv->inhibitors == NULL) {
+ return FALSE;
+ }
+
+ inhibitor = (GsmInhibitor *)gsm_store_find (manager->priv->inhibitors,
+ (GsmStoreFunc)is_responsive_inhibitor,
+ GUINT_TO_POINTER (GSM_INHIBITOR_FLAG_LOGOUT));
+ if (inhibitor == NULL) {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+static gboolean
_client_cancel_end_session (const char *id,
GsmClient *client,
GsmManager *manager)
@@ -1055,6 +1092,11 @@ inhibit_dialog_response (GsmInhibitDialo
g_debug ("GsmManager: Inhibit dialog response: %d", response_id);
+ if (manager->priv->inhibit_timeout_id > 0) {
+ g_source_remove (manager->priv->inhibit_timeout_id);
+ manager->priv->inhibit_timeout_id = 0;
+ }
+
/* must destroy dialog before cancelling since we'll
remove JIT inhibitors and we don't want to trigger
action. */
@@ -1085,6 +1127,20 @@ inhibit_dialog_response (GsmInhibitDialo
}
}
+static gboolean
+on_inhibit_dialog_timeout (gpointer data)
+{
+ GsmManager *manager = data;
+
+ manager->priv->inhibit_timeout_id = 0;
+
+ inhibit_dialog_response (GSM_INHIBIT_DIALOG (manager->priv->inhibit_dialog),
+ GTK_RESPONSE_ACCEPT,
+ manager);
+
+ return FALSE;
+}
+
static void
query_end_session_complete (GsmManager *manager)
{
@@ -1143,8 +1199,11 @@ query_end_session_complete (GsmManager *
"response",
G_CALLBACK (inhibit_dialog_response),
manager);
+ if (! gsm_manager_has_responsive_inhibitor (manager)) {
+ manager->priv->inhibit_timeout_id =
+ g_timeout_add_seconds (120, on_inhibit_dialog_timeout, manager);
+ }
gtk_widget_show (manager->priv->inhibit_dialog);
-
}
static guint32
@@ -2459,6 +2518,11 @@ gsm_manager_finalize (GObject *object)
g_return_if_fail (manager->priv != NULL);
+ if (manager->priv->inhibit_timeout_id > 0) {
+ g_source_remove (manager->priv->inhibit_timeout_id);
+ manager->priv->inhibit_timeout_id = 0;
+ }
+
G_OBJECT_CLASS (gsm_manager_parent_class)->finalize (object);
}

View File

@ -1,12 +0,0 @@
diff -up gnome-session-2.26.1/gnome-session/gs-idle-monitor.c.watch-spew gnome-session-2.26.1/gnome-session/gs-idle-monitor.c
--- gnome-session-2.26.1/gnome-session/gs-idle-monitor.c.watch-spew 2009-04-14 11:31:45.000000000 -0400
+++ gnome-session-2.26.1/gnome-session/gs-idle-monitor.c 2009-07-13 16:30:09.454700964 -0400
@@ -188,7 +188,7 @@ handle_alarm_notify_event (GSIdleMonitor
watch = find_watch_for_alarm (monitor, alarm_event->alarm);
if (watch == NULL) {
- g_warning ("Unable to find watch for alarm %d", (int)alarm_event->alarm);
+ g_debug ("Unable to find watch for alarm %d", (int)alarm_event->alarm);
return;
}

21
xsmp-stop.patch Normal file
View File

@ -0,0 +1,21 @@
diff -up gnome-session-2.28.0/gnome-session/gsm-xsmp-client.c.xsmp-stop gnome-session-2.28.0/gnome-session/gsm-xsmp-client.c
--- gnome-session-2.28.0/gnome-session/gsm-xsmp-client.c.xsmp-stop 2009-10-23 10:47:51.555179151 -0400
+++ gnome-session-2.28.0/gnome-session/gsm-xsmp-client.c 2009-10-23 10:47:10.255456283 -0400
@@ -713,6 +713,17 @@ xsmp_stop (GsmClient *client,
g_debug ("GsmXSMPClient: xsmp_stop ('%s')", xsmp->priv->description);
+ /*FIXME: What do we do if the client can't be stoped ?
+ * (probably a cleaner solution exists...)
+ */
+ if (xsmp->priv->conn == NULL) {
+ g_set_error (error,
+ GSM_CLIENT_ERROR,
+ GSM_CLIENT_ERROR_NOT_REGISTERED,
+ "Client is not registered");
+ return FALSE;
+ }
+
SmsDie (xsmp->priv->conn);
return TRUE;