gnome-session r4805 - in branches/dbus_based: . gnome-session
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r4805 - in branches/dbus_based: . gnome-session
- Date: Wed, 16 Jul 2008 19:17:27 +0000 (UTC)
Author: mccann
Date: Wed Jul 16 19:17:27 2008
New Revision: 4805
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4805&view=rev
Log:
2008-07-16 William Jon McCann <jmccann redhat com>
* gnome-session/Makefile.am:
* gnome-session/gsm-app.c (gsm_app_set_startup_id),
(gsm_app_set_property), (gsm_app_get_property), (gsm_app_dispose),
(gsm_app_class_init), (gsm_app_get_startup_id):
* gnome-session/gsm-app.h:
* gnome-session/gsm-autostart-app.c (load_desktop_file),
(autostart_app_start_spawn), (autostart_app_start_activate):
* gnome-session/gsm-client.c (gsm_client_finalize),
(gsm_client_set_startup_id), (gsm_client_set_property),
(gsm_client_get_property), (default_stop), (gsm_client_class_init),
(gsm_client_get_startup_id), (gsm_client_stop),
(gdm_client_end_session_response):
* gnome-session/gsm-client.h:
* gnome-session/gsm-client.xml:
* gnome-session/gsm-dbus-client.c (gsm_dbus_client_error_quark),
(gsm_dbus_client_error_get_type), (gsm_dbus_client_class_init),
(gsm_dbus_client_end_session_response):
* gnome-session/gsm-dbus-client.h:
* gnome-session/gsm-dbus-client.xml:
* gnome-session/gsm-inhibitor.c (gsm_inhibitor_set_client_id),
(gsm_inhibitor_get_client_id), (gsm_inhibitor_set_property),
(gsm_inhibitor_get_property), (gsm_inhibitor_finalize),
(gsm_inhibitor_class_init), (gsm_inhibitor_new_for_client):
* gnome-session/gsm-inhibitor.h:
* gnome-session/gsm-manager.c (_find_by_startup_id),
(app_condition_changed), (app_registered), (phase_timeout),
(start_phase), (inhibitor_has_bus_name), (_app_has_startup_id),
(find_app_for_startup_id), (register_client_for_name),
(_client_has_startup_id), (on_xsmp_client_register_request),
(_client_query_end_session), (query_end_session_complete),
(inhibitor_has_client_id), (generate_cookie),
(_generate_unique_cookie), (on_client_end_session_response),
(on_query_end_session_timeout), (query_end_session),
(request_logout), (user_logout), (gsm_manager_logout),
(gsm_manager_register_client), (gsm_manager_unregister_client):
* gnome-session/gsm-manager.xml:
* gnome-session/gsm-marshal.list:
* gnome-session/gsm-xsmp-client.c (set_description):
* gnome-session/test-client-dbus.c (register_client):
* gnome-session/util.c (gsm_util_generate_startup_id):
* gnome-session/util.h:
Rename client-id to startup-id to distinguish from
Client's ID. Start adding a new shutdown path that
allows for more compatibility with xsmp.
Added:
branches/dbus_based/gnome-session/gsm-dbus-client.xml
Modified:
branches/dbus_based/ChangeLog
branches/dbus_based/gnome-session/Makefile.am
branches/dbus_based/gnome-session/gsm-app.c
branches/dbus_based/gnome-session/gsm-app.h
branches/dbus_based/gnome-session/gsm-autostart-app.c
branches/dbus_based/gnome-session/gsm-client.c
branches/dbus_based/gnome-session/gsm-client.h
branches/dbus_based/gnome-session/gsm-client.xml
branches/dbus_based/gnome-session/gsm-dbus-client.c
branches/dbus_based/gnome-session/gsm-dbus-client.h
branches/dbus_based/gnome-session/gsm-inhibitor.c
branches/dbus_based/gnome-session/gsm-inhibitor.h
branches/dbus_based/gnome-session/gsm-manager.c
branches/dbus_based/gnome-session/gsm-manager.xml
branches/dbus_based/gnome-session/gsm-marshal.list
branches/dbus_based/gnome-session/gsm-xsmp-client.c
branches/dbus_based/gnome-session/test-client-dbus.c
branches/dbus_based/gnome-session/util.c
branches/dbus_based/gnome-session/util.h
Modified: branches/dbus_based/gnome-session/Makefile.am
==============================================================================
--- branches/dbus_based/gnome-session/Makefile.am (original)
+++ branches/dbus_based/gnome-session/Makefile.am Wed Jul 16 19:17:27 2008
@@ -91,7 +91,8 @@
gsm-manager.c \
gsm-manager.h \
gsm-xsmp-server.c \
- gsm-xsmp-server.h
+ gsm-xsmp-server.h \
+ $(NULL)
libgsmutil_la_LIBADD = \
$(GNOME_SESSION_LIBS)
@@ -113,11 +114,15 @@
gsm-client-glue.h: gsm-client.xml Makefile.am
dbus-binding-tool --prefix=gsm_client --mode=glib-server --output=gsm-client-glue.h $(srcdir)/gsm-client.xml
+gsm-dbus-client-glue.h: gsm-dbus-client.xml Makefile.am
+ dbus-binding-tool --prefix=gsm_dbus_client --mode=glib-server --output=gsm-dbus-client-glue.h $(srcdir)/gsm-dbus-client.xml
+
BUILT_SOURCES = \
gsm-marshal.c \
gsm-marshal.h \
gsm-manager-glue.h \
gsm-client-glue.h \
+ gsm-dbus-client-glue.h \
$(NULL)
CLEANFILES = \
@@ -127,7 +132,10 @@
$(glade_DATA) \
README \
gsm-marshal.list \
- gsm-manager.xml
+ gsm-manager.xml \
+ gsm-client.xml \
+ gsm-dbus-client.xml \
+ $(NULL)
MAINTAINERCLEANFILES = \
*~ \
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 Wed Jul 16 19:17:27 2008
@@ -34,7 +34,7 @@
{
char *id;
int phase;
- char *client_id;
+ char *startup_id;
};
@@ -50,7 +50,7 @@
enum {
PROP_0,
PROP_ID,
- PROP_CLIENT_ID,
+ PROP_STARTUP_ID,
PROP_PHASE,
LAST_PROP
};
@@ -96,15 +96,15 @@
}
static void
-gsm_app_set_client_id (GsmApp *app,
- const char *client_id)
+gsm_app_set_startup_id (GsmApp *app,
+ const char *startup_id)
{
g_return_if_fail (GSM_IS_APP (app));
- g_free (app->priv->client_id);
+ g_free (app->priv->startup_id);
- app->priv->client_id = g_strdup (client_id);
- g_object_notify (G_OBJECT (app), "client-id");
+ app->priv->startup_id = g_strdup (startup_id);
+ g_object_notify (G_OBJECT (app), "startup-id");
}
@@ -117,8 +117,8 @@
GsmApp *app = GSM_APP (object);
switch (prop_id) {
- case PROP_CLIENT_ID:
- gsm_app_set_client_id (app, g_value_get_string (value));
+ case PROP_STARTUP_ID:
+ gsm_app_set_startup_id (app, g_value_get_string (value));
break;
case PROP_ID:
gsm_app_set_id (app, g_value_get_string (value));
@@ -140,8 +140,8 @@
GsmApp *app = GSM_APP (object);
switch (prop_id) {
- case PROP_CLIENT_ID:
- g_value_set_string (value, app->priv->client_id);
+ case PROP_STARTUP_ID:
+ g_value_set_string (value, app->priv->startup_id);
break;
case PROP_ID:
g_value_set_string (value, app->priv->id);
@@ -159,9 +159,9 @@
{
GsmApp *app = GSM_APP (object);
- if (app->priv->client_id) {
- g_free (app->priv->client_id);
- app->priv->client_id = NULL;
+ if (app->priv->startup_id) {
+ g_free (app->priv->startup_id);
+ app->priv->startup_id = NULL;
}
}
@@ -197,10 +197,10 @@
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
- PROP_CLIENT_ID,
- g_param_spec_string ("client-id",
- "Client ID",
- "Session management client ID",
+ PROP_STARTUP_ID,
+ g_param_spec_string ("startup-id",
+ "startup ID",
+ "Session management startup ID",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
@@ -243,9 +243,9 @@
}
const char *
-gsm_app_get_client_id (GsmApp *app)
+gsm_app_get_startup_id (GsmApp *app)
{
- return app->priv->client_id;
+ return app->priv->startup_id;
}
/**
Modified: branches/dbus_based/gnome-session/gsm-app.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-app.h (original)
+++ branches/dbus_based/gnome-session/gsm-app.h Wed Jul 16 19:17:27 2008
@@ -97,7 +97,7 @@
gboolean gsm_app_get_autorestart (GsmApp *app);
const char *gsm_app_get_id (GsmApp *app);
-const char *gsm_app_get_client_id (GsmApp *app);
+const char *gsm_app_get_startup_id (GsmApp *app);
GsmManagerPhase gsm_app_get_phase (GsmApp *app);
gboolean gsm_app_is_running (GsmApp *app);
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 Wed Jul 16 19:17:27 2008
@@ -87,7 +87,7 @@
load_desktop_file (GsmAutostartApp *app)
{
char *dbus_name;
- char *client_id;
+ char *startup_id;
char *phase_str;
int phase;
@@ -128,10 +128,10 @@
/* this must only be done on first load */
switch (app->priv->launch_type) {
case AUTOSTART_LAUNCH_SPAWN:
- client_id = gsm_util_generate_client_id ();
+ startup_id = gsm_util_generate_startup_id ();
break;
case AUTOSTART_LAUNCH_ACTIVATE:
- client_id = g_strdup (dbus_name);
+ startup_id = g_strdup (dbus_name);
break;
default:
g_assert_not_reached ();
@@ -139,10 +139,10 @@
g_object_set (app,
"phase", phase,
- "client-id", client_id,
+ "startup-id", startup_id,
NULL);
- g_free (client_id);
+ g_free (startup_id);
g_free (dbus_name);
return TRUE;
@@ -584,13 +584,13 @@
char *env[2] = { NULL, NULL };
gboolean success;
GError *local_error;
- const char *client_id;
+ const char *startup_id;
- client_id = gsm_app_get_client_id (GSM_APP (app));
- g_assert (client_id != NULL);
+ startup_id = gsm_app_get_startup_id (GSM_APP (app));
+ g_assert (startup_id != NULL);
- env[0] = g_strdup_printf ("DESKTOP_AUTOSTART_ID=%s", client_id);
- g_debug ("GsmAutostartApp: starting %s: %s", app->priv->desktop_id, client_id);
+ env[0] = g_strdup_printf ("DESKTOP_AUTOSTART_ID=%s", startup_id);
+ g_debug ("GsmAutostartApp: starting %s: %s", app->priv->desktop_id, startup_id);
local_error = NULL;
success = egg_desktop_file_launch (app->priv->desktop_file,
@@ -661,7 +661,7 @@
return FALSE;
}
- name = gsm_app_get_client_id (GSM_APP (app));
+ name = gsm_app_get_startup_id (GSM_APP (app));
g_assert (name != NULL);
path = egg_desktop_file_get_string (app->priv->desktop_file,
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 Wed Jul 16 19:17:27 2008
@@ -25,6 +25,7 @@
#include <dbus/dbus-glib.h>
+#include "gsm-marshal.h"
#include "gsm-client.h"
#include "gsm-client-glue.h"
@@ -35,7 +36,7 @@
struct GsmClientPrivate
{
char *id;
- char *client_id;
+ char *startup_id;
char *app_id;
int status;
DBusGConnection *connection;
@@ -44,14 +45,14 @@
enum {
PROP_0,
PROP_ID,
- PROP_CLIENT_ID,
+ PROP_STARTUP_ID,
PROP_APP_ID,
PROP_STATUS,
};
enum {
DISCONNECTED,
- STOP,
+ END_SESSION_RESPONSE,
LAST_SIGNAL
};
@@ -136,7 +137,7 @@
g_return_if_fail (client->priv != NULL);
g_free (client->priv->id);
- g_free (client->priv->client_id);
+ g_free (client->priv->startup_id);
g_free (client->priv->app_id);
}
@@ -152,15 +153,15 @@
}
static void
-gsm_client_set_client_id (GsmClient *client,
- const char *client_id)
+gsm_client_set_startup_id (GsmClient *client,
+ const char *startup_id)
{
g_return_if_fail (GSM_IS_CLIENT (client));
- g_free (client->priv->client_id);
+ g_free (client->priv->startup_id);
- client->priv->client_id = g_strdup (client_id);
- g_object_notify (G_OBJECT (client), "client-id");
+ client->priv->startup_id = g_strdup (startup_id);
+ g_object_notify (G_OBJECT (client), "startup-id");
}
void
@@ -186,8 +187,8 @@
self = GSM_CLIENT (object);
switch (prop_id) {
- case PROP_CLIENT_ID:
- gsm_client_set_client_id (self, g_value_get_string (value));
+ case PROP_STARTUP_ID:
+ gsm_client_set_startup_id (self, g_value_get_string (value));
break;
case PROP_APP_ID:
gsm_client_set_app_id (self, g_value_get_string (value));
@@ -212,8 +213,8 @@
self = GSM_CLIENT (object);
switch (prop_id) {
- case PROP_CLIENT_ID:
- g_value_set_string (value, self->priv->client_id);
+ case PROP_STARTUP_ID:
+ g_value_set_string (value, self->priv->startup_id);
break;
case PROP_APP_ID:
g_value_set_string (value, self->priv->app_id);
@@ -233,7 +234,7 @@
{
g_return_val_if_fail (GSM_IS_CLIENT (client), FALSE);
- g_signal_emit (client, signals[STOP], 0);
+ g_warning ("Stop not implemented");
return TRUE;
}
@@ -259,21 +260,21 @@
g_cclosure_marshal_VOID__VOID,
G_TYPE_NONE,
0);
- signals[STOP] =
- g_signal_new ("stop",
+ signals[END_SESSION_RESPONSE] =
+ g_signal_new ("end-session-response",
G_OBJECT_CLASS_TYPE (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GsmClientClass, stop),
+ G_STRUCT_OFFSET (GsmClientClass, end_session_response),
NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
+ gsm_marshal_VOID__BOOLEAN_STRING,
G_TYPE_NONE,
- 0);
+ 2, G_TYPE_BOOLEAN, G_TYPE_STRING);
g_object_class_install_property (object_class,
- PROP_CLIENT_ID,
- g_param_spec_string ("client-id",
- "client-id",
- "client-id",
+ PROP_STARTUP_ID,
+ g_param_spec_string ("startup-id",
+ "startup-id",
+ "startup-id",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
@@ -308,11 +309,11 @@
const char *
-gsm_client_get_client_id (GsmClient *client)
+gsm_client_get_startup_id (GsmClient *client)
{
g_return_val_if_fail (GSM_IS_CLIENT (client), NULL);
- return client->priv->client_id;
+ return client->priv->startup_id;
}
const char *
@@ -347,8 +348,6 @@
{
g_return_val_if_fail (GSM_IS_CLIENT (client), FALSE);
- g_signal_emit (client, signals[STOP], 0);
-
return GSM_CLIENT_GET_CLASS (client)->impl_stop (client, error);
}
@@ -357,3 +356,11 @@
{
g_signal_emit (client, signals[DISCONNECTED], 0);
}
+
+void
+gdm_client_end_session_response (GsmClient *client,
+ gboolean is_ok,
+ const char *reason)
+{
+ g_signal_emit (client, signals[END_SESSION_RESPONSE], 0, is_ok, reason);
+}
Modified: branches/dbus_based/gnome-session/gsm-client.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.h (original)
+++ branches/dbus_based/gnome-session/gsm-client.h Wed Jul 16 19:17:27 2008
@@ -57,44 +57,46 @@
GObjectClass parent_class;
/* signals */
- void (*disconnected) (GsmClient *client);
- void (*stop) (GsmClient *client);
- void (*query_end_session) (GsmClient *client,
- guint flags);
- void (*end_session) (GsmClient *client,
- guint flags);
+ void (*disconnected) (GsmClient *client);
+ void (*end_session_response) (GsmClient *client,
+ gboolean ok,
+ const char *reason);
/* virtual methods */
- void (*impl_query_end_session) (GsmClient *client,
- guint flags);
- void (*impl_end_session) (GsmClient *client,
- guint flags);
- gboolean (*impl_stop) (GsmClient *client,
- GError **error);
+ void (*impl_query_end_session) (GsmClient *client,
+ guint flags);
+ void (*impl_end_session) (GsmClient *client,
+ guint flags);
+ gboolean (*impl_stop) (GsmClient *client,
+ GError **error);
};
-GType gsm_client_get_type (void) G_GNUC_CONST;
+GType gsm_client_get_type (void) G_GNUC_CONST;
-const char *gsm_client_get_id (GsmClient *client);
-const char *gsm_client_get_client_id (GsmClient *client);
-const char *gsm_client_get_app_id (GsmClient *client);
-void gsm_client_set_app_id (GsmClient *client,
- const char *app_id);
-int gsm_client_get_status (GsmClient *client);
-void gsm_client_set_status (GsmClient *client,
- int status);
-
-void gsm_client_end_session (GsmClient *client,
- guint flags);
-void gsm_client_query_end_session (GsmClient *client,
- guint flags);
-void gsm_client_end_session (GsmClient *client,
- guint flags);
-
-gboolean gsm_client_stop (GsmClient *client,
- GError **error);
-
-void gsm_client_disconnected (GsmClient *client);
+const char *gsm_client_get_id (GsmClient *client);
+const char *gsm_client_get_startup_id (GsmClient *client);
+const char *gsm_client_get_app_id (GsmClient *client);
+void gsm_client_set_app_id (GsmClient *client,
+ const char *app_id);
+int gsm_client_get_status (GsmClient *client);
+void gsm_client_set_status (GsmClient *client,
+ int status);
+
+void gsm_client_end_session (GsmClient *client,
+ guint flags);
+void gsm_client_query_end_session (GsmClient *client,
+ guint flags);
+
+gboolean gsm_client_stop (GsmClient *client,
+ GError **error);
+
+void gsm_client_disconnected (GsmClient *client);
+
+/* private */
+
+void gdm_client_end_session_response (GsmClient *client,
+ gboolean is_ok,
+ const char *reason);
G_END_DECLS
Modified: branches/dbus_based/gnome-session/gsm-client.xml
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.xml (original)
+++ branches/dbus_based/gnome-session/gsm-client.xml Wed Jul 16 19:17:27 2008
@@ -2,17 +2,5 @@
<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
<node>
<interface name="org.gnome.SessionManager.Client">
-
- <signal name="Stop">
- </signal>
-
- <signal name="QueryEndSession">
- <arg name="flags" type="u"/>
- </signal>
-
- <signal name="EndSession">
- <arg name="flags" type="u"/>
- </signal>
-
</interface>
</node>
Modified: branches/dbus_based/gnome-session/gsm-dbus-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-dbus-client.c (original)
+++ branches/dbus_based/gnome-session/gsm-dbus-client.c Wed Jul 16 19:17:27 2008
@@ -30,15 +30,18 @@
#include <dbus/dbus-glib.h>
#include <dbus/dbus.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus-glib-lowlevel.h>
#include "gsm-dbus-client.h"
+#include "gsm-dbus-client-glue.h"
#include "gsm-marshal.h"
#include "gsm-manager.h"
#define GSM_DBUS_CLIENT_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_DBUS_CLIENT, GsmDBusClientPrivate))
-#define CLIENT_INTERFACE "org.gnome.SessionManager.Client"
+#define CLIENT_INTERFACE "org.gnome.SessionManager.DBusClient"
struct GsmDBusClientPrivate
{
@@ -52,6 +55,39 @@
G_DEFINE_TYPE (GsmDBusClient, gsm_dbus_client, GSM_TYPE_CLIENT)
+GQuark
+gsm_dbus_client_error_quark (void)
+{
+ static GQuark ret = 0;
+ if (ret == 0) {
+ ret = g_quark_from_static_string ("gsm_dbus_client_error");
+ }
+
+ return ret;
+}
+
+#define ENUM_ENTRY(NAME, DESC) { NAME, "" #NAME "", DESC }
+
+GType
+gsm_dbus_client_error_get_type (void)
+{
+ static GType etype = 0;
+
+ if (etype == 0) {
+ static const GEnumValue values[] = {
+ ENUM_ENTRY (GSM_DBUS_CLIENT_ERROR_GENERAL, "GeneralError"),
+ ENUM_ENTRY (GSM_DBUS_CLIENT_ERROR_NOT_CLIENT, "NotClient"),
+ { 0, 0, 0 }
+ };
+
+ g_assert (GSM_DBUS_CLIENT_NUM_ERRORS == G_N_ELEMENTS (values) - 1);
+
+ etype = g_enum_register_static ("GsmDbusClientError", values);
+ }
+
+ return etype;
+}
+
static GObject *
gsm_dbus_client_constructor (GType type,
guint n_construct_properties,
@@ -307,6 +343,8 @@
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GsmDBusClientPrivate));
+ dbus_g_object_type_install_info (GSM_TYPE_CLIENT, &dbus_glib_gsm_dbus_client_object_info);
+ dbus_g_error_domain_register (GSM_DBUS_CLIENT_ERROR, NULL, GSM_DBUS_CLIENT_TYPE_ERROR);
}
GsmClient *
@@ -322,3 +360,31 @@
return GSM_CLIENT (client);
}
+
+void
+gsm_dbus_client_end_session_response (GsmDBusClient *client,
+ gboolean is_ok,
+ const char *reason,
+ DBusGMethodInvocation *context)
+{
+ const char *sender;
+
+ /* make sure it is from our client */
+ sender = dbus_g_method_get_sender (context);
+ if (sender == NULL
+ || client->priv->bus_name == NULL
+ || strcmp (sender, client->priv->bus_name) != 0) {
+ GError *error;
+
+ error = g_error_new (GSM_DBUS_CLIENT_ERROR,
+ GSM_DBUS_CLIENT_ERROR_NOT_CLIENT,
+ "%s",
+ "Not recognized as the session client");
+ dbus_g_method_return_error (context, error);
+ g_error_free (error);
+ return;
+ }
+
+ gdm_client_end_session_response (GSM_CLIENT (client), is_ok, reason);
+ dbus_g_method_return (context);
+}
Modified: branches/dbus_based/gnome-session/gsm-dbus-client.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-dbus-client.h (original)
+++ branches/dbus_based/gnome-session/gsm-dbus-client.h Wed Jul 16 19:17:27 2008
@@ -46,15 +46,34 @@
struct _GsmDBusClientClass
{
GsmClientClass parent_class;
-
};
+typedef enum
+{
+ GSM_DBUS_CLIENT_ERROR_GENERAL = 0,
+ GSM_DBUS_CLIENT_ERROR_NOT_CLIENT,
+ GSM_DBUS_CLIENT_NUM_ERRORS
+} GsmDBusClientError;
+
+#define GSM_DBUS_CLIENT_ERROR gsm_dbus_client_error_quark ()
+
+GType gsm_dbus_client_error_get_type (void);
+#define GSM_DBUS_CLIENT_TYPE_ERROR (gsm_dbus_client_error_get_type ())
+
+GQuark gsm_dbus_client_error_quark (void);
+
GType gsm_dbus_client_get_type (void) G_GNUC_CONST;
GsmClient * gsm_dbus_client_new (const char *client_id,
const char *bus_name);
const char * gsm_dbus_client_get_bus_name (GsmDBusClient *client);
+/* published methods */
+void gsm_dbus_client_end_session_response (GsmDBusClient *client,
+ gboolean ok_to_proceed,
+ const char *reason,
+ DBusGMethodInvocation *context);
+
G_END_DECLS
#endif /* __GSM_DBUS_CLIENT_H__ */
Added: branches/dbus_based/gnome-session/gsm-dbus-client.xml
==============================================================================
--- (empty file)
+++ branches/dbus_based/gnome-session/gsm-dbus-client.xml Wed Jul 16 19:17:27 2008
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
+<node>
+ <interface name="org.gnome.SessionManager.DBusClient">
+
+ <method name="EndSessionResponse">
+ <annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
+ <arg name="is_ok" type="b" direction="in"/>
+ <arg name="reason" type="s" direction="in"/>
+ </method>
+
+ <signal name="Stop">
+ </signal>
+ <signal name="QueryEndSession">
+ <arg name="flags" type="u"/>
+ </signal>
+ <signal name="EndSession">
+ <arg name="flags" type="u"/>
+ </signal>
+
+ </interface>
+</node>
Modified: branches/dbus_based/gnome-session/gsm-inhibitor.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor.c (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor.c Wed Jul 16 19:17:27 2008
@@ -34,6 +34,7 @@
{
char *bus_name;
char *app_id;
+ char *client_id;
char *reason;
guint flags;
guint toplevel_xid;
@@ -45,6 +46,7 @@
PROP_BUS_NAME,
PROP_REASON,
PROP_APP_ID,
+ PROP_CLIENT_ID,
PROP_FLAGS,
PROP_TOPLEVEL_XID,
PROP_COOKIE,
@@ -97,6 +99,18 @@
}
static void
+gsm_inhibitor_set_client_id (GsmInhibitor *inhibitor,
+ const char *client_id)
+{
+ g_return_if_fail (GSM_IS_INHIBITOR (inhibitor));
+
+ g_free (inhibitor->priv->client_id);
+
+ inhibitor->priv->client_id = g_strdup (client_id);
+ g_object_notify (G_OBJECT (inhibitor), "client-id");
+}
+
+static void
gsm_inhibitor_set_reason (GsmInhibitor *inhibitor,
const char *reason)
{
@@ -161,6 +175,14 @@
}
const char *
+gsm_inhibitor_get_client_id (GsmInhibitor *inhibitor)
+{
+ g_return_val_if_fail (GSM_IS_INHIBITOR (inhibitor), NULL);
+
+ return inhibitor->priv->client_id;
+}
+
+const char *
gsm_inhibitor_get_reason (GsmInhibitor *inhibitor)
{
g_return_val_if_fail (GSM_IS_INHIBITOR (inhibitor), NULL);
@@ -209,6 +231,9 @@
case PROP_APP_ID:
gsm_inhibitor_set_app_id (self, g_value_get_string (value));
break;
+ case PROP_CLIENT_ID:
+ gsm_inhibitor_set_client_id (self, g_value_get_string (value));
+ break;
case PROP_REASON:
gsm_inhibitor_set_reason (self, g_value_get_string (value));
break;
@@ -244,6 +269,9 @@
case PROP_APP_ID:
g_value_set_string (value, self->priv->app_id);
break;
+ case PROP_CLIENT_ID:
+ g_value_set_string (value, self->priv->client_id);
+ break;
case PROP_REASON:
g_value_set_string (value, self->priv->reason);
break;
@@ -269,6 +297,7 @@
g_free (inhibitor->priv->bus_name);
g_free (inhibitor->priv->app_id);
+ g_free (inhibitor->priv->client_id);
g_free (inhibitor->priv->reason);
G_OBJECT_CLASS (gsm_inhibitor_parent_class)->finalize (object);
@@ -299,6 +328,13 @@
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class,
+ PROP_CLIENT_ID,
+ g_param_spec_string ("client-id",
+ "client-id",
+ "client-id",
+ NULL,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+ g_object_class_install_property (object_class,
PROP_REASON,
g_param_spec_string ("reason",
"reason",
@@ -357,3 +393,21 @@
return inhibitor;
}
+
+GsmInhibitor *
+gsm_inhibitor_new_for_client (const char *client_id,
+ guint flags,
+ const char *reason,
+ guint cookie)
+{
+ GsmInhibitor *inhibitor;
+
+ inhibitor = g_object_new (GSM_TYPE_INHIBITOR,
+ "client-id", client_id,
+ "reason", reason,
+ "flags", flags,
+ "cookie", cookie,
+ NULL);
+
+ return inhibitor;
+}
Modified: branches/dbus_based/gnome-session/gsm-inhibitor.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor.h (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor.h Wed Jul 16 19:17:27 2008
@@ -63,8 +63,13 @@
const char *reason,
const char *bus_name,
guint cookie);
+GsmInhibitor * gsm_inhibitor_new_for_client (const char *client_id,
+ guint flags,
+ const char *reason,
+ guint cookie);
const char * gsm_inhibitor_get_app_id (GsmInhibitor *inhibitor);
+const char * gsm_inhibitor_get_client_id (GsmInhibitor *inhibitor);
const char * gsm_inhibitor_get_reason (GsmInhibitor *inhibitor);
const char * gsm_inhibitor_get_bus_name (GsmInhibitor *inhibitor);
guint gsm_inhibitor_get_cookie (GsmInhibitor *inhibitor);
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 Wed Jul 16 19:17:27 2008
@@ -82,9 +82,10 @@
/* Startup/resumed apps */
GHashTable *apps_by_id;
+
/* Current status */
GsmManagerPhase phase;
- guint timeout_id;
+ guint phase_timeout_id;
GSList *pending_apps;
GtkWidget *inhibit_dialog;
@@ -93,6 +94,10 @@
* and shouldn't be automatically restarted */
GSList *condition_clients;
+ guint query_timeout_id;
+ GSList *query_clients;
+ GSList *busy_clients;
+
DBusGProxy *bus_proxy;
DBusGConnection *connection;
};
@@ -160,18 +165,18 @@
}
static gboolean
-_find_by_client_id (const char *id,
- GsmClient *client,
- const char *client_id_a)
+_find_by_startup_id (const char *id,
+ GsmClient *client,
+ const char *startup_id_a)
{
- const char *client_id_b;
+ const char *startup_id_b;
- client_id_b = gsm_client_get_client_id (client);
- if (client_id_b == NULL) {
+ startup_id_b = gsm_client_get_startup_id (client);
+ if (startup_id_b == NULL) {
return FALSE;
}
- return (strcmp (client_id_a, client_id_b) == 0);
+ return (strcmp (startup_id_a, startup_id_b) == 0);
}
static void
@@ -182,8 +187,8 @@
GsmClient *client;
client = gsm_client_store_find (manager->priv->store,
- (GsmClientStoreFunc)_find_by_client_id,
- (char *)gsm_app_get_client_id (app));
+ (GsmClientStoreFunc)_find_by_startup_id,
+ (char *)gsm_app_get_startup_id (app));
if (condition) {
if (!gsm_app_is_running (app) && client == NULL) {
@@ -246,9 +251,9 @@
g_signal_handlers_disconnect_by_func (app, app_registered, manager);
if (manager->priv->pending_apps == NULL) {
- if (manager->priv->timeout_id > 0) {
- g_source_remove (manager->priv->timeout_id);
- manager->priv->timeout_id = 0;
+ if (manager->priv->phase_timeout_id > 0) {
+ g_source_remove (manager->priv->phase_timeout_id);
+ manager->priv->phase_timeout_id = 0;
}
end_phase (manager);
@@ -260,7 +265,7 @@
{
GSList *a;
- manager->priv->timeout_id = 0;
+ manager->priv->phase_timeout_id = 0;
for (a = manager->priv->pending_apps; a; a = a->next) {
g_warning ("Application '%s' failed to register before timeout",
@@ -351,9 +356,9 @@
if (manager->priv->pending_apps != NULL) {
if (manager->priv->phase < GSM_MANAGER_PHASE_APPLICATION) {
- manager->priv->timeout_id = g_timeout_add_seconds (GSM_MANAGER_PHASE_TIMEOUT,
- (GSourceFunc)phase_timeout,
- manager);
+ manager->priv->phase_timeout_id = g_timeout_add_seconds (GSM_MANAGER_PHASE_TIMEOUT,
+ (GSourceFunc)phase_timeout,
+ manager);
}
} else {
end_phase (manager);
@@ -513,6 +518,8 @@
}
}
+ /* FIXME: also look for inhibitors from client with dbus name */
+
return matches;
}
@@ -530,24 +537,24 @@
}
static gboolean
-_app_has_client_id (const char *id,
- GsmApp *app,
- const char *client_id_a)
+_app_has_startup_id (const char *id,
+ GsmApp *app,
+ const char *startup_id_a)
{
- const char *client_id_b;
+ const char *startup_id_b;
- client_id_b = gsm_app_get_client_id (app);
+ startup_id_b = gsm_app_get_startup_id (app);
- if (client_id_b == NULL) {
+ if (startup_id_b == NULL) {
return FALSE;
}
- return (strcmp (client_id_a, client_id_b) == 0);
+ return (strcmp (startup_id_a, startup_id_b) == 0);
}
static GsmApp *
-find_app_for_client_id (GsmManager *manager,
- const char *client_id)
+find_app_for_startup_id (GsmManager *manager,
+ const char *startup_id)
{
GsmApp *found_app;
GSList *a;
@@ -561,7 +568,7 @@
for (a = manager->priv->pending_apps; a != NULL; a = a->next) {
GsmApp *app = GSM_APP (a->data);
- if (strcmp (client_id, gsm_app_get_client_id (app)) == 0) {
+ if (strcmp (startup_id, gsm_app_get_startup_id (app)) == 0) {
found_app = app;
goto out;
}
@@ -570,8 +577,8 @@
GsmApp *app;
app = g_hash_table_find (manager->priv->apps_by_id,
- (GHRFunc)_app_has_client_id,
- (char *)client_id);
+ (GHRFunc)_app_has_startup_id,
+ (char *)startup_id);
if (app != NULL) {
found_app = app;
goto out;
@@ -589,7 +596,7 @@
GsmApp *app;
GsmClient *client;
- app = find_app_for_client_id (manager, dbus_name);
+ app = find_app_for_startup_id (manager, dbus_name);
if (app == NULL) {
return;
}
@@ -676,19 +683,19 @@
}
static gboolean
-_client_has_client_id (const char *id,
- GsmClient *client,
- const char *client_id_a)
+_client_has_startup_id (const char *id,
+ GsmClient *client,
+ const char *startup_id_a)
{
- const char *client_id_b;
+ const char *startup_id_b;
- client_id_b = gsm_client_get_client_id (client);
+ startup_id_b = gsm_client_get_startup_id (client);
- if (client_id_b == NULL) {
+ if (startup_id_b == NULL) {
return FALSE;
}
- return (strcmp (client_id_a, client_id_b) == 0);
+ return (strcmp (startup_id_a, startup_id_b) == 0);
}
static void
@@ -716,12 +723,12 @@
}
if (*id == NULL) {
- new_id = gsm_util_generate_client_id ();
+ new_id = gsm_util_generate_startup_id ();
} else {
GsmClient *client;
client = gsm_client_store_find (manager->priv->store,
- (GsmClientStoreFunc)_client_has_client_id,
+ (GsmClientStoreFunc)_client_has_startup_id,
*id);
/* We can't have two clients with the same id. */
if (client != NULL) {
@@ -755,7 +762,7 @@
goto out;
}
- app = find_app_for_client_id (manager, new_id);
+ app = find_app_for_startup_id (manager, new_id);
if (app != NULL) {
gsm_client_set_app_id (GSM_CLIENT (client), gsm_app_get_id (app));
gsm_app_registered (app);
@@ -1711,11 +1718,20 @@
gtk_widget_show (manager->priv->inhibit_dialog);
}
+static gboolean
+_client_query_end_session (const char *id,
+ GsmClient *client,
+ GsmManager *manager)
+{
+ manager->priv->query_clients = g_slist_prepend (manager->priv->query_clients,
+ client);
+ gsm_client_query_end_session (client, 0);
+ return FALSE;
+}
+
static void
-request_logout (GsmManager *manager)
+query_end_session_complete (GsmManager *manager)
{
- g_debug ("GsmManager: requesting logout");
-
if (! gsm_manager_is_logout_inhibited (manager)) {
manager_logout (manager);
return;
@@ -1735,6 +1751,139 @@
G_CALLBACK (inhibit_dialog_response),
manager);
gtk_widget_show (manager->priv->inhibit_dialog);
+
+}
+
+static gboolean
+inhibitor_has_client_id (gpointer key,
+ GsmInhibitor *inhibitor,
+ const char *client_id_a)
+{
+ gboolean matches;
+ const char *client_id_b;
+
+ client_id_b = gsm_inhibitor_get_client_id (inhibitor);
+
+ matches = FALSE;
+ if (client_id_a != NULL && client_id_b != NULL) {
+ matches = (strcmp (client_id_a, client_id_b) == 0);
+ if (matches) {
+ g_debug ("GsmManager: removing JIT inhibitor for %s for reason '%s'",
+ gsm_inhibitor_get_client_id (inhibitor),
+ gsm_inhibitor_get_reason (inhibitor));
+ }
+ }
+
+ return matches;
+}
+
+static guint32
+generate_cookie (void)
+{
+ guint32 cookie;
+
+ cookie = (guint32)g_random_int_range (1, G_MAXINT32);
+
+ return cookie;
+}
+
+static guint32
+_generate_unique_cookie (GsmManager *manager)
+{
+ guint32 cookie;
+
+ do {
+ cookie = generate_cookie ();
+ } while (gsm_inhibitor_store_lookup (manager->priv->inhibitors, cookie) != NULL);
+
+ return cookie;
+}
+
+static void
+on_client_end_session_response (GsmClient *client,
+ gboolean is_ok,
+ const char *reason,
+ GsmManager *manager)
+{
+ if (manager->priv->phase != GSM_MANAGER_PHASE_SHUTDOWN) {
+ /* Not shutting down, nothing to do */
+ return;
+ }
+
+ manager->priv->query_clients = g_slist_remove (manager->priv->query_clients, client);
+
+ if (! is_ok) {
+ guint cookie;
+ GsmInhibitor *inhibitor;
+
+ /* FIXME: do we support updating the reason? */
+
+ cookie = _generate_unique_cookie (manager);
+ inhibitor = gsm_inhibitor_new_for_client (gsm_client_get_id (client),
+ GSM_INHIBITOR_FLAG_LOGOUT,
+ reason,
+ cookie);
+ gsm_inhibitor_store_add (manager->priv->inhibitors, inhibitor);
+ g_object_unref (inhibitor);
+ } else {
+ gsm_inhibitor_store_foreach_remove (manager->priv->inhibitors,
+ (GsmInhibitorStoreFunc)inhibitor_has_client_id,
+ (gpointer)gsm_client_get_id (client));
+ }
+}
+
+static gboolean
+on_query_end_session_timeout (GsmManager *manager)
+{
+ GSList *l;
+
+ manager->priv->query_timeout_id = 0;
+
+ for (l = manager->priv->query_clients; l != NULL; l = l->next) {
+ guint cookie;
+ GsmInhibitor *inhibitor;
+
+ g_warning ("Client '%s' failed to reply before timeout",
+ gsm_client_get_id (l->data));
+
+ /* Add JIT inhibit for unresponsive client */
+
+ cookie = _generate_unique_cookie (manager);
+ inhibitor = gsm_inhibitor_new_for_client (gsm_client_get_id (l->data),
+ GSM_INHIBITOR_FLAG_LOGOUT,
+ _("Not responding"),
+ cookie);
+ gsm_inhibitor_store_add (manager->priv->inhibitors, inhibitor);
+ g_object_unref (inhibitor);
+ }
+
+ query_end_session_complete (manager);
+
+ return FALSE;
+}
+
+static void
+query_end_session (GsmManager *manager)
+{
+ if (manager->priv->query_timeout_id > 0) {
+ g_source_remove (manager->priv->query_timeout_id);
+ manager->priv->query_timeout_id = 0;
+ }
+ manager->priv->query_timeout_id = g_timeout_add_seconds (1, (GSourceFunc)on_query_end_session_timeout, manager);
+ gsm_client_store_foreach (manager->priv->store,
+ (GsmClientStoreFunc)_client_query_end_session,
+ &manager);
+}
+
+static void
+request_logout (GsmManager *manager)
+{
+ g_debug ("GsmManager: requesting logout");
+
+ /* First thing is to alert clients that a logout has been requested.
+ * We wait for all clients to respond or 1 second, which ever occurs first.
+ */
+ query_end_session (manager);
}
static void
@@ -1845,8 +1994,8 @@
}
static void
-initiate_logout (GsmManager *manager,
- gboolean show_confirmation)
+user_logout (GsmManager *manager,
+ gboolean show_confirmation)
{
gboolean logout_prompt;
GConfClient *client;
@@ -1855,7 +2004,6 @@
/* Already shutting down, nothing more to do */
return;
}
-
client = gconf_client_get_default ();
logout_prompt = gconf_client_get_bool (client,
"/apps/gnome-session/options/logout_prompt",
@@ -1917,11 +2065,11 @@
switch (logout_mode) {
case GSM_MANAGER_LOGOUT_MODE_NORMAL:
- initiate_logout (manager, TRUE);
+ user_logout (manager, TRUE);
break;
case GSM_MANAGER_LOGOUT_MODE_NO_CONFIRMATION:
- initiate_logout (manager, FALSE);
+ user_logout (manager, FALSE);
break;
case GSM_MANAGER_LOGOUT_MODE_FORCE:
@@ -1989,16 +2137,16 @@
gboolean
gsm_manager_register_client (GsmManager *manager,
- const char *client_startup_id,
+ const char *startup_id,
const char *app_id,
DBusGMethodInvocation *context)
{
- char *client_id;
+ char *new_startup_id;
char *sender;
GsmClient *client;
GsmApp *app;
- g_debug ("GsmManager: RegisterClient %s", client_startup_id);
+ g_debug ("GsmManager: RegisterClient %s", startup_id);
if (manager->priv->phase == GSM_MANAGER_PHASE_SHUTDOWN) {
GError *new_error;
@@ -2013,16 +2161,15 @@
return FALSE;
}
- if (client_startup_id == NULL
- || client_startup_id[0] == '\0') {
- client_id = gsm_util_generate_client_id ();
+ if (startup_id == NULL
+ || startup_id[0] == '\0') {
+ new_startup_id = gsm_util_generate_startup_id ();
} else {
- GsmClient *client;
client = gsm_client_store_find (manager->priv->store,
- (GsmClientStoreFunc)_client_has_client_id,
- (char *)client_startup_id);
- /* We can't have two clients with the same id. */
+ (GsmClientStoreFunc)_client_has_startup_id,
+ (char *)startup_id);
+ /* We can't have two clients with the same startup id. */
if (client != NULL) {
GError *new_error;
@@ -2036,26 +2183,26 @@
return FALSE;
}
- client_id = g_strdup (client_startup_id);
+ new_startup_id = g_strdup (startup_id);
}
- g_debug ("GsmManager: Adding new client %s to session", client_id);
+ g_debug ("GsmManager: Adding new client %s to session", new_startup_id);
- if ((client_startup_id == NULL || client_startup_id[0] == '\0')
+ if ((startup_id == NULL || startup_id[0] == '\0')
&& app_id == NULL) {
/* just accept the client - we can't associate with an
existing App */
- goto out;
- } else if (client_startup_id != NULL
- && client_startup_id[0] != '\0') {
- app = find_app_for_client_id (manager, client_startup_id);
+ app = NULL;
+ } else if (startup_id != NULL
+ && startup_id[0] != '\0') {
+ app = find_app_for_startup_id (manager, startup_id);
} else if (app_id != NULL) {
/* try to associate this app id with a known app */
app = find_app_for_app_id (manager, app_id);
}
sender = dbus_g_method_get_sender (context);
- client = gsm_dbus_client_new (client_id, sender);
+ client = gsm_dbus_client_new (new_startup_id, sender);
g_free (sender);
if (client == NULL) {
GError *new_error;
@@ -2083,27 +2230,23 @@
gsm_client_set_status (client, GSM_CLIENT_REGISTERED);
- out:
- g_assert (client_id != NULL);
- dbus_g_method_return (context, client_id);
- g_free (client_id);
+ g_assert (new_startup_id != NULL);
+ dbus_g_method_return (context, new_startup_id, gsm_client_get_id (client));
+ g_free (new_startup_id);
return TRUE;
}
gboolean
gsm_manager_unregister_client (GsmManager *manager,
- const char *session_client_id,
+ const char *client_id,
DBusGMethodInvocation *context)
{
GsmClient *client;
- g_debug ("GsmManager: UnregisterClient %s", session_client_id);
-
- client = gsm_client_store_find (manager->priv->store,
- (GsmClientStoreFunc)_client_has_client_id,
- (char *)session_client_id);
+ g_debug ("GsmManager: UnregisterClient %s", client_id);
+ client = gsm_client_store_lookup (manager->priv->store, client_id);
if (client == NULL) {
GError *new_error;
@@ -2117,7 +2260,6 @@
return FALSE;
}
-
/* don't disconnect client here, only change the status.
Wait until it leaves the bus before disconnecting it */
gsm_client_set_status (client, GSM_CLIENT_UNREGISTERED);
@@ -2127,28 +2269,6 @@
return TRUE;
}
-static guint32
-generate_cookie (void)
-{
- guint32 cookie;
-
- cookie = (guint32)g_random_int_range (1, G_MAXINT32);
-
- return cookie;
-}
-
-static guint32
-_generate_unique_cookie (GsmManager *manager)
-{
- guint32 cookie;
-
- do {
- cookie = generate_cookie ();
- } while (gsm_inhibitor_store_lookup (manager->priv->inhibitors, cookie) != NULL);
-
- return cookie;
-}
-
gboolean
gsm_manager_inhibit (GsmManager *manager,
const char *app_id,
Modified: branches/dbus_based/gnome-session/gsm-manager.xml
==============================================================================
--- branches/dbus_based/gnome-session/gsm-manager.xml (original)
+++ branches/dbus_based/gnome-session/gsm-manager.xml Wed Jul 16 19:17:27 2008
@@ -18,13 +18,14 @@
<method name="RegisterClient">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="client_startup_id" direction="in"/>
<arg type="s" name="app_id" direction="in"/>
- <arg type="s" name="session_client_id" direction="out"/>
+ <arg type="s" name="client_startup_id" direction="in"/>
+ <arg type="s" name="new_client_startup_id" direction="out"/>
+ <arg type="s" name="client_id" direction="out"/>
</method>
<method name="UnregisterClient">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
- <arg type="s" name="session_client_id" direction="in"/>
+ <arg type="s" name="client_id" direction="in"/>
</method>
<method name="Inhibit">
Modified: branches/dbus_based/gnome-session/gsm-marshal.list
==============================================================================
--- branches/dbus_based/gnome-session/gsm-marshal.list (original)
+++ branches/dbus_based/gnome-session/gsm-marshal.list Wed Jul 16 19:17:27 2008
@@ -1 +1,2 @@
BOOLEAN:POINTER
+VOID:BOOLEAN,STRING
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 Wed Jul 16 19:17:27 2008
@@ -144,7 +144,7 @@
const char *id;
prop = find_property (client, SmProgram, NULL);
- id = gsm_client_get_client_id (GSM_CLIENT (client));
+ id = gsm_client_get_startup_id (GSM_CLIENT (client));
g_free (client->priv->description);
if (prop) {
Modified: branches/dbus_based/gnome-session/test-client-dbus.c
==============================================================================
--- branches/dbus_based/gnome-session/test-client-dbus.c (original)
+++ branches/dbus_based/gnome-session/test-client-dbus.c Wed Jul 16 19:17:27 2008
@@ -35,6 +35,7 @@
static DBusGConnection *bus_connection = NULL;
static DBusGProxy *sm_proxy = NULL;
+static char *new_startup_id = NULL;
static char *client_id = NULL;
static gboolean
@@ -76,9 +77,10 @@
res = dbus_g_proxy_call (sm_proxy,
"RegisterClient",
&error,
- G_TYPE_STRING, startup_id,
G_TYPE_STRING, app_id,
+ G_TYPE_STRING, startup_id,
G_TYPE_INVALID,
+ G_TYPE_STRING, &new_startup_id,
G_TYPE_STRING, &client_id,
G_TYPE_INVALID);
if (! res) {
Modified: branches/dbus_based/gnome-session/util.c
==============================================================================
--- branches/dbus_based/gnome-session/util.c (original)
+++ branches/dbus_based/gnome-session/util.c Wed Jul 16 19:17:27 2008
@@ -160,14 +160,14 @@
}
/**
- * gsm_util_generate_client_id:
+ * gsm_util_generate_startup_id:
*
* Generates a new SM client ID.
*
* Return value: an SM client ID.
**/
char *
-gsm_util_generate_client_id (void)
+gsm_util_generate_startup_id (void)
{
static int sequence = -1;
static guint rand1 = 0, rand2 = 0;
Modified: branches/dbus_based/gnome-session/util.h
==============================================================================
--- branches/dbus_based/gnome-session/util.h (original)
+++ branches/dbus_based/gnome-session/util.h Wed Jul 16 19:17:27 2008
@@ -30,7 +30,7 @@
void gsm_util_init_error (gboolean fatal,
const char *format, ...);
-char * gsm_util_generate_client_id (void);
+char * gsm_util_generate_startup_id (void);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]