[gnome-session] manager: drop request-privileges stuff



commit cc8a3cdad278e0646c9b53b091ba7988acc501eb
Author: Ray Strode <rstrode redhat com>
Date:   Mon Mar 21 13:54:38 2011 -0400

    manager: drop request-privileges stuff
    
    It's all a farce that immediately returns with hardcoded values.
    
    Eventually, we need a better story here (see bug 585614), but for
    now, let's not pretend like we're doing something we aren't.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=645432

 gnome-session/gsm-consolekit.c |   32 ----------
 gnome-session/gsm-consolekit.h |    9 ---
 gnome-session/gsm-manager.c    |  123 +++-------------------------------------
 3 files changed, 9 insertions(+), 155 deletions(-)
---
diff --git a/gnome-session/gsm-consolekit.c b/gnome-session/gsm-consolekit.c
index e8dd726..530ac39 100644
--- a/gnome-session/gsm-consolekit.c
+++ b/gnome-session/gsm-consolekit.c
@@ -61,7 +61,6 @@ enum {
 
 enum {
         REQUEST_COMPLETED = 0,
-        PRIVILEGES_COMPLETED,
         LAST_SIGNAL
 };
 
@@ -137,17 +136,6 @@ gsm_consolekit_class_init (GsmConsolekitClass *manager_class)
                               G_TYPE_NONE,
                               1, G_TYPE_POINTER);
 
-        signals [PRIVILEGES_COMPLETED] =
-                g_signal_new ("privileges-completed",
-                              G_OBJECT_CLASS_TYPE (object_class),
-                              G_SIGNAL_RUN_LAST,
-                              G_STRUCT_OFFSET (GsmConsolekitClass, privileges_completed),
-                              NULL,
-                              NULL,
-                              gsm_marshal_VOID__BOOLEAN_BOOLEAN_POINTER,
-                              G_TYPE_NONE,
-                              3, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_POINTER);
-
         g_type_class_add_private (manager_class, sizeof (GsmConsolekitPrivate));
 }
 
@@ -749,26 +737,6 @@ gsm_consolekit_can_switch_user (GsmConsolekit *manager)
 }
 
 gboolean
-gsm_consolekit_get_restart_privileges (GsmConsolekit *manager)
-{
-	g_signal_emit (G_OBJECT (manager),
-		       signals [PRIVILEGES_COMPLETED],
-		       0, TRUE, TRUE, NULL);
-
-	return TRUE;
-}
-
-gboolean
-gsm_consolekit_get_stop_privileges (GsmConsolekit *manager)
-{
-	g_signal_emit (G_OBJECT (manager),
-		       signals [PRIVILEGES_COMPLETED],
-		       0, TRUE, TRUE, NULL);
-
-	return TRUE;
-}
-
-gboolean
 gsm_consolekit_can_restart (GsmConsolekit *manager)
 {
         gboolean res;
diff --git a/gnome-session/gsm-consolekit.h b/gnome-session/gsm-consolekit.h
index f80c130..870f74a 100644
--- a/gnome-session/gsm-consolekit.h
+++ b/gnome-session/gsm-consolekit.h
@@ -55,11 +55,6 @@ struct _GsmConsolekitClass
 
         void (* request_completed) (GsmConsolekit *manager,
                                     GError        *error);
-
-        void (* privileges_completed) (GsmConsolekit *manager,
-                                       gboolean       success,
-                                       gboolean       ask_later,
-                                       GError        *error);
 };
 
 enum _GsmConsolekitError {
@@ -77,10 +72,6 @@ GsmConsolekit   *gsm_consolekit_new             (void) G_GNUC_MALLOC;
 
 gboolean         gsm_consolekit_can_switch_user (GsmConsolekit *manager);
 
-gboolean         gsm_consolekit_get_restart_privileges (GsmConsolekit *manager);
-
-gboolean         gsm_consolekit_get_stop_privileges    (GsmConsolekit *manager);
-
 gboolean         gsm_consolekit_can_stop        (GsmConsolekit *manager);
 
 gboolean         gsm_consolekit_can_restart     (GsmConsolekit *manager);
diff --git a/gnome-session/gsm-manager.c b/gnome-session/gsm-manager.c
index ff0fe04..abbc223 100644
--- a/gnome-session/gsm-manager.c
+++ b/gnome-session/gsm-manager.c
@@ -2828,133 +2828,28 @@ gsm_manager_is_suspend_inhibited (GsmManager *manager)
 }
 
 static void
