[Xfce4-commits] <xfce4-session:master> Remove consolekit session creation in xfce4-session.

Jérôme Guelfucci noreply at xfce.org
Sun Oct 17 11:48:01 CEST 2010


Updating branch refs/heads/master
         to 1075715c0cf0c408f58eef51d0334341ee9d0566 (commit)
       from 0aaf32268adbd81225931b216ae851ca8f045a24 (commit)

commit 1075715c0cf0c408f58eef51d0334341ee9d0566
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date:   Sun Oct 17 11:43:46 2010 +0200

    Remove consolekit session creation in xfce4-session.
    
    There is no reliable way for us to find out when we should open a new
    session or not. This should be handled somewhere higher in the startup
    script hierarchy.
    
    See the discussion on our mailing list:
    http://foo-projects.org/pipermail/xfce4-dev/2010-September/028230.html
    
    And the one on the consolekit mailing list:
    http://lists.freedesktop.org/archives/consolekit/2010-September/000130.html

 xfce4-session/xfsm-manager.c |  131 ------------------------------------------
 1 files changed, 0 insertions(+), 131 deletions(-)

diff --git a/xfce4-session/xfsm-manager.c b/xfce4-session/xfsm-manager.c
index 08c7255..07c5369 100644
--- a/xfce4-session/xfsm-manager.c
+++ b/xfce4-session/xfsm-manager.c
@@ -116,13 +116,6 @@ struct _XfsmManager
   guint            die_timeout_id;
 
   DBusGConnection *session_bus;
-
-
-#ifdef ENABLE_CONSOLE_KIT
-  DBusGConnection *system_bus;
-  DBusGProxy      *consolekit_proxy;
-  gchar           *consolekit_cookie;
-#endif
 };
 
 typedef struct _XfsmManagerClass
@@ -178,10 +171,6 @@ static void       xfsm_manager_dbus_class_init (XfsmManagerClass *klass);
 static void       xfsm_manager_dbus_init (XfsmManager *manager);
 static void       xfsm_manager_dbus_cleanup (XfsmManager *manager);
 
-#ifdef ENABLE_CONSOLE_KIT
-static void       xfsm_manager_consolekit_init (XfsmManager *manager);
-static void       xfsm_manager_consolekit_cleanup (XfsmManager *manager);
-#endif /*ENABLE_CONSOLE_KIT*/
 
 static guint signals[N_SIGS] = { 0, };
 
@@ -232,39 +221,16 @@ xfsm_manager_class_init (XfsmManagerClass *klass)
 static void
 xfsm_manager_init (XfsmManager *manager)
 {
-#ifdef ENABLE_CONSOLE_KIT
-  GError *error = NULL;
-#endif
-
   manager->state = XFSM_MANAGER_STARTUP;
   manager->session_chooser = FALSE;
   manager->failsafe_mode = TRUE;
   manager->shutdown_type = XFSM_SHUTDOWN_LOGOUT;
 
-#ifdef ENABLE_CONSOLE_KIT
-  manager->consolekit_proxy  = NULL;
-  manager->consolekit_cookie = NULL;
-#endif /*ENABLE_CONSOLE_KIT*/
-
   manager->pending_properties = g_queue_new ();
   manager->starting_properties = g_queue_new ();
   manager->restart_properties = g_queue_new ();
   manager->running_clients = g_queue_new ();
   manager->failsafe_clients = g_queue_new ();
-
-#ifdef ENABLE_CONSOLE_KIT
-  manager->system_bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
-
-  if (G_LIKELY (manager->system_bus != NULL))
-    {
-      xfsm_manager_consolekit_init (manager);
-    }
-  else if (error)
-    {
-      g_warning ("Failed to connect to the system bus : %s", error->message);
-      g_error_free (error);
-    }
-#endif
 }
 
 static void
@@ -274,13 +240,6 @@ xfsm_manager_finalize (GObject *obj)
 
   xfsm_manager_dbus_cleanup (manager);
 
