gnome-session r4736 - in branches/dbus_based: . gnome-session



Author: mccann
Date: Fri Jun 13 05:16:07 2008
New Revision: 4736
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4736&view=rev

Log:
2008-06-13  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-app.c (gsm_app_init), (gsm_app_set_phase),
	(set_property), (gsm_app_class_init), (gsm_app_start):
	* gnome-session/gsm-autostart-app.c (get_basename),
	(gsm_autostart_app_constructor), (gsm_autostart_app_class_init),
	(gsm_autostart_app_new):
	* gnome-session/gsm-client-store.c (gsm_client_store_add):
	* gnome-session/gsm-client.c (gsm_client_class_init):
	* gnome-session/gsm-manager.c (end_phase), (_start_app),
	(start_phase), (_client_has_client_id), (_app_has_client_id),
	(on_manage_request), (on_store_client_added),
	(gsm_manager_set_client_store), (append_app),
	(append_default_apps), (append_autostart_apps),
	(append_legacy_session_apps), (append_required_apps),
	(gsm_manager_class_init):
	* gnome-session/gsm-manager.h:
	* gnome-session/gsm-resumed-app.c (gsm_resumed_app_init),
	(gsm_resumed_app_class_init):
	* gnome-session/gsm-xsmp-client.c (client_iochannel_watch),
	(client_protocol_timeout), (setup_connection),
	(debug_print_property), (set_properties_callback),
	(delete_properties_callback), (get_properties_callback),
	(do_save_yourself), (xsmp_save_yourself),
	(xsmp_save_yourself_phase2), (xsmp_interact),
	(xsmp_shutdown_cancelled), (xsmp_stop), (gsm_xsmp_client_finalize),
	(gsm_xsmp_client_class_init), (register_client_callback),
	(save_yourself_request_callback):
	* gnome-session/gsm-xsmp-server.c (accept_ice_connection),
	(accept_xsmp_connection), (ice_error_handler),
	(ice_io_error_handler), (sms_error_handler), (setup_listener):
	Actually register clients.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/gnome-session/gsm-app.c
   branches/dbus_based/gnome-session/gsm-autostart-app.c
   branches/dbus_based/gnome-session/gsm-client-store.c
   branches/dbus_based/gnome-session/gsm-client.c
   branches/dbus_based/gnome-session/gsm-manager.c
   branches/dbus_based/gnome-session/gsm-manager.h
   branches/dbus_based/gnome-session/gsm-resumed-app.c
   branches/dbus_based/gnome-session/gsm-xsmp-client.c
   branches/dbus_based/gnome-session/gsm-xsmp-server.c

Modified: branches/dbus_based/gnome-session/gsm-app.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-app.c	(original)
+++ branches/dbus_based/gnome-session/gsm-app.c	Fri Jun 13 05:16:07 2008
@@ -31,10 +31,9 @@
 
 struct _GsmAppPrivate
 {
-        char           *id;
-
-        GsmManagerPhase phase;
-        char           *client_id;
+        char   *id;
+        int     phase;
+        char   *client_id;
 };
 
 
@@ -59,6 +58,16 @@
 static void
 gsm_app_init (GsmApp *app)
 {
+        app->priv = GSM_APP_GET_PRIVATE (app);
+}
+
+static void
+gsm_app_set_phase (GsmApp *app,
+                   int     phase)
+{
+        g_return_if_fail (GSM_IS_APP (app));
+
+        app->priv->phase = phase;
 }
 
 static void
@@ -79,7 +88,7 @@
                 app->priv->id = g_value_dup_string (value);
                 break;
         case PROP_PHASE:
-                app->priv->phase = g_value_get_int (value);
+                gsm_app_set_phase (app, g_value_get_int (value));
                 break;
         default:
                 break;
@@ -121,18 +130,18 @@
 }
 
 static void