-request_reboot_privileges_completed (GsmConsolekit *consolekit,
-                                     gboolean       success,
-                                     gboolean       ask_later,
-                                     GError        *error,
-                                     GsmManager    *manager)
-{
-        /* make sure we disconnect the signal handler so that it's not called
-         * again next time the event is fired -- this can happen if the reboot
-         * is cancelled. */
-        g_signal_handlers_disconnect_by_func (consolekit,
-                                              request_reboot_privileges_completed,
-                                              manager);
-
-        g_object_unref (consolekit);
-
-        if (success) {
-                if (ask_later) {
-                        manager->priv->logout_type = GSM_MANAGER_LOGOUT_REBOOT_INTERACT;
-                } else {
-                        manager->priv->logout_type = GSM_MANAGER_LOGOUT_REBOOT;
-                }
-
-                end_phase (manager);
-        }
-}
-
-static void
 request_reboot (GsmManager *manager)
 {
-        GsmConsolekit *consolekit;
-        gboolean       success;
-
         g_debug ("GsmManager: requesting reboot");
 
-        /* We request the privileges before doing anything. There are a few
-         * different cases here:
-         *
-         *   - no ConsoleKit: we fallback on GDM
-         *   - no password required: everything is fine
-         *   - password asked once: we ask for it now. If the user enters it
-         *     fine, then all is great. If the user doesn't enter it fine, we
-         *     don't do anything (so no logout).
-         *   - password asked each time: we don't ask it for now since we don't
-         *     want to ask for it twice. Instead we'll ask for it at the very
-         *     end. If the user will enter it fine, then all is great again. If
-         *     the user doesn't enter it fine, then we'll just fallback to GDM.
+        /* FIXME: We need to support a more structured shutdown here,
+         * but that's blocking on an improved ConsoleKit api.
          *
-         * The last case (password asked each time) is a bit broken, but
-         * there's really nothing we can do about it. Generally speaking,
-         * though, the password will only be asked once (unless the system is
-         * configured in paranoid mode), and most probably only if there are
-         * more than one user connected. So the general case is that it will
-         * just work fine.
+         * See https://bugzilla.gnome.org/show_bug.cgi?id=585614
          */
-
-        consolekit = gsm_get_consolekit ();
-        g_signal_connect (consolekit,
-                          "privileges-completed",
-                          G_CALLBACK (request_reboot_privileges_completed),
-                          manager);
-        success = gsm_consolekit_get_restart_privileges (consolekit);
-
-        if (!success) {
-                g_signal_handlers_disconnect_by_func (consolekit,
-                                                      request_reboot_privileges_completed,
-                                                      manager);
-                g_object_unref (consolekit);
-
-                manager->priv->logout_type = GSM_MANAGER_LOGOUT_REBOOT_GDM;
-                end_phase (manager);
-        }
-}
-
-static void
-request_shutdown_privileges_completed (GsmConsolekit *consolekit,
-                                       gboolean       success,
-                                       gboolean       ask_later,
-                                       GError        *error,
-                                       GsmManager    *manager)
-{
-        /* make sure we disconnect the signal handler so that it's not called
-         * again next time the event is fired -- this can happen if the reboot
-         * is cancelled. */
-        g_signal_handlers_disconnect_by_func (consolekit,
-                                              request_shutdown_privileges_completed,
-                                              manager);
-
-        g_object_unref (consolekit);
-
-        if (success) {
-                if (ask_later) {
-                        manager->priv->logout_type = GSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT;
-                } else {
-                        manager->priv->logout_type = GSM_MANAGER_LOGOUT_SHUTDOWN;
-                }
-
-                end_phase (manager);
-        }
+        manager->priv->logout_type = GSM_MANAGER_LOGOUT_REBOOT_INTERACT;
+        end_phase (manager);
 }
 
 static void
 request_shutdown (GsmManager *manager)
 {
-        GsmConsolekit *consolekit;
-        gboolean       success;
-
         g_debug ("GsmManager: requesting shutdown");
 
-        /* See the comment in request_reboot() for some more details about how
-         * this works. */
-
-        consolekit = gsm_get_consolekit ();
-        g_signal_connect (consolekit,
-                          "privileges-completed",
-                          G_CALLBACK (request_shutdown_privileges_completed),
-                          manager);
-        success = gsm_consolekit_get_stop_privileges (consolekit);
-
-        if (!success) {
-                g_signal_handlers_disconnect_by_func (consolekit,
-                                                      request_shutdown_privileges_completed,
-                                                      manager);
-                g_object_unref (consolekit);
-
-                manager->priv->logout_type = GSM_MANAGER_LOGOUT_SHUTDOWN_GDM;
-                end_phase (manager);
-        }
+        /* See the comment in request_reboot() for some more details about
+         * what work needs to be done here. */
+        manager->priv->logout_type = GSM_MANAGER_LOGOUT_SHUTDOWN_INTERACT;
+        end_phase (manager);
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]