-#ifdef ENABLE_CONSOLE_KIT
-  xfsm_manager_consolekit_cleanup (manager);
-
-  if (manager->system_bus)
-    dbus_g_connection_unref (manager->system_bus);
-#endif /*ENABLE_CONSOLE_KIT*/
-
   if (manager->die_timeout_id != 0)
     g_source_remove (manager->die_timeout_id);
 
@@ -341,96 +300,6 @@ xfsm_manager_new (void)
 }
 
 
-#ifdef ENABLE_CONSOLE_KIT
-static void xfsm_manager_consolekit_init (XfsmManager *manager)
-{
-  GError *error = NULL;
-  gboolean ret;
-
-  manager->consolekit_proxy = dbus_g_proxy_new_for_name_owner (manager->system_bus,
-                                                               "org.freedesktop.ConsoleKit",
-                                                               "/org/freedesktop/ConsoleKit/Manager",
-                                                               "org.freedesktop.ConsoleKit.Manager",
-                                                               NULL);
-
-
-  if (G_UNLIKELY (!manager->consolekit_proxy))
-    {
-      g_warning ("Failed to create proxy for 'org.freedesktop.ConsoleKit'");
-      return;
-    }
-
-  /* check if there is a session to reuse */
-  if (g_getenv ("XDG_SESSION_COOKIE") != NULL)
-    {
-#ifdef DEBUG
-      g_debug ("Reusing existing ConsoleKit session: XDG_SESSION_ID=%s",
-               g_getenv ("XDG_SESSION_COOKIE"));
-#endif
-    }
-  else
-    {
-      /* try to open a new session. as its leader we are then responsible for
-       * setting XDG_SESSION_COOKIE as well as closing the session before we exit */
-      ret = dbus_g_proxy_call (manager->consolekit_proxy, "OpenSession", &error,
-                               G_TYPE_INVALID,
-                               G_TYPE_STRING, &manager->consolekit_cookie,
-                               G_TYPE_INVALID);
-
-      if (G_LIKELY (ret))
-        {
-          /*
-           * ConsoleKit doc says that the leader session should set the cookie
-           * on XDG_SESSION_COOKIE env variable.
-           */
-          if (g_setenv ("XDG_SESSION_COOKIE", manager->consolekit_cookie, TRUE))
-            {
-#ifdef DEBUG
-              g_debug ("Opening a new ConsoleKit session: XDG_SESSION_COOKIE=%s",
-                       manager->consolekit_cookie);
-#endif
-            }
-          else
-            {
-              g_warning ("Failed to set XDG_SESSION_COOKIE");
-            }
-        }
-      else if (error)
-        {
-          g_warning ("OpenSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message);
-          g_error_free (error);
-        }
-    }
-}
-
-
-static void xfsm_manager_consolekit_cleanup (XfsmManager *manager)
-{
-  GError *error = NULL;
-  gboolean ret, result;
-
-  if (manager->consolekit_proxy)
-    {
-      if (manager->consolekit_cookie)
-        {
-          ret = dbus_g_proxy_call (manager->consolekit_proxy, "CloseSession", &error,
-                                   G_TYPE_STRING, manager->consolekit_cookie,
-                                   G_TYPE_INVALID,
-                                   G_TYPE_BOOLEAN, &result,
-                                   G_TYPE_INVALID);
-          if (!ret)
-            {
-              g_warning ("CloseSession on 'org.freedesktop.ConsoleKit' failed with %s", error->message);
-              g_error_free (error);
-            }
-          g_free (manager->consolekit_cookie);
-        }
-      g_object_unref (manager->consolekit_proxy);
-    }
-}
-#endif /*ENABLE_CONSOLE_KIT*/
-
-
 static gboolean
 xfsm_manager_startup (XfsmManager *manager)
 {



More information about the Xfce4-commits mailing list