-gsm_app_class_init (GsmAppClass *app_class)
+gsm_app_class_init (GsmAppClass *klass)
 {
-        GObjectClass *object_class = G_OBJECT_CLASS (app_class);
+        GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
         object_class->set_property = set_property;
         object_class->get_property = get_property;
         object_class->dispose = dispose;
 
-        app_class->get_basename = NULL;
-        app_class->start = NULL;
-        app_class->provides = NULL;
-        app_class->is_running = NULL;
+        klass->get_basename = NULL;
+        klass->start = NULL;
+        klass->provides = NULL;
+        klass->is_running = NULL;
 
         g_object_class_install_property (object_class,
                                          PROP_PHASE,
@@ -142,9 +151,9 @@
                                                            -1,
                                                            G_MAXINT,
                                                            -1,
-                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+                                                           G_PARAM_READWRITE));
         g_object_class_install_property (object_class,
-                                         PROP_CLIENT_ID,
+                                         PROP_ID,
                                          g_param_spec_string ("id",
                                                               "ID",
                                                               "ID",
@@ -177,6 +186,8 @@
                               g_cclosure_marshal_VOID__VOID,
                               G_TYPE_NONE,
                               0);
+
+        g_type_class_add_private (klass, sizeof (GsmAppPrivate));
 }
 
 const char *
@@ -252,6 +263,8 @@
 gsm_app_start (GsmApp  *app,
                GError **error)
 {
+        g_debug ("Starting app: %s", app->priv->id);
+
         return GSM_APP_GET_CLASS (app)->start (app, error);
 }
 

Modified: branches/dbus_based/gnome-session/gsm-autostart-app.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-autostart-app.c	(original)
+++ branches/dbus_based/gnome-session/gsm-autostart-app.c	Fri Jun 13 05:16:07 2008
@@ -484,26 +484,6 @@
         }
 }
 
-
-static const char *
-get_basename (GsmApp *app)
-{
-        const char *location, *slash;
-
-        if (GSM_AUTOSTART_APP (app)->priv->desktop_file == NULL) {
-                return NULL;
-        }
-
-        location = egg_desktop_file_get_source (GSM_AUTOSTART_APP (app)->priv->desktop_file);
-
-        slash = strrchr (location, '/');
-        if (slash != NULL) {
-                return slash + 1;
-        } else {
-                return location;
-        }
-}
-
 static gboolean
 gsm_autostart_app_provides (GsmApp     *app,
                             const char *service)
@@ -539,6 +519,45 @@
         return FALSE;
 }
 
+static const char *
+get_basename (GsmApp *app)
+{
+        const char *location;
+        const char *slash;
+
+        if (GSM_AUTOSTART_APP (app)->priv->desktop_file == NULL) {
+                return NULL;
+        }
+
+        location = egg_desktop_file_get_source (GSM_AUTOSTART_APP (app)->priv->desktop_file);
+
+        slash = strrchr (location, '/');
+        if (slash != NULL) {
+                return slash + 1;
+        } else {
+                return location;
+        }
+}
+
+static GObject *
+gsm_autostart_app_constructor (GType                  type,
+                               guint                  n_construct_properties,
+                               GObjectConstructParam *construct_properties)
+{
+        GsmAutostartApp *app;
+        const char      *id;
+
+        app = GSM_AUTOSTART_APP (G_OBJECT_CLASS (gsm_autostart_app_parent_class)->constructor (type,
+                                                                                               n_construct_properties,
+                                                                                               construct_properties));
+
+        id = get_basename (GSM_APP (app));
+
+        g_object_set (app, "id", id, NULL);
+
+        return G_OBJECT (app);
+}
+
 static void
 gsm_autostart_app_class_init (GsmAutostartAppClass *klass)
 {
@@ -548,6 +567,7 @@
         object_class->set_property = gsm_autostart_app_set_property;
         object_class->get_property = gsm_autostart_app_get_property;
         object_class->dispose = gsm_autostart_app_dispose;
+        object_class->constructor = gsm_autostart_app_constructor;
 
         app_class->is_disabled = is_disabled;
         app_class->is_running = is_running;
@@ -586,6 +606,7 @@
                             "desktop-file", desktop_file,
                             "client-id", client_id,
                             NULL);
+
         if (app->priv->desktop_file == NULL) {
                 g_object_unref (app);
                 app = NULL;

Modified: branches/dbus_based/gnome-session/gsm-client-store.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client-store.c	(original)
+++ branches/dbus_based/gnome-session/gsm-client-store.c	Fri Jun 13 05:16:07 2008
@@ -192,6 +192,8 @@
                              g_strdup (id),
                              g_object_ref (client));
 
