Commit 46d5a808 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Rename client-id to startup-id to distinguish from Client's ID. Start

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.


svn path=/branches/dbus_based/; revision=4805
parent eea44ea8
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.
2008-07-15 William Jon McCann <jmccann@redhat.com>
* gnome-session/gsm-client.c (gsm_client_query_end_session),
......
......@@ -91,7 +91,8 @@ gnome_session_SOURCES = \
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-manager-glue.h: gsm-manager.xml Makefile.am
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 @@ EXTRA_DIST = \
$(glade_DATA) \
README \
gsm-marshal.list \
gsm-manager.xml
gsm-manager.xml \
gsm-client.xml \
gsm-dbus-client.xml \
$(NULL)
MAINTAINERCLEANFILES = \
*~ \
......
......@@ -34,7 +34,7 @@ struct _GsmAppPrivate
{
char *id;
int phase;
char *client_id;
char *startup_id;
};
......@@ -50,7 +50,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum {
PROP_0,
PROP_ID,
PROP_CLIENT_ID,
PROP_STARTUP_ID,
PROP_PHASE,
LAST_PROP
};
......@@ -96,15 +96,15 @@ gsm_app_set_id (GsmApp *app,
}
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 @@ gsm_app_set_property (GObject *object,
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 @@ gsm_app_get_property (GObject *object,
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 @@ gsm_app_dispose (GObject *object)
{
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 @@ gsm_app_class_init (GsmAppClass *klass)
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 @@ gsm_app_get_id (GsmApp *app)
}
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;
}
/**
......
......@@ -97,7 +97,7 @@ gboolean gsm_app_stop (GsmApp *app,
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);
......
......@@ -87,7 +87,7 @@ static gboolean
load_desktop_file (GsmAutostartApp *app)
{
char *dbus_name;
char *client_id;
char *startup_id;
char *phase_str;
int phase;
......@@ -128,10 +128,10 @@ load_desktop_file (GsmAutostartApp *app)
/* 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 @@ load_desktop_file (GsmAutostartApp *app)
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 @@ autostart_app_start_spawn (GsmAutostartApp *app,
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 @@ autostart_app_start_activate (GsmAutostartApp *app,
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,
......
......@@ -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 @@ static guint32 client_serial = 1;
struct GsmClientPrivate
{
char *id;
char *client_id;
char *startup_id;
char *app_id;
int status;
DBusGConnection *connection;
......@@ -44,14 +45,14 @@ struct GsmClientPrivate
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 @@ gsm_client_finalize (GObject *object)
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 @@ gsm_client_set_status (GsmClient *client,
}
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 @@ gsm_client_set_property (GObject *object,
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 @@ gsm_client_get_property (GObject *object,
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 @@ default_stop (GsmClient *client,
{
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 @@ gsm_client_class_init (GsmClientClass *klass)
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 @@ gsm_client_get_id (GsmClient *client)
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 @@ gsm_client_stop (GsmClient *client,
{
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 @@ gsm_client_disconnected (GsmClient *client)
{
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);
}
......@@ -57,44 +57,46 @@ struct _GsmClientClass
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);
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);
void gsm_client_end_session (GsmClient *client,
guint flags);
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);
gboolean gsm_client_stop (GsmClient *client,
GError **error);
void gsm_client_disconnected (GsmClient *client);
void gsm_client_disconnected (GsmClient *client);
/* private */
void gdm_client_end_session_response (GsmClient *client,
gboolean is_ok,
const char *reason);
G_END_DECLS
......
......@@ -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>
......@@ -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 @@ enum {
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 @@ gsm_dbus_client_class_init (GsmDBusClientClass *klass)
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 @@ gsm_dbus_client_new (const char *client_id,
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);
}
......@@ -46,15 +46,34 @@ struct _GsmDBusClient
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__ */
<?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>
......@@ -34,6 +34,7 @@ struct GsmInhibitorPrivate
{
char *bus_name;
char *app_id;
char *client_id;
char *reason;
guint flags;
guint toplevel_xid;
......@@ -45,6 +46,7 @@ enum {
PROP_BUS_NAME,
PROP_REASON,
PROP_APP_ID,
PROP_CLIENT_ID,
PROP_FLAGS,
PROP_TOPLEVEL_XID,
PROP_COOKIE,
......@@ -96,6 +98,18 @@ gsm_inhibitor_set_app_id (GsmInhibitor *inhibitor,
g_object_notify (G_OBJECT (inhibitor), "app-id");
}
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)
......@@ -160,6 +174,14 @@ gsm_inhibitor_get_app_id (GsmInhibitor *inhibitor)
return inhibitor->priv->app_id;
}
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)
{
......@@ -209,6 +231,9 @@ gsm_inhibitor_set_property (GObject *object,
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 @@ gsm_inhibitor_get_property (GObject *object,
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 @@ gsm_inhibitor_finalize (GObject *object)
g_free (inhibitor->priv->bus_name);
g_free (inhibitor->priv->app_id);