static DBusMessage* service_method_change_lock (GkdSecretService *self, DBusMessage *message) { GkdSecretChange *change; DBusMessage *reply; const char *caller; const gchar *path; GckObject *collection; caller = dbus_message_get_sender (message); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) return NULL; /* Make sure it exists */ collection = gkd_secret_objects_lookup_collection (self->objects, caller, path); if (!collection) return dbus_message_new_error (message, SECRET_ERROR_NO_SUCH_OBJECT, "The collection does not exist"); g_object_unref (collection); change = gkd_secret_change_new (self, caller, path); path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (change)); gkd_secret_service_publish_dispatch (self, caller, GKD_SECRET_DISPATCH (change)); reply = dbus_message_new_method_return (message); dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); g_object_unref (change); return reply; }
static gboolean method_change_lock_internal (GkdSecretService *self, GDBusMethodInvocation *invocation, const gchar *collection_path) { GkdSecretChange *change; const char *caller; const gchar *path; GckObject *collection; caller = g_dbus_method_invocation_get_sender (invocation); /* Make sure it exists */ collection = gkd_secret_objects_lookup_collection (self->objects, caller, collection_path); if (!collection) { g_dbus_method_invocation_return_error_literal (invocation, GKD_SECRET_ERROR, GKD_SECRET_ERROR_NO_SUCH_OBJECT, "The collection does not exist"); return TRUE; } g_object_unref (collection); change = gkd_secret_change_new (self, caller, collection_path); path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (change)); gkd_secret_service_publish_dispatch (self, caller, GKD_SECRET_DISPATCH (change)); g_dbus_method_invocation_return_value (invocation, g_variant_new ("(o)", path)); g_object_unref (change); return TRUE; }
static DBusMessage* service_method_change_lock (GkdSecretService *self, DBusMessage *message) { GkdSecretChange *change; ServiceClient *client; DBusMessage *reply; const char *caller; const gchar *path; GP11Object *collection; caller = dbus_message_get_sender (message); if (!dbus_message_get_args (message, NULL, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) return NULL; /* Make sure it exists */ collection = gkd_secret_objects_lookup_collection (self->objects, caller, path); if (!collection) return dbus_message_new_error (message, SECRET_ERROR_NO_SUCH_OBJECT, "The collection does not exist"); g_object_unref (collection); change = gkd_secret_change_new (self, caller, path); client = g_hash_table_lookup (self->clients, caller); g_return_val_if_fail (client, NULL); path = gkd_secret_dispatch_get_object_path (GKD_SECRET_DISPATCH (change)); g_hash_table_replace (client->prompts, (gpointer)path, g_object_ref (change)); reply = dbus_message_new_method_return (message); dbus_message_append_args (reply, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID); g_object_unref (change); return reply; }