+        g_signal_emit (store, signals [CLIENT_ADDED], 0, id);
+
         return TRUE;
 }
 

Modified: branches/dbus_based/gnome-session/gsm-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-client.c	Fri Jun 13 05:16:07 2008
@@ -304,13 +304,13 @@
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
         g_object_class_install_property (object_class,
                                          PROP_STATUS,
-                                         g_param_spec_uint ("status",
-                                                            "status",
-                                                            "status",
-                                                            0,
-                                                            G_MAXINT,
-                                                            0,
-                                                            G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+                                         g_param_spec_int ("status",
+                                                           "status",
+                                                           "status",
+                                                           -1,
+                                                           G_MAXINT,
+                                                           -1,
+                                                           G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
         g_type_class_add_private (klass, sizeof (GsmClientPrivate));
 }

Modified: branches/dbus_based/gnome-session/gsm-manager.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-manager.c	(original)
+++ branches/dbus_based/gnome-session/gsm-manager.c	Fri Jun 13 05:16:07 2008
@@ -199,7 +199,7 @@
         g_slist_free (manager->priv->pending_apps);
         manager->priv->pending_apps = NULL;
 
-        g_debug ("ending phase %d\n", manager->priv->phase);
+        g_debug ("GsmManager: ending phase %d\n", manager->priv->phase);
 
         manager->priv->phase++;
 
@@ -267,6 +267,7 @@
                           manager);
 
         if (gsm_app_is_disabled (app)) {
+                g_debug ("GsmManager: Skipping disabled app: %s", id);
                 return;
         }
 
@@ -306,7 +307,7 @@
 start_phase (GsmManager *manager)
 {
 
-        g_debug ("starting phase %d\n", manager->priv->phase);
+        g_debug ("GsmManager: starting phase %d\n", manager->priv->phase);
 
         g_slist_free (manager->priv->pending_apps);
         manager->priv->pending_apps = NULL;
@@ -429,12 +430,143 @@
         manager->priv->failsafe = enabled;
 }
 
+static gboolean
+_client_has_client_id (const char *id,
+                       GsmClient  *client,
+                       const char *client_id_a)
+{
+        const char *client_id_b;
+
+        client_id_b = gsm_client_get_client_id (client);
+
+        if (client_id_b == NULL) {
+                return FALSE;
+        }
+
+        return (strcmp (client_id_a, client_id_b) == 0);
+}
+
+static gboolean
+_app_has_client_id (const char *id,
+                    GsmApp     *app,
+                    const char *client_id_a)
+{
+        const char *client_id_b;
+
+        client_id_b = gsm_app_get_client_id (app);
+
+        if (client_id_b == NULL) {
+                return FALSE;
+        }
+
+        return (strcmp (client_id_a, client_id_b) == 0);
+}
+
+static gboolean
+on_manage_request (GsmClient  *client,
+                   char      **id,
+                   GsmManager *manager)
+{
+        gboolean handled;
+        char    *new_id;
+        GSList  *a;
+
+        handled = TRUE;
+        new_id = NULL;
+
+        if (manager->priv->phase == GSM_MANAGER_PHASE_SHUTDOWN) {
+                goto out;
+        }
+
+        if (*id == NULL) {
+                new_id = gsm_util_generate_client_id ();
+        } else {
+                GsmClient *client;
+
+                client = gsm_client_store_find (manager->priv->store,
+                                                (GsmClientStoreFunc)_client_has_client_id,
+                                                *id);
+                /* We can't have two clients with the same id. */
+                if (client != NULL) {
+                        goto out;
+                }
+
+                new_id = g_strdup (*id);
+        }
+
+        g_debug ("GsmManager: Adding new client %s to session", new_id);
+
+#if 0
+        g_signal_connect (client, "saved_state",
+                          G_CALLBACK (client_saved_state), session);
+        g_signal_connect (client, "request_phase2",
+                          G_CALLBACK (client_request_phase2), session);
+        g_signal_connect (client, "request_interaction",
+                          G_CALLBACK (client_request_interaction), session);
+        g_signal_connect (client, "interaction_done",
+                          G_CALLBACK (client_interaction_done), session);
+        g_signal_connect (client, "save_yourself_done",
+                          G_CALLBACK (client_save_yourself_done), session);
+        g_signal_connect (client, "disconnected",
+                          G_CALLBACK (client_disconnected), session);
+#endif
+
+        /* If it's a brand new client id, we just accept the client*/
+        if (*id == NULL) {
+                goto out;
+        }
+
+        /* If we're starting up the session, try to match the new client
+         * with one pending apps for the current phase. If not, try to match
+         * with any of the autostarted apps. */
+        if (manager->priv->phase < GSM_MANAGER_PHASE_APPLICATION) {
+                for (a = manager->priv->pending_apps; a != NULL; a = a->next) {
+                        GsmApp *app = GSM_APP (a->data);
+
+                        if (strcmp (new_id, gsm_app_get_client_id (app)) == 0) {
+                                gsm_app_registered (app);
+                                goto out;
+                        }
+                }
+        } else {
+                GsmApp *app;
+
+                app = g_hash_table_find (manager->priv->apps_by_id,
+                                         (GHRFunc)_app_has_client_id,
+                                         new_id);
+                if (app != NULL) {
+                        gsm_app_registered (app);
+                        goto out;
+                }
+        }
+
+        /* app not found */
+        g_free (new_id);
+        new_id = NULL;
+
+ out:
+        g_free (*id);
+        *id = new_id;
+
+        return handled;
+}
+
 static void
 on_store_client_added (GsmClientStore *store,
                        const char     *id,
                        GsmManager     *manager)
 {
+        GsmClient *client;
+
         g_debug ("GsmManager: Client added: %s", id);
+
+        client = gsm_client_store_lookup (store, id);
+
+        g_signal_connect (client,
+                          "manage-request",
+                          G_CALLBACK (on_manage_request),
+                          manager);
+        /* FIXME: disconnect signal */
 }
 
 static void
@@ -455,6 +587,9 @@
                 g_object_unref (manager->priv->store);
         }
 
