Commit ad2bb9d1 authored by William Jon McCann's avatar William Jon McCann Committed by William Jon McCann

Add dbus method client support. Add test client. Fix up restart handling.

2008-06-18  William Jon McCann  <jmccann@redhat.com>

	* gnome-session/Makefile.am:
	* gnome-session/gsm-app.c (gsm_app_class_init),
	(gsm_app_get_autorestart), (gsm_app_restart):
	* gnome-session/gsm-app.h:
	* gnome-session/gsm-autostart-app.c (gsm_autostart_app_dispose),
	(gsm_autostart_app_stop), (gsm_autostart_app_start),
	(gsm_autostart_app_restart), (gsm_autostart_app_get_autorestart),
	(gsm_autostart_app_class_init):
	* gnome-session/gsm-client.c (gsm_client_class_init):
	* gnome-session/gsm-client.h:
	* gnome-session/gsm-dbus-client.c (gsm_dbus_client_set_bus_name),
	(gsm_dbus_client_get_bus_name), (gsm_dbus_client_set_property),
	(gsm_dbus_client_get_property), (gsm_dbus_client_class_init):
	* gnome-session/gsm-dbus-client.h:
	* gnome-session/gsm-manager.c (gsm_manager_error_get_type),
	(find_app_for_app_id), (disconnect_client),
	(_disconnect_dbus_client), (remove_clients_for_connection),
	(on_client_disconnected), (on_xsmp_client_register_request),
	(gsm_manager_register_client), (gsm_manager_unregister_client):
	* gnome-session/gsm-manager.h:
	* gnome-session/gsm-manager.xml:
	* gnome-session/gsm-method-client.c (gsm_method_client_class_init):
	* gnome-session/gsm-resumed-app.c (app_exited),
	(gsm_resumed_app_start), (gsm_resumed_app_restart),
	(gsm_resumed_app_dispose), (gsm_resumed_app_class_init):
	* gnome-session/gsm-service-client.c
	(gsm_service_client_class_init):
	* gnome-session/gsm-xsmp-client.c (gsm_xsmp_client_class_init),
	(register_client_callback):
	* gnome-session/test-client-method.c (session_manager_connect),
	(register_client), (session_manager_disconnect),
	(unregister_client), (main):
	Add dbus method client support.  Add test client.  Fix up
	restart handling.


