[gnome-keyring/dbus-api] [dbus] Put in stubs for all methods.
- From: Stefan Walter <stefw src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-keyring/dbus-api] [dbus] Put in stubs for all methods.
- Date: Sun, 23 Aug 2009 18:08:32 +0000 (UTC)
commit 8595b972135762671fc6838f28d52506f14f90a6
Author: Stef Walter <stef memberwebs com>
Date: Sun Aug 23 17:54:00 2009 +0000
[dbus] Put in stubs for all methods.
Put in stubs for all methods and treat properties methods just
like other methods.
daemon/dbus/gkd-secrets-objects.c | 48 ++++++++++++++----------------
daemon/dbus/gkd-secrets-service.c | 58 ++++++++++++++++++++++--------------
2 files changed, 58 insertions(+), 48 deletions(-)
---
diff --git a/daemon/dbus/gkd-secrets-objects.c b/daemon/dbus/gkd-secrets-objects.c
index c30b18e..b513952 100644
--- a/daemon/dbus/gkd-secrets-objects.c
+++ b/daemon/dbus/gkd-secrets-objects.c
@@ -554,8 +554,12 @@ item_property_getall (GP11Object *object, DBusMessage *message)
}
static DBusMessage*
-item_property_handler (GP11Object *object, DBusMessage *message)
+item_message_handler (GkdSecretsObjects *self, GP11Object *object, DBusMessage *message)
{
+ /* org.freedesktop.Secrets.Item.Delete() */
+ if (dbus_message_is_method_call (message, SECRETS_ITEM_INTERFACE, "Delete"))
+ g_return_val_if_reached (NULL);
+
/* org.freedesktop.DBus.Properties.Get */
if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Get"))
return item_property_get (object, message);
@@ -571,12 +575,6 @@ item_property_handler (GP11Object *object, DBusMessage *message)
return NULL;
}
-static DBusMessage*
-item_method_handler (GP11Object *object, DBusMessage *message)
-{
- g_return_val_if_reached (NULL); /* Not yet implemented */
-}
-
static const gchar*
collection_get_identifier (GP11Object *coll)
{
@@ -699,29 +697,35 @@ collection_property_getall (GkdSecretsObjects *self, GP11Object *object, DBusMes
}
static DBusMessage*
-collection_property_handler (GkdSecretsObjects *self, GP11Object *object, DBusMessage *message)
+collection_message_handler (GkdSecretsObjects *self, GP11Object *object, DBusMessage *message)
{
- /* org.freedesktop.DBus.Properties.Get */
+ /* org.freedesktop.Secrets.Collection.Delete() */
+ if (dbus_message_is_method_call (message, SECRETS_COLLECTION_INTERFACE, "Delete"))
+ g_return_val_if_reached (NULL);
+
+ /* org.freedesktop.Secrets.Collection.SearchItems() */
+ if (dbus_message_is_method_call (message, SECRETS_COLLECTION_INTERFACE, "SearchItems"))
+ g_return_val_if_reached (NULL);
+
+ /* org.freedesktop.Secrets.Collection.CreateItem() */
+ if (dbus_message_is_method_call (message, SECRETS_COLLECTION_INTERFACE, "CreateItem"))
+ g_return_val_if_reached (NULL);
+
+ /* org.freedesktop.DBus.Properties.Get() */
if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Get"))
return collection_property_get (self, object, message);
- /* org.freedesktop.DBus.Properties.Set */
+ /* org.freedesktop.DBus.Properties.Set() */
else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Set"))
return collection_property_set (self, object, message);
- /* org.freedesktop.DBus.Properties.GetAll */
+ /* org.freedesktop.DBus.Properties.GetAll() */
else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "GetAll"))
return collection_property_getall (self, object, message);
return NULL;
}
-static DBusMessage*
-collection_method_handler (GP11Object *object, DBusMessage *message)
-{
- return NULL; /* TODO: Need to implement */
-}
-
/* -----------------------------------------------------------------------------
* OBJECT
*/
@@ -874,10 +878,7 @@ gkd_secrets_objects_dispatch (GkdSecretsObjects *self, DBusMessage *message)
if (item_id) {
object = item_for_identifier (session, coll_id, item_id);
if (object != NULL) {
- if (dbus_message_has_interface (message, PROPERTIES_INTERFACE))
- reply = item_property_handler (object, message);
- else
- reply = item_method_handler (object, message);
+ reply = item_message_handler (self, object, message);
g_object_unref (object);
}
@@ -885,10 +886,7 @@ gkd_secrets_objects_dispatch (GkdSecretsObjects *self, DBusMessage *message)
} else {
object = collection_for_identifier (session, coll_id);
if (object != NULL) {
- if (dbus_message_has_interface (message, PROPERTIES_INTERFACE))
- reply = collection_property_handler (self, object, message);
- else
- reply = collection_method_handler (object, message);
+ reply = collection_message_handler (self, object, message);
g_object_unref (object);
}
}
diff --git a/daemon/dbus/gkd-secrets-service.c b/daemon/dbus/gkd-secrets-service.c
index 411f36f..75f91da 100644
--- a/daemon/dbus/gkd-secrets-service.c
+++ b/daemon/dbus/gkd-secrets-service.c
@@ -325,24 +325,6 @@ service_property_getall (GkdSecretsService *self, DBusMessage *message)
}
static DBusMessage*
-service_property_handler (GkdSecretsService *self, DBusMessage *message)
-{
- /* org.freedesktop.DBus.Properties.Get */
- if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Get"))
- return service_property_get (self, message);
-
- /* org.freedesktop.DBus.Properties.Set */
- else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Set"))
- return service_property_set (self, message);
-
- /* org.freedesktop.DBus.Properties.GetAll */
- else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "GetAll"))
- return service_property_getall (self, message);
-
- return NULL;
-}
-
-static DBusMessage*
service_method_open_session (GkdSecretsService *self, DBusMessage *message)
{
GkdSecretsSession *session;
@@ -375,16 +357,49 @@ service_method_open_session (GkdSecretsService *self, DBusMessage *message)
}
static DBusMessage*
-service_method_handler (GkdSecretsService *self, DBusMessage *message)
+service_message_handler (GkdSecretsService *self, DBusMessage *message)
{
DBusMessage *reply = NULL;
g_return_val_if_fail (message, NULL);
g_return_val_if_fail (GKD_SECRETS_IS_SERVICE (self), NULL);
+ /* org.freedesktop.Secrets.Service.OpenSession() */
if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "OpenSession"))
reply = service_method_open_session (self, message);
+ /* org.freedesktop.Secrets.Service.CreateCollection() */
+ if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "CreateCollection"))
+ g_return_val_if_reached (NULL); /* TODO: Need to implement */
+
+ /* org.freedesktop.Secrets.Service.LockService() */
+ if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "LockService"))
+ g_return_val_if_reached (NULL); /* TODO: Need to implement */
+
+ /* org.freedesktop.Secrets.Service.SearchItems() */
+ if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "SearchItems"))
+ g_return_val_if_reached (NULL); /* TODO: Need to implement */
+
+ /* org.freedesktop.Secrets.Service.BeginAuthenticate() */
+ if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "BeginAuthenticate"))
+ g_return_val_if_reached (NULL); /* TODO: Need to implement */
+
+ /* org.freedesktop.Secrets.Service.CompleteAuthenticate() */
+ if (dbus_message_is_method_call (message, SECRETS_SERVICE_INTERFACE, "CompleteAuthenticate"))
+ g_return_val_if_reached (NULL); /* TODO: Need to implement */
+
+ /* org.freedesktop.DBus.Properties.Get() */
+ if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Get"))
+ return service_property_get (self, message);
+
+ /* org.freedesktop.DBus.Properties.Set() */
+ else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "Set"))
+ return service_property_set (self, message);
+
+ /* org.freedesktop.DBus.Properties.GetAll() */
+ else if (dbus_message_is_method_call (message, PROPERTIES_INTERFACE, "GetAll"))
+ return service_property_getall (self, message);
+
return reply;
}
@@ -435,10 +450,7 @@ service_dispatch_message (GkdSecretsService *self, DBusMessage *message)
} else if (g_str_equal (path, SECRETS_SERVICE_PATH)) {
/* Check if it's properties, and hand off to property handler. */
- if (dbus_message_has_interface (message, PROPERTIES_INTERFACE))
- reply = service_property_handler (self, message);
- else
- reply = service_method_handler (self, message);
+ reply = service_message_handler (self, message);
}
/* Should we send an error? */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]