+
+        g_debug ("GsmManager: setting store %p", store);
+
         manager->priv->store = store;
 
         if (manager->priv->store != NULL) {
@@ -520,18 +655,17 @@
 
         id = gsm_app_get_id (app);
         if (id == NULL) {
-                g_object_unref (app);
+                g_debug ("GsmManager: not adding app: no ID");
                 return;
         }
 
         dup = g_hash_table_lookup (manager->priv->apps_by_id, id);
         if (dup != NULL) {
-                /* FIXME */
-                g_object_unref (app);
+                g_debug ("GsmManager: not adding app: already added");
                 return;
         }
 
-        g_hash_table_insert (manager->priv->apps_by_id, g_strdup (id), app);
+        g_hash_table_insert (manager->priv->apps_by_id, g_strdup (id), g_object_ref (app));
 }
 
 static void
@@ -543,7 +677,7 @@
         char       **app_dirs;
         GConfClient *client;
 
-        g_debug ("append_default_apps ()");
+        g_debug ("GsmManager: append_default_apps ()");
 
         app_dirs = gsm_util_get_app_dirs ();
 
@@ -567,7 +701,7 @@
 
                 desktop_file = g_strdup_printf ("%s.desktop", (char *) a->data);
 
-                g_debug ("Look for: %s", desktop_file);
+                g_debug ("GsmManager: Looking for: %s", desktop_file);
 
                 g_key_file_load_from_dirs (key_file,
                                            desktop_file,
@@ -589,7 +723,7 @@
                         GsmApp *app;
                         char   *client_id;
 
-                        g_debug ("Found in: %s", app_path);
+                        g_debug ("GsmManager: Found in: %s", app_path);
 
                         client_id = gsm_util_generate_client_id ();
                         app = gsm_autostart_app_new (app_path, client_id);
@@ -597,8 +731,9 @@
                         g_free (app_path);
 
                         if (app != NULL) {
-                                g_debug ("read %s\n", desktop_file);
+                                g_debug ("GsmManager: read %s\n", desktop_file);
                                 append_app (manager, app);
+                                g_object_unref (app);
                         } else {
                                 g_warning ("could not read %s\n", desktop_file);
                         }
@@ -620,7 +755,7 @@
         GDir       *dir;
         const char *name;
 
-        g_debug ("append_autostart_apps (%s)", path);
+        g_debug ("GsmManager: append_autostart_apps (%s)", path);
 
         dir = g_dir_open (path, 0, NULL);
         if (dir == NULL) {
@@ -641,8 +776,9 @@
                 client_id = gsm_util_generate_client_id ();
                 app = gsm_autostart_app_new (desktop_file, client_id);
                 if (app != NULL) {
-                        g_debug ("read %s\n", desktop_file);
+                        g_debug ("GsmManager: read %s\n", desktop_file);
                         append_app (manager, app);
+                        g_object_unref (app);
                 } else {
                         g_warning ("could not read %s\n", desktop_file);
                 }
@@ -669,11 +805,15 @@
                 return;
         }
 
-        num_clients = g_key_file_get_integer (saved, "Default", "num_clients", NULL);
+        num_clients = g_key_file_get_integer (saved,
+                                              "Default",
+                                              "num_clients",
+                                              NULL);
         for (i = 0; i < num_clients; i++) {
                 GsmApp *app = gsm_resumed_app_new_from_legacy_session (saved, i);
                 if (app != NULL) {
                         append_app (manager, app);
+                        g_object_unref (app);
                 }
         }
 
@@ -750,6 +890,7 @@
                         g_free (client_id);
                         if (app != NULL) {
                                 append_app (manager, app);
+                                g_object_unref (app);
                         }
                         /* FIXME: else error */
                 }