svn path=/branches/dbus_based/; revision=4760
parent 1ef06768
2008-06-18 William Jon McCann <jmccann@redhat.com>
* gnome-session/Makefile.am:
* gnome-session/gsm-app.c (gsm_app_class_init),
(gsm_app_get_autorestart), (gsm_app_restart):
* gnome-session/gsm-app.h:
* gnome-session/gsm-autostart-app.c (gsm_autostart_app_dispose),
(gsm_autostart_app_stop), (gsm_autostart_app_start),
(gsm_autostart_app_restart), (gsm_autostart_app_get_autorestart),
(gsm_autostart_app_class_init):
* gnome-session/gsm-client.c (gsm_client_class_init):
* gnome-session/gsm-client.h:
* gnome-session/gsm-dbus-client.c (gsm_dbus_client_set_bus_name),
(gsm_dbus_client_get_bus_name), (gsm_dbus_client_set_property),
(gsm_dbus_client_get_property), (gsm_dbus_client_class_init):
* gnome-session/gsm-dbus-client.h:
* gnome-session/gsm-manager.c (gsm_manager_error_get_type),
(find_app_for_app_id), (disconnect_client),
(_disconnect_dbus_client), (remove_clients_for_connection),
(on_client_disconnected), (on_xsmp_client_register_request),
(gsm_manager_register_client), (gsm_manager_unregister_client):
* gnome-session/gsm-manager.h:
* gnome-session/gsm-manager.xml:
* gnome-session/gsm-method-client.c (gsm_method_client_class_init):
* gnome-session/gsm-resumed-app.c (app_exited),
(gsm_resumed_app_start), (gsm_resumed_app_restart),
(gsm_resumed_app_dispose), (gsm_resumed_app_class_init):
* gnome-session/gsm-service-client.c
(gsm_service_client_class_init):
* gnome-session/gsm-xsmp-client.c (gsm_xsmp_client_class_init),
(register_client_callback):
* gnome-session/test-client-method.c (session_manager_connect),
(register_client), (session_manager_disconnect),
(unregister_client), (main):
Add dbus method client support. Add test client. Fix up
restart handling.
2008-06-18 William Jon McCann <jmccann@redhat.com>
* gnome-session/gsm-app.c:
......
NULL =
bin_PROGRAMS = gnome-session
noinst_LTLIBRARIES = libgsmutil.la
noinst_PROGRAMS = \
test-client-method \
$(NULL)
INCLUDES = \
$(WARN_CFLAGS) \
$(GNOME_SESSION_CFLAGS) \
......@@ -16,6 +22,14 @@ INCLUDES = \
-DGCONF_SANITY_CHECK=\""$(GCONF_SANITY_CHECK)"\" \
-DGCONFTOOL_CMD=\"$(GCONFTOOL)\"
test_client_method_SOURCES = \
test-client-method.c \
$(NULL)
test_client_method_LDADD = \
$(DBUS_GLIB_LIBS) \
$(NULL)
gnome_session_LDADD = \
-lSM -lICE \
libgsmutil.la \
......
......@@ -142,6 +142,7 @@ gsm_app_class_init (GsmAppClass *klass)
klass->get_id = NULL;
klass->start = NULL;
klass->get_autorestart = NULL;
klass->provides = NULL;
klass->is_running = NULL;
......@@ -253,6 +254,18 @@ gsm_app_is_running (GsmApp *app)
}
}
gboolean
gsm_app_get_autorestart (GsmApp *app)
{
g_return_val_if_fail (GSM_IS_APP (app), FALSE);
if (GSM_APP_GET_CLASS (app)->get_autorestart) {
return GSM_APP_GET_CLASS (app)->get_autorestart (app);
} else {
return FALSE;
}
}
gboolean
gsm_app_provides (GsmApp *app, const char *service)
{
......@@ -273,6 +286,15 @@ gsm_app_start (GsmApp *app,
return GSM_APP_GET_CLASS (app)->start (app, error);
}
gboolean
gsm_app_restart (GsmApp *app,
GError **error)
{
g_debug ("Re-starting app: %s", app->priv->id);
return GSM_APP_GET_CLASS (app)->restart (app, error);
}
gboolean
gsm_app_stop (GsmApp *app,
GError **error)
......
......@@ -59,26 +59,33 @@ struct _GsmAppClass
void (*registered) (GsmApp *app);
/* virtual methods */
gboolean (*start) (GsmApp *app,
GError **error);
gboolean (*stop) (GsmApp *app,
GError **error);
gboolean (*provides) (GsmApp *app,
const char *service);
gboolean (*is_running) (GsmApp *app);
const char *(*get_id) (GsmApp *app);
gboolean (*is_disabled) (GsmApp *app);
void (*set_client) (GsmApp *app,
GsmClient *client);
gboolean (*start) (GsmApp *app,
GError **error);
gboolean (*restart) (GsmApp *app,
GError **error);
gboolean (*stop) (GsmApp *app,
GError **error);
gboolean (*provides) (GsmApp *app,
const char *service);
gboolean (*is_running) (GsmApp *app);
gboolean (*get_autorestart) (GsmApp *app);
const char *(*get_id) (GsmApp *app);
gboolean (*is_disabled) (GsmApp *app);
void (*set_client) (GsmApp *app,
GsmClient *client);
};
GType gsm_app_get_type (void) G_GNUC_CONST;
gboolean gsm_app_start (GsmApp *app,
GError **error);
gboolean gsm_app_restart (GsmApp *app,
GError **error);
gboolean gsm_app_stop (GsmApp *app,
GError **error);
gboolean gsm_app_get_autorestart (GsmApp *app);
const char *gsm_app_get_id (GsmApp *app);
const char *gsm_app_get_client_id (GsmApp *app);
GsmManagerPhase gsm_app_get_phase (GsmApp *app);
......
......@@ -26,6 +26,7 @@
#include <ctype.h>
#include <string.h>
#include <sys/wait.h>
#include <glib.h>
#include <gio/gio.h>
#include "gsm-autostart-app.h"
......@@ -33,12 +34,12 @@
struct _GsmAutostartAppPrivate {
char *desktop_id;
char *startup_id;
GFileMonitor *monitor;
gboolean condition;
EggDesktopFile *desktop_file;
GPid pid;
guint child_watch_id;
char *startup_id;
};
enum {
......@@ -186,6 +187,11 @@ gsm_autostart_app_dispose (GObject *object)
priv->desktop_id = NULL;
}
if (priv->child_watch_id > 0) {
g_source_remove (priv->child_watch_id);
priv->child_watch_id = 0;
}
if (priv->monitor) {
g_file_monitor_cancel (priv->monitor);
}
......@@ -465,11 +471,22 @@ app_exited (GPid pid,
}
static gboolean
launch (GsmApp *app,
GError **error)
gsm_autostart_app_stop (GsmApp *app,
GError **error)
{
/* FIXME: */
/* first try to stop client */
/* then try to stop pid */
return TRUE;
}
static gboolean
gsm_autostart_app_start (GsmApp *app,
GError **error)
{
char *env[2] = { NULL, NULL };
gboolean success;
char *env[2] = { NULL, NULL };
gboolean success;
GsmAutostartApp *aapp;
aapp = GSM_AUTOSTART_APP (app);
......@@ -497,7 +514,7 @@ launch (GsmApp *app,
if (success) {
g_debug ("GsmAutostartApp: started pid:%d", aapp->priv->pid);
aapp->priv->child_watch_id = g_child_watch_add ((GPid) aapp->priv->pid,
aapp->priv->child_watch_id = g_child_watch_add (aapp->priv->pid,
(GChildWatchFunc)app_exited,
app);
......@@ -507,6 +524,29 @@ launch (GsmApp *app,
}
}
static gboolean
gsm_autostart_app_restart (GsmApp *app,
GError **error)
{
GError *local_error;
gboolean res;
local_error = NULL;
res = gsm_app_stop (app, &local_error);
if (! res) {
g_propagate_error (error, local_error);
return FALSE;
}
res = gsm_app_start (app, &local_error);
if (! res) {
g_propagate_error (error, local_error);
return FALSE;
}
return TRUE;
}
static gboolean
gsm_autostart_app_provides (GsmApp *app,
const char *service)
......@@ -542,6 +582,30 @@ gsm_autostart_app_provides (GsmApp *app,
return FALSE;
}
static gboolean
gsm_autostart_app_get_autorestart (GsmApp *app)
{
gboolean res;
gboolean autorestart;
if (GSM_AUTOSTART_APP (app)->priv->desktop_file == NULL) {
return FALSE;
}
autorestart = FALSE;
res = egg_desktop_file_has_key (GSM_AUTOSTART_APP (app)->priv->desktop_file,
"X-GNOME-AutoRestart",
NULL);
if (res) {
autorestart = egg_desktop_file_get_boolean (GSM_AUTOSTART_APP (app)->priv->desktop_file,
"X-GNOME-AutoRestart",
NULL);
}
return autorestart;
}
static const char *
gsm_autostart_app_get_id (GsmApp *app)
{
......@@ -594,9 +658,12 @@ gsm_autostart_app_class_init (GsmAutostartAppClass *klass)
app_class->is_disabled = is_disabled;
app_class->is_running = is_running;
app_class->start = launch;
app_class->start = gsm_autostart_app_start;
app_class->restart = gsm_autostart_app_restart;
app_class->stop = gsm_autostart_app_stop;
app_class->provides = gsm_autostart_app_provides;
app_class->get_id = gsm_autostart_app_get_id;
app_class->get_autorestart = gsm_autostart_app_get_autorestart;
g_object_class_install_property (object_class,
PROP_DESKTOP_FILE,
......
......@@ -242,7 +242,7 @@ gsm_client_class_init (GsmClientClass *klass)
"status",
-1,
G_MAXINT,
-1,
GSM_CLIENT_UNREGISTERED,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GsmClientPrivate));
......@@ -273,14 +273,6 @@ gsm_client_get_app_id (GsmClient *client)
return client->priv->app_id;
}
gboolean
gsm_client_get_autorestart (GsmClient *client)
{
g_return_val_if_fail (GSM_IS_CLIENT (client), FALSE);
return GSM_CLIENT_GET_CLASS (client)->get_autorestart (client);
}
void
gsm_client_notify_session_over (GsmClient *client)
{
......@@ -289,16 +281,6 @@ gsm_client_notify_session_over (GsmClient *client)
GSM_CLIENT_GET_CLASS (client)->notify_session_over (client);
}
gboolean
gsm_client_restart (GsmClient *client,
GError **error)
{
g_return_val_if_fail (GSM_IS_CLIENT (client), FALSE);
return GSM_CLIENT_GET_CLASS (client)->restart (client, error);
}
gboolean
gsm_client_stop (GsmClient *client,
GError **error)
......
......@@ -40,8 +40,8 @@ typedef struct _GsmClientClass GsmClientClass;
typedef struct GsmClientPrivate GsmClientPrivate;
typedef enum {
GSM_CLIENT_UNMANAGED = 0,
GSM_CLIENT_MANAGED,
GSM_CLIENT_UNREGISTERED = 0,
GSM_CLIENT_REGISTERED,
GSM_CLIENT_FINISHED,
GSM_CLIENT_FAILED,
} GsmClientStatus;
......@@ -63,9 +63,6 @@ struct _GsmClientClass
void (*notify_session_over) (GsmClient *client);
gboolean (*stop) (GsmClient *client,
GError **error);
gboolean (*restart) (GsmClient *client,
GError **error);
gboolean (*get_autorestart) (GsmClient *client);
};
GType gsm_client_get_type (void) G_GNUC_CONST;
......@@ -83,10 +80,6 @@ void gsm_client_notify_session_over (GsmClient *client);
gboolean gsm_client_stop (GsmClient *client,
GError **error);
gboolean gsm_client_restart (GsmClient *client,
GError **error);
gboolean gsm_client_get_autorestart (GsmClient *client);
void gsm_client_disconnected (GsmClient *client);
......
......@@ -69,6 +69,26 @@ gsm_dbus_client_init (GsmDBusClient *client)
client->priv = GSM_DBUS_CLIENT_GET_PRIVATE (client);
}
static void
gsm_dbus_client_set_bus_name (GsmDBusClient *client,
const char *bus_name)
{
g_return_if_fail (GSM_IS_DBUS_CLIENT (client));
g_free (client->priv->bus_name);
client->priv->bus_name = g_strdup (bus_name);
g_object_notify (G_OBJECT (client), "bus-name");
}
const char *
gsm_dbus_client_get_bus_name (GsmDBusClient *client)
{
g_return_val_if_fail (GSM_IS_DBUS_CLIENT (client), NULL);
return client->priv->bus_name;
}
static void
gsm_dbus_client_set_property (GObject *object,
guint prop_id,
......@@ -80,6 +100,9 @@ gsm_dbus_client_set_property (GObject *object,
self = GSM_DBUS_CLIENT (object);
switch (prop_id) {
case PROP_BUS_NAME:
gsm_dbus_client_set_bus_name (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -97,6 +120,9 @@ gsm_dbus_client_get_property (GObject *object,
self = GSM_DBUS_CLIENT (object);
switch (prop_id) {
case PROP_BUS_NAME:
g_value_set_string (value, self->priv->bus_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -124,5 +150,13 @@ gsm_dbus_client_class_init (GsmDBusClientClass *klass)
object_class->get_property = gsm_dbus_client_get_property;
object_class->set_property = gsm_dbus_client_set_property;
g_object_class_install_property (object_class,
PROP_BUS_NAME,
g_param_spec_string ("bus-name",
"bus-name",
"bus-name",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GsmDBusClientPrivate));
}
......@@ -51,6 +51,8 @@ struct _GsmDBusClientClass
GType gsm_dbus_client_get_type (void) G_GNUC_CONST;
const char * gsm_dbus_client_get_bus_name (GsmDBusClient *client);
G_END_DECLS
#endif /* __GSM_DBUS_CLIENT_H__ */
......@@ -58,9 +58,8 @@
#define GSM_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_MANAGER, GsmManagerPrivate))
#define GSM_DBUS_PATH "/org/gnome/SessionManager"
#define GSM_MANAGER_DBUS_PATH GSM_DBUS_PATH
#define GSM_MANAGER_DBUS_NAME "org.gnome.DisplayManager"
#define GSM_MANAGER_DBUS_PATH "/org/gnome/SessionManager"
#define GSM_MANAGER_DBUS_NAME "org.gnome.SessionManager"
#define GSM_MANAGER_PHASE_TIMEOUT 10 /* seconds */
......@@ -140,6 +139,7 @@ gsm_manager_error_get_type (void)
ENUM_ENTRY (GSM_MANAGER_ERROR_NOT_IN_INITIALIZATION, "NotInInitialization"),
ENUM_ENTRY (GSM_MANAGER_ERROR_NOT_IN_RUNNING, "NotInRunning"),
ENUM_ENTRY (GSM_MANAGER_ERROR_ALREADY_REGISTERED, "AlreadyRegistered"),
ENUM_ENTRY (GSM_MANAGER_ERROR_NOT_REGISTERED, "NotRegistered"),
{ 0, 0, 0 }
};
......@@ -362,26 +362,109 @@ gsm_manager_start (GsmManager *manager)
start_phase (manager);
}
static GsmApp *
find_app_for_app_id (GsmManager *manager,
const char *app_id)
{
GsmApp *app;
app = g_hash_table_lookup (manager->priv->apps_by_id, app_id);
return app;
}
static void
disconnect_client (GsmManager *manager,
GsmClient *client)
{
gboolean is_condition_client;
GsmApp *app;
GError *error;
gboolean res;
const char *app_id;
g_debug ("GsmManager: disconnect client");
/* take a ref so it doesn't get finalized */
g_object_ref (client);
gsm_client_store_remove (manager->priv->store, client);
is_condition_client = FALSE;
if (g_slist_find (manager->priv->condition_clients, client)) {
manager->priv->condition_clients = g_slist_remove (manager->priv->condition_clients, client);
is_condition_client = TRUE;
}
app_id = gsm_client_get_app_id (client);
if (app_id == NULL) {
g_debug ("GsmManager: no application associated with client, not restarting application");
goto out;
}
g_debug ("GsmManager: disconnect for app '%s'", app_id);
app = find_app_for_app_id (manager, app_id);
if (app == NULL) {
g_debug ("GsmManager: invalid application id, not restarting application");
goto out;
}
if (manager->priv->phase == GSM_MANAGER_PHASE_SHUTDOWN) {
g_debug ("GsmManager: in shutdown, not restarting application");
goto out;
}
if (! gsm_app_get_autorestart (app)) {
g_debug ("GsmManager: autorestart not set, not restarting application");
goto out;
}
if (is_condition_client) {
g_debug ("GsmManager: app conditionally disabled, not restarting application");
goto out;
}
g_debug ("GsmManager: restarting app");
error = NULL;
res = gsm_app_restart (app, &error);
if (error != NULL) {
g_warning ("Error on restarting session managed app: %s", error->message);
g_error_free (error);
}
out:
g_object_unref (client);
if (manager->priv->phase == GSM_MANAGER_PHASE_SHUTDOWN
&& gsm_client_store_size (manager->priv->store) == 0) {
gtk_main_quit ();
}
}
typedef struct {
const char *service_name;
GsmManager *manager;
} RemoveClientData;
static gboolean
remove_client_for_connection (char *id,
GsmClient *client,
RemoveClientData *data)
_disconnect_dbus_client (const char *id,
GsmClient *client,
RemoveClientData *data)
{
g_assert (client != NULL);
g_assert (data->service_name != NULL);
const char *name;
/* FIXME: compare service name to that of client */
#if 0
if (strcmp (info->service_name, data->service_name) == 0) {
if (! GSM_IS_DBUS_CLIENT (client)) {
return FALSE;
}
name = gsm_dbus_client_get_bus_name (GSM_DBUS_CLIENT (client));
if (name == NULL) {
return FALSE;
}
return TRUE;
if (strcmp (data->service_name, name) == 0) {
disconnect_client (data->manager, client);
}
#endif
return FALSE;
}
......@@ -395,7 +478,10 @@ remove_clients_for_connection (GsmManager *manager,
data.service_name = service_name;
data.manager = manager;
/* FIXME */
/* disconnect dbus clients for name */
gsm_client_store_foreach (manager->priv->store,
(GsmClientStoreFunc)_disconnect_dbus_client,
&data);
}
static void
......@@ -491,43 +577,8 @@ static void
on_client_disconnected (GsmClient *client,
GsmManager *manager)
{
gboolean is_condition_client = FALSE;
g_debug ("GsmManager: client disconnected");
/* take a ref so it doesn't get finalized */
g_object_ref (client);
gsm_client_store_remove (manager->priv->store, client);
if (g_slist_find (manager->priv->condition_clients, client)) {
manager->priv->condition_clients = g_slist_remove (manager->priv->condition_clients, client);
is_condition_client = TRUE;
}
if (manager->priv->phase != GSM_MANAGER_PHASE_SHUTDOWN
&& gsm_client_get_autorestart (client)
&& !is_condition_client) {
GError *error = NULL;
g_debug ("GsmManager: restarting client");
/* FIXME: need to link to app here too */
gsm_client_restart (client, &error);
if (error != NULL) {
g_warning ("Error on restarting session client: %s", error->message);
g_clear_error (&error);
}
}
g_object_unref (client);
if (manager->priv->phase == GSM_MANAGER_PHASE_SHUTDOWN
&& gsm_client_store_size (manager->priv->store) == 0) {
gtk_main_quit ();
}
g_debug ("GsmManager: disconnect client");
disconnect_client (manager, client);
}
static GsmApp *
......@@ -566,15 +617,6 @@ find_app_for_client_id (GsmManager *manager,
return found_app;
}
static GsmApp *
find_app_for_app_id (GsmManager *manager,
const char *app_id)
{
GsmApp *app;
app = g_hash_table_lookup (manager->priv->apps_by_id, app_id);
return app;
}
static gboolean
on_xsmp_client_register_request (GsmXSMPClient *client,
char **id,
......@@ -633,6 +675,7 @@ on_xsmp_client_register_request (GsmXSMPClient *client,
app = find_app_for_client_id (manager, new_id);
if (app != NULL) {
gsm_client_set_app_id (client, gsm_app_get_id (app));
gsm_app_registered (app);
goto out;
}
......@@ -1605,7 +1648,8 @@ gsm_manager_register_client (GsmManager *manager,
return FALSE;
}
if (client_startup_id == NULL) {
if (client_startup_id == NULL
|| client_startup_id[0] == '\0') {
client_id = gsm_util_generate_client_id ();
} else {
GsmClient *client;
......@@ -1632,12 +1676,13 @@ gsm_manager_register_client (GsmManager *manager,
g_debug ("GsmManager: Adding new client %s to session", client_id);
if (client_startup_id == NULL && app_id == NULL) {
if ((client_startup_id == NULL || client_startup_id[0] == '\0')
&& app_id == NULL) {
/* just accept the client - we can't associate with an
existing App */
g_free (client_id);
goto out;
} else if (client_startup_id != NULL) {
} else if (client_startup_id != NULL
&& client_startup_id[0] != '\0') {
app = find_app_for_client_id (manager, client_startup_id);
} else if (app_id != NULL) {
/* try to associate this app id with a known app */
......@@ -1647,7 +1692,6 @@ gsm_manager_register_client (GsmManager *manager,
sender = dbus_g_method_get_sender (context);
client = gsm_method_client_new (client_id, sender);
g_free (sender);
g_free (client_id);
if (client == NULL) {
GError *new_error;
......@@ -1672,8 +1716,12 @@ gsm_manager_register_client (GsmManager *manager,
gsm_client_set_app_id (client, app_id);
}
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);
return TRUE;
}
......@@ -1683,20 +1731,35 @@ gsm_manager_unregister_client (GsmManager *manager,
const char *session_client_id,
DBusGMethodInvocation *context)
{
GsmClient *client;
g_debug ("GsmManager: UnregisterClient %s", session_client_id);
if (1) {
client = gsm_client_store_find (manager->priv->store,
(GsmClientStoreFunc)_client_has_client_id,
(char *)session_client_id);
if (client == NULL) {
GError *new_error;
g_debug ("Unable to unregister client");
g_debug ("Unable to unregister client: not registered");
new_error = g_error_new (GSM_MANAGER_ERROR,
GSM_MANAGER_ERROR_GENERAL,
GSM_MANAGER_ERROR_NOT_REGISTERED,
"Unable to unregister client");
dbus_g_method_return_error (context, new_error);
g_error_free (new_error);
return FALSE;
}
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);