[rygel-grilo] Add Update signal support in server side
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel-grilo] Add Update signal support in server side
- Date: Thu, 13 May 2010 09:58:08 +0000 (UTC)
commit 7ed399d4a9b045e8540fbf34c968394eeb93d88c
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Wed May 12 20:59:23 2010 +0200
Add Update signal support in server side
lib/media-server1-introspection.h | 1 +
lib/media-server1-server.c | 52 +++++++++++++++++++++++-------------
lib/media-server1-server.h | 3 --
3 files changed, 34 insertions(+), 22 deletions(-)
---
diff --git a/lib/media-server1-introspection.h b/lib/media-server1-introspection.h
index 2d782fd..8b42167 100644
--- a/lib/media-server1-introspection.h
+++ b/lib/media-server1-introspection.h
@@ -82,6 +82,7 @@
" <arg name=\"filter\" direction=\"in\" type=\"as\"/>" \
" <arg name=\"objects\" direction=\"out\" type=\"a(a{sv})\"/>" \
" </method>" \
+ " <signal name=\"Updated\"/>" \
" </interface>"
#define INTROSPECTABLE_IFACE \
diff --git a/lib/media-server1-server.c b/lib/media-server1-server.c
index a3e01df..09ff600 100644
--- a/lib/media-server1-server.c
+++ b/lib/media-server1-server.c
@@ -40,11 +40,6 @@
#define MS1_SERVER_GET_PRIVATE(o) \
G_TYPE_INSTANCE_GET_PRIVATE((o), MS1_TYPE_SERVER, MS1ServerPrivate)
-enum {
- UPDATED,
- LAST_SIGNAL
-};
-
/*
* Private MS1Server structure
* name: provider name
@@ -118,8 +113,6 @@ static const gchar *mediacontainer1_properties[] = { MS1_PROP_ITEMS,
MS1_PROP_SEARCHABLE,
NULL };
-static guint32 signals[LAST_SIGNAL] = { 0 };
-
G_DEFINE_TYPE (MS1Server, ms1_server, G_TYPE_OBJECT);
/******************** PRIVATE API ********************/
@@ -1029,17 +1022,6 @@ ms1_server_class_init (MS1ServerClass *klass)
g_type_class_add_private (klass, sizeof (MS1ServerPrivate));
gobject_class->finalize = ms1_server_finalize;
-
- signals[UPDATED] = g_signal_new ("updated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE,
- G_STRUCT_OFFSET (MS1ServerClass, updated),
- NULL,
- NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE,
- 1,
- G_TYPE_STRING);
}
/* Object init function */
@@ -1153,9 +1135,41 @@ void
ms1_server_updated (MS1Server *server,
const gchar *id)
{
+ DBusError error;
+ DBusConnection *connection;
+ DBusMessage *message;
+ gchar *object_path;
+
g_return_if_fail (MS1_IS_SERVER (server));
- g_signal_emit (server, signals[UPDATED], 0, id);
+ dbus_error_init (&error);
+
+ connection = dbus_bus_get (DBUS_BUS_SESSION, &error);
+
+ if (!connection) {
+ g_printerr ("Could not connect to session bus, %s\n", error.message);
+ return;
+ }
+
+ /* Get object path */
+ if (g_strcmp0 (id, MS1_ROOT) == 0) {
+ object_path = g_strconcat (MS1_DBUS_PATH_PREFIX,
+ server->priv->name,
+ NULL);
+ } else {
+ object_path = g_strdup_printf (MS1_DBUS_PATH_PREFIX "%s/containers/%d",
+ server->priv->name,
+ g_quark_from_string (id));
+ }
+
+ message = dbus_message_new_signal (object_path,
+ "org.gnome.UPnP.MediaContainer1",
+ "Updated");
+
+ dbus_connection_send (connection, message, NULL);
+ dbus_message_unref (message);
+
+ g_free (object_path);
}
/**
diff --git a/lib/media-server1-server.h b/lib/media-server1-server.h
index a1e3daf..a44373a 100644
--- a/lib/media-server1-server.h
+++ b/lib/media-server1-server.h
@@ -70,9 +70,6 @@ typedef struct _MS1ServerClass MS1ServerClass;
struct _MS1ServerClass {
GObjectClass parent_class;
-
- void (*updated) (MS1Server *server,
- const gchar *id);
};
typedef GHashTable * (*GetPropertiesFunc) (MS1Server *server,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]