@@ -874,7 +1015,7 @@
                                                                FALSE,
                                                                G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
         g_object_class_install_property (object_class,
-                                         PROP_FAILSAFE,
+                                         PROP_CLIENT_STORE,
                                          g_param_spec_object ("client-store",
                                                               NULL,
                                                               NULL,

Modified: branches/dbus_based/gnome-session/gsm-manager.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-manager.h	(original)
+++ branches/dbus_based/gnome-session/gsm-manager.h	Fri Jun 13 05:16:07 2008
@@ -61,7 +61,7 @@
 
 typedef enum {
         /* gsm's own startup/initialization phase */
-        GSM_MANAGER_PHASE_STARTUP,
+        GSM_MANAGER_PHASE_STARTUP = 0,
         /* xrandr setup, gnome-settings-daemon, etc */
         GSM_MANAGER_PHASE_INITIALIZATION,
         /* window/compositing managers */

Modified: branches/dbus_based/gnome-session/gsm-resumed-app.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-resumed-app.c	(original)
+++ branches/dbus_based/gnome-session/gsm-resumed-app.c	Fri Jun 13 05:16:07 2008
@@ -26,6 +26,8 @@
 
 #include "gsm-resumed-app.h"
 
+#define GSM_RESUMED_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_RESUMED_APP, GsmResumedAppPrivate))
+
 struct _GsmResumedAppPrivate
 {
         char    *program;
@@ -39,7 +41,7 @@
 static void
 gsm_resumed_app_init (GsmResumedApp *app)
 {
-        ;
+        app->priv = GSM_RESUMED_APP_GET_PRIVATE (app);
 }
 
 static gboolean
@@ -98,6 +100,8 @@
 
         app_class->get_basename = get_basename;
         app_class->start = launch;
+
+        g_type_class_add_private (klass, sizeof (GsmResumedAppPrivate));
 }
 
 /**

Modified: branches/dbus_based/gnome-session/gsm-xsmp-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-xsmp-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-xsmp-client.c	Fri Jun 13 05:16:07 2008
@@ -70,12 +70,12 @@
                 return TRUE;
 
         case IceProcessMessagesIOError:
-                g_debug ("IceProcessMessagesIOError on '%s'", client->priv->description);
+                g_debug ("GsmXSMPClient: IceProcessMessagesIOError on '%s'", client->priv->description);
                 gsm_client_disconnected (GSM_CLIENT (client));
                 return FALSE;
 
         case IceProcessMessagesConnectionClosed:
-                g_debug ("IceProcessMessagesConnectionClosed on '%s'",
+                g_debug ("GsmXSMPClient: IceProcessMessagesConnectionClosed on '%s'",
                          client->priv->description);
                 return FALSE;
 
@@ -90,7 +90,7 @@
 static gboolean
 client_protocol_timeout (GsmXSMPClient *client)
 {
-        g_debug ("client_protocol_timeout for client '%s' in ICE status %d",
+        g_debug ("GsmXSMPClient: client_protocol_timeout for client '%s' in ICE status %d",
                  client->priv->description,
                  IceConnectionStatus (client->priv->ice_connection));
 
@@ -150,6 +150,8 @@
         GIOChannel    *channel;
         int            fd;
 
+        g_debug ("GsmXSMPClient: Setting up new connection");
+
         fd = IceConnectionNumber (client->priv->ice_connection);
         fcntl (fd, F_SETFD, fcntl (fd, F_GETFD, 0) | FD_CLOEXEC);
         channel = g_io_channel_unix_new (fd);
@@ -164,7 +166,8 @@
                                                         client);
 
         set_description (client);
-        g_debug ("New client '%s'", client->priv->description);
+
+        g_debug ("GsmXSMPClient: New client '%s'", client->priv->description);
 }
 
 static GObject *
@@ -231,11 +234,11 @@
 
         switch (prop->type[0]) {
         case 'C': /* CARD8 */
-                g_debug ("  %s = %d", prop->name, *(unsigned char *)prop->vals[0].value);
+                g_debug ("GsmXSMPClient:   %s = %d", prop->name, *(unsigned char *)prop->vals[0].value);
                 break;
 
         case 'A': /* ARRAY8 */
-                g_debug ("  %s = '%s'", prop->name, (char *)prop->vals[0].value);
+                g_debug ("GsmXSMPClient:   %s = '%s'", prop->name, (char *)prop->vals[0].value);
                 break;
 
         case 'L': /* LISTofARRAY8 */
@@ -244,12 +247,12 @@
                         g_string_append_printf (tmp, "'%.*s' ", prop->vals[i].length,
                                                 (char *)prop->vals[i].value);
                 }
-                g_debug ("  %s = %s", prop->name, tmp->str);
+                g_debug ("GsmXSMPClient:   %s = %s", prop->name, tmp->str);
                 g_string_free (tmp, TRUE);
                 break;
 
         default:
-                g_debug ("  %s = ??? (%s)", prop->name, prop->type);
+                g_debug ("GsmXSMPClient:   %s = ??? (%s)", prop->name, prop->type);
                 break;
         }
 }
@@ -264,7 +267,7 @@
         GsmXSMPClient *client = manager_data;
         int            i;
 
-        g_debug ("Set properties from client '%s'", client->priv->description);
+        g_debug ("GsmXSMPClient: Set properties from client '%s'", client->priv->description);
 
         for (i = 0; i < num_props; i++) {
                 delete_property (client, props[i]->name);
@@ -289,7 +292,7 @@
         GsmXSMPClient *client = manager_data;
         int i;
 
-        g_debug ("Delete properties from '%s'", client->priv->description);
+        g_debug ("GsmXSMPClient: Delete properties from '%s'", client->priv->description);
 
         for (i = 0; i < num_props; i++) {
                 delete_property (client, prop_names[i]);
@@ -306,7 +309,7 @@
 {
         GsmXSMPClient *client = manager_data;
 
-        g_debug ("Get properties request from '%s'", client->priv->description);
+        g_debug ("GsmXSMPClient: Get properties request from '%s'", client->priv->description);
 
         SmsReturnProperties (conn,
                              client->priv->props->len,
@@ -422,10 +425,10 @@
                  * queued after it, or vice versa. Either way, the new SaveYourself
                  * is redundant.
                  */
-                g_debug ("  skipping redundant SaveYourself for '%s'",
+                g_debug ("GsmXSMPClient:   skipping redundant SaveYourself for '%s'",
                          client->priv->description);
         } else if (client->priv->current_save_yourself != -1) {
-                g_debug ("  queuing new SaveYourself for '%s'",
+                g_debug ("GsmXSMPClient:   queuing new SaveYourself for '%s'",
                          client->priv->description);
                 client->priv->next_save_yourself = save_type;
         } else {
@@ -459,7 +462,7 @@
 {
         GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
 
-        g_debug ("xsmp_save_yourself ('%s', %s)",
+        g_debug ("GsmXSMPClient: xsmp_save_yourself ('%s', %s)",
                  xsmp->priv->description,
                  save_state ? "True" : "False");
 
@@ -471,7 +474,7 @@
 {
         GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
 
-        g_debug ("xsmp_save_yourself_phase2 ('%s')", xsmp->priv->description);
+        g_debug ("GsmXSMPClient: xsmp_save_yourself_phase2 ('%s')", xsmp->priv->description);
 
         SmsSaveYourselfPhase2 (xsmp->priv->conn);
 }
@@ -481,7 +484,7 @@
 {
         GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
 
-        g_debug ("xsmp_interact ('%s')", xsmp->priv->description);
+        g_debug ("GsmXSMPClient: xsmp_interact ('%s')", xsmp->priv->description);
 
         SmsInteract (xsmp->priv->conn);
 }
@@ -492,7 +495,7 @@
 {
         GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
 
-        g_debug ("xsmp_shutdown_cancelled ('%s')", xsmp->priv->description);
+        g_debug ("GsmXSMPClient: xsmp_shutdown_cancelled ('%s')", xsmp->priv->description);
 
         SmsShutdownCancelled (xsmp->priv->conn);
 }
@@ -502,7 +505,7 @@
 {
         GsmXSMPClient *xsmp = (GsmXSMPClient *) client;
 
-        g_debug ("xsmp_die ('%s')", xsmp->priv->description);
+        g_debug ("GsmXSMPClient: xsmp_die ('%s')", xsmp->priv->description);
 
         SmsDie (xsmp->priv->conn);
 }
@@ -559,7 +562,7 @@
 {
         GsmXSMPClient *client = (GsmXSMPClient *) object;
 
-        g_debug ("xsmp_finalize (%s)", client->priv->description);
+        g_debug ("GsmXSMPClient: xsmp_finalize (%s)", client->priv->description);
 
         if (client->priv->watch_id > 0) {
                 g_source_remove (client->priv->watch_id);
@@ -591,13 +594,6 @@
         object_class->get_property         = gsm_xsmp_client_get_property;
         object_class->set_property         = gsm_xsmp_client_set_property;
 
-        g_object_class_install_property (object_class,
-                                         PROP_ICE_CONNECTION,
-                                         g_param_spec_pointer ("ice-connection",
-                                                               "ice-connection",
-                                                               "ice-connection",
-                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
-
         client_class->get_restart_command  = xsmp_get_restart_command;
         client_class->get_discard_command  = xsmp_get_discard_command;
         client_class->get_autorestart      = xsmp_get_autorestart;
@@ -608,6 +604,15 @@
         client_class->save_yourself_phase2 = xsmp_save_yourself_phase2;
         client_class->interact             = xsmp_interact;
         client_class->shutdown_cancelled   = xsmp_shutdown_cancelled;
+
+        g_object_class_install_property (object_class,
+                                         PROP_ICE_CONNECTION,
+                                         g_param_spec_pointer ("ice-connection",
+                                                               "ice-connection",
+                                                               "ice-connection",
+                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+
+        g_type_class_add_private (klass, sizeof (GsmXSMPClientPrivate));
 }
 
 GsmClient *
@@ -631,7 +636,7 @@
         gboolean       handled;
         char          *id;
 
-        g_debug ("Client '%s' received RegisterClient(%s)",
+        g_debug ("GsmXSMPClient: Client '%s' received RegisterClient(%s)",
                  client->priv->description,
                  previous_id ? previous_id : "NULL");
 
@@ -644,14 +649,15 @@
         id = g_strdup (previous_id);
         handled = gsm_client_manage_request (GSM_CLIENT (client), &id);
         if (! handled) {
-                g_debug (" RegisterClient not handled!");
+                g_debug ("GsmXSMPClient:  RegisterClient not handled!");
                 g_free (id);
                 free (previous_id);
+                g_assert_not_reached ();
                 return FALSE;
         }
 
         if (id == NULL) {
-                g_debug ("  rejected: invalid previous_id");
+                g_debug ("GsmXSMPClient:   rejected: invalid previous_id");
                 free (previous_id);
                 return FALSE;
         }
@@ -660,13 +666,13 @@
 
         set_description (client);
 
-        g_debug ("Sending RegisterClientReply to '%s'", client->priv->description);
+        g_debug ("GsmXSMPClient: Sending RegisterClientReply to '%s'", client->priv->description);
 
         SmsRegisterClientReply (conn, id);
 
         if (previous_id == NULL) {
                 /* Send the initial SaveYourself. */
-                g_debug ("Sending initial SaveYourself");
+                g_debug ("GsmXSMPClient: Sending initial SaveYourself");
                 SmsSaveYourself (conn, SmSaveLocal, False, SmInteractStyleNone, False);
                 client->priv->current_save_yourself = SmSaveLocal;
 
@@ -690,7 +696,7 @@
 {
         GsmXSMPClient *client = manager_data;
 
-        g_debug ("Client '%s' received SaveYourselfRequest(%s, %s, %s, %s, %s)",
+        g_debug ("GsmXSMPClient: Client '%s' received SaveYourselfRequest(%s, %s, %s, %s, %s)",
                  client->priv->description,
                  save_type == SmSaveLocal ? "SmSaveLocal" :
                  save_type == SmSaveGlobal ? "SmSaveGlobal" : "SmSaveBoth",
@@ -731,14 +737,14 @@
          */
 
         if (shutdown && global) {
-                g_debug ("  initiating shutdown");
+                g_debug ("GsmXSMPClient:   initiating shutdown");
                 gsm_client_logout_request (GSM_CLIENT (client),
                                            !fast);
         } else if (!shutdown && !global) {
-                g_debug ("  initiating checkpoint");
+                g_debug ("GsmXSMPClient:   initiating checkpoint");
                 do_save_yourself (client, SmSaveLocal);
         } else {
-                g_debug ("  ignoring");
+                g_debug ("GsmXSMPClient:   ignoring");
         }
 }
 

Modified: branches/dbus_based/gnome-session/gsm-xsmp-server.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-xsmp-server.c	(original)
+++ branches/dbus_based/gnome-session/gsm-xsmp-server.c	Fri Jun 13 05:16:07 2008
@@ -111,11 +111,11 @@
         listener = data->listener;
         server = data->server;
 
-        g_debug ("accept_ice_connection()");
+        g_debug ("GsmXsmpServer: accept_ice_connection()");
 
         ice_conn = IceAcceptConnection (listener, &status);
         if (status != IceAcceptSuccess) {
-                g_debug ("IceAcceptConnection returned %d", status);
+                g_debug ("GsmXsmpServer: IceAcceptConnection returned %d", status);
                 return TRUE;
         }
 
@@ -223,7 +223,7 @@
 
         /* FIXME: what about during shutdown but before gsm_xsmp_shutdown? */
         if (server->priv->xsmp_sockets == NULL) {
-                g_debug ("In shutdown, rejecting new client");
+                g_debug ("GsmXsmpServer: In shutdown, rejecting new client");
 
                 *failure_reason_ret = strdup (_("Refusing new client connection because the session is currently being shut down\n"));
                 return FALSE;
@@ -248,7 +248,7 @@
                    int           severity,
                    IcePointer    values)
 {
-        g_debug ("ice_error_handler (%p, %s, %d, %lx, %d, %d)",
+        g_debug ("GsmXsmpServer: ice_error_handler (%p, %s, %d, %lx, %d, %d)",
                  conn, swap ? "TRUE" : "FALSE", offending_minor_opcode,
                  offending_sequence, error_class, severity);
 
@@ -267,7 +267,7 @@
 static void
 ice_io_error_handler (IceConn conn)
 {
-        g_debug ("ice_io_error_handler (%p)", conn);
+        g_debug ("GsmXsmpServer: ice_io_error_handler (%p)", conn);
 
         /* We don't need to do anything here; the next call to
          * IceProcessMessages() for this connection will receive
@@ -284,7 +284,7 @@
                    int           severity,
                    IcePointer    values)
 {
-        g_debug ("sms_error_handler (%p, %s, %d, %lx, %d, %d)",
+        g_debug ("GsmXsmpServer: sms_error_handler (%p, %s, %d, %lx, %d, %d)",
                  conn, swap ? "TRUE" : "FALSE", offending_minor_opcode,
                  offending_sequence_num, error_class, severity);
 
@@ -541,7 +541,7 @@
                                                    server->priv->xsmp_sockets);
 
         g_setenv ("SESSION_MANAGER", network_id_list, TRUE);
-        g_debug ("SESSION_MANAGER=%s\n", network_id_list);
+        g_debug ("GsmXsmpServer: SESSION_MANAGER=%s\n", network_id_list);
         free (network_id_list);
 }
 



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