summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Staudinger <robsta@linux.intel.com>2012-02-09 21:16:34 +0100
committerRob Staudinger <robsta@linux.intel.com>2012-02-09 21:18:50 +0100
commiteba94b275fa28deb39325572d818dbab67feac9b (patch)
treec3092f230588a8f5f52979b7c9806a62c4f1d197
parent14299d5de97c6aa5f616a48c626a2314f8ddb536 (diff)
Client: remove deprecated virtual methods
Since YtsClient can not be subclassed there is no point in virtual methods for signals. Remove them and fold back what's done in the handlers, which simplifies the code. Also update docs. Tags: api, cleanup
-rw-r--r--docs/reference/ytstenut/Makefile.am4
-rw-r--r--docs/reference/ytstenut/ytstenut-docs.xml.in4
-rw-r--r--examples/echo.c20
-rw-r--r--examples/file-transfer.c4
-rw-r--r--ytstenut/yts-capability.c3
-rw-r--r--ytstenut/yts-client.c106
-rw-r--r--ytstenut/yts-client.h32
-rw-r--r--ytstenut/yts-contact.c3
-rw-r--r--ytstenut/yts-contact.h2
-rw-r--r--ytstenut/yts-file-transfer.c3
-rw-r--r--ytstenut/yts-incoming-file.c1
-rw-r--r--ytstenut/yts-outgoing-file.c1
-rw-r--r--ytstenut/yts-proxy-service.c3
-rw-r--r--ytstenut/yts-proxy.c1
-rw-r--r--ytstenut/yts-roster.c3
-rw-r--r--ytstenut/yts-roster.h2
-rw-r--r--ytstenut/yts-service.c5
-rw-r--r--ytstenut/yts-version.h.in1
18 files changed, 55 insertions, 143 deletions
diff --git a/docs/reference/ytstenut/Makefile.am b/docs/reference/ytstenut/Makefile.am
index 4c8e8f7..e97e726 100644
--- a/docs/reference/ytstenut/Makefile.am
+++ b/docs/reference/ytstenut/Makefile.am
@@ -53,6 +53,7 @@ EXTRA_HFILES=
# e.g. IGNORE_HFILES=gtkdebug.h gtkintl.h
IGNORE_HFILES = \
empathy-tp-file.h \
+ ytstenut-internal.h \
yts-adapter-factory.h \
yts-client-internal.h \
yts-client-status.h \
@@ -64,6 +65,7 @@ IGNORE_HFILES = \
yts-factory.h \
yts-incoming-file-internal.h \
yts-invocation-message.h \
+ yts-marshal.h \
yts-message.h \
yts-metadata.h \
yts-metadata-internal.h \
@@ -84,6 +86,8 @@ IGNORE_HFILES = \
yts-service-factory.h \
yts-service-impl.h \
yts-service-internal.h \
+ yts-xml.h \
+ \
yts-vp-playable-proxy.h \
yts-vp-player-adapter.h \
yts-vp-player-proxy.h \
diff --git a/docs/reference/ytstenut/ytstenut-docs.xml.in b/docs/reference/ytstenut/ytstenut-docs.xml.in
index 12345c9..29d3a68 100644
--- a/docs/reference/ytstenut/ytstenut-docs.xml.in
+++ b/docs/reference/ytstenut/ytstenut-docs.xml.in
@@ -47,16 +47,12 @@
<xi:include href="xml/yts-capability.xml"/>
<xi:include href="xml/yts-client.xml"/>
<xi:include href="xml/yts-contact.xml"/>
- <xi:include href="xml/yts-error.xml"/>
<xi:include href="xml/yts-file-transfer.xml"/>
<xi:include href="xml/yts-incoming-file.xml"/>
- <xi:include href="xml/yts-metadata-service.xml"/>
- <xi:include href="xml/yts-metadata.xml"/>
<xi:include href="xml/yts-outgoing-file.xml"/>
<xi:include href="xml/yts-proxy-service.xml"/>
<xi:include href="xml/yts-proxy.xml"/>
<xi:include href="xml/yts-roster.xml"/>
- <xi:include href="xml/yts-service-adapter.xml"/>
<xi:include href="xml/yts-service.xml"/>
<xi:include href="xml/yts-version.xml"/>
<xi:include href="xml/yts-vp-content.xml"/>
diff --git a/examples/echo.c b/examples/echo.c
index e5530b4..55dd3bf 100644
--- a/examples/echo.c
+++ b/examples/echo.c
@@ -69,16 +69,22 @@ _client_roster_service_added (YtsRoster *roster,
YtsService *service,
void *data)
{
- char const *uid;
+ /* Only execute once, when testing on the same machine we get all the
+ * accounts because of TP's behind the scenes magic. */
+ static bool _is_sent = false;
- uid = yts_service_get_id (service);
+ char const *service_id;
- if (0 == g_strcmp0 (uid, SERVER_UID)) {
+ service_id = yts_service_get_id (service);
+
+ if (false == _is_sent &&
+ 0 == g_strcmp0 (service_id, SERVER_UID)) {
char const text[] = "Hello World";
g_debug ("Sending message \"%s\"", text);
yts_service_send_text (service, text);
+ _is_sent = true;
}
}
@@ -164,15 +170,15 @@ _server_roster_service_added (YtsRoster *roster,
YtsService *service,
ServerData *self)
{
- char const *uid;
+ char const *service_id;
- uid = yts_service_get_id (service);
+ service_id = yts_service_get_id (service);
- g_debug ("%s() %s", __FUNCTION__, uid);
+ g_debug ("%s() %s", __FUNCTION__, service_id);
/* FIXME, possible race condition when client sends message before
* it shows up in our roster? */
- if (0 == g_strcmp0 (uid, CLIENT_UID)) {
+ if (0 == g_strcmp0 (service_id, CLIENT_UID)) {
/* Should probably take a weak ref here. */
self->service = service;
}
diff --git a/examples/file-transfer.c b/examples/file-transfer.c
index 76c777c..da95e28 100644
--- a/examples/file-transfer.c
+++ b/examples/file-transfer.c
@@ -106,12 +106,14 @@ _client_roster_service_added (YtsRoster *roster,
YtsService *service,
char const *path)
{
+ /* Only execute once, when testing on the same machine we get all the
+ * accounts because of TP's behind the scenes magic. */
static bool _is_sent = false;
char const *service_id;
service_id = yts_service_get_id (service);
- if (!_is_sent &&
+ if (false == _is_sent &&
0 == g_strcmp0 (service_id, SERVER_UID)) {
GError *error = NULL;
diff --git a/ytstenut/yts-capability.c b/ytstenut/yts-capability.c
index 17b25ab..529ec83 100644
--- a/ytstenut/yts-capability.c
+++ b/ytstenut/yts-capability.c
@@ -25,7 +25,6 @@ G_DEFINE_INTERFACE (YtsCapability, yts_capability, G_TYPE_OBJECT)
/**
* SECTION: yts-capability
- * @title: YtsCapability
* @short_description: Common interface for service implementations and their
* proxies.
*
@@ -82,7 +81,7 @@ yts_capability_get_fqc_ids (YtsCapability *self)
*
* Query @self whether it supports the capability identified by @fqc_id.
*
- * Returns: %true if @fqc_id is supported by @self.
+ * Returns: <literal>true</literal> if @fqc_id is supported by @self.
*
* Since: 0.3
*/
diff --git a/ytstenut/yts-client.c b/ytstenut/yts-client.c
index 502f124..76c07d4 100644
--- a/ytstenut/yts-client.c
+++ b/ytstenut/yts-client.c
@@ -73,7 +73,6 @@ G_DEFINE_TYPE (YtsClient, yts_client, G_TYPE_OBJECT)
/**
* SECTION: yts-client
- * @title: YtsClient
* @short_description: Represents a connection to the Ytstenut mesh.
*
* #YtsClient is an object that mediates connection between the current
@@ -469,16 +468,6 @@ proxy_list_destroy (ProxyList *self)
*/
static void
-yts_client_authenticated (YtsClient *self)
-{
- YtsClientPrivate *priv = GET_PRIVATE (self);
-
- priv->authenticated = true;
-
- g_message ("Authenticated");
-}
-
-static void
_tp_yts_status_advertise_status_cb (GObject *source_object,
GAsyncResult *result,
gpointer user_data)
@@ -515,23 +504,6 @@ _client_status_foreach_capability_advertise_status (YtsClientStatus const *clien
}
static void
-yts_client_ready (YtsClient *self)
-{
- YtsClientPrivate *priv = GET_PRIVATE (self);
-
- g_return_if_fail (priv->tp_status);
-
- priv->ready = TRUE;
-
- g_message ("YtsClient is ready");
-
- yts_client_status_foreach_capability (
- priv->client_status,
- (YtsClientStatusCapabilityIterator) _client_status_foreach_capability_advertise_status,
- self);
-}
-
-static void
yts_client_cleanup_connection_resources (YtsClient *self)
{
YtsClientPrivate *priv = GET_PRIVATE (self);
@@ -584,23 +556,6 @@ yts_client_reconnect_after (YtsClient *self, guint after_seconds)
self);
}
-static void
-yts_client_disconnected (YtsClient *self)
-{
- YtsClientPrivate *priv = GET_PRIVATE (self);
-
- yts_client_cleanup_connection_resources (self);
-
- if (priv->reconnect)
- yts_client_reconnect_after (self, RECONNECT_DELAY);
-}
-
-static void
-yts_client_raw_message (YtsClient *self,
- char const *xml_payload)
-{
-}
-
/*
* Callback for #TpProxy::interface-added: we need to add the signals we
* care for here.
@@ -1409,11 +1364,6 @@ yts_client_class_init (YtsClientClass *klass)
object_class->get_property = yts_client_get_property;
object_class->set_property = yts_client_set_property;
- klass->authenticated = yts_client_authenticated;
- klass->ready = yts_client_ready;
- klass->disconnected = yts_client_disconnected;
- klass->raw_message = yts_client_raw_message;
-
/**
* YtsClient:account-id:
*
@@ -1495,8 +1445,7 @@ yts_client_class_init (YtsClientClass *klass)
g_signal_new ("authenticated",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (YtsClientClass, authenticated),
- NULL, NULL,
+ 0, NULL, NULL,
yts_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -1513,8 +1462,7 @@ yts_client_class_init (YtsClientClass *klass)
g_signal_new ("ready",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (YtsClientClass, ready),
- NULL, NULL,
+ 0, NULL, NULL,
yts_marshal_VOID__VOID,
G_TYPE_NONE, 0);
@@ -1531,15 +1479,14 @@ yts_client_class_init (YtsClientClass *klass)
g_signal_new ("disconnected",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (YtsClientClass, disconnected),
- NULL, NULL,
+ 0, NULL, NULL,
yts_marshal_VOID__VOID,
G_TYPE_NONE, 0);
/**
* YtsClient::raw-message:
* @self: object which emitted the signal.
- * @message: #YtsMessage, the message
+ * @message: the message text.
*
* The message signal is emitted when message is received from one of the
* contacts.
@@ -1550,8 +1497,7 @@ yts_client_class_init (YtsClientClass *klass)
g_signal_new ("raw-message",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (YtsClientClass, raw_message),
- NULL, NULL,
+ 0, NULL, NULL,
yts_marshal_VOID__STRING,
G_TYPE_NONE, 1,
G_TYPE_STRING);
@@ -1614,12 +1560,9 @@ yts_client_class_init (YtsClientClass *klass)
/**
* YtsClient::error:
* @self: object which emitted the signal.
- * @error: #YtsError
+ * @error: error code
*
* The error signal is emitted to indicate an error (or eventual success)
- * during the handling of an operation for which the Ytstenut API initially
- * returned %YTS_ERROR_PENDING. The original operation can be determined
- * using the atom part of the #YtsError parameter.
*
* Since: 0.1
*/
@@ -1964,6 +1907,7 @@ yts_client_yts_channels_received_cb (TpYtsClient *tp_client,
from,
xml_payload);
+ // FIXME this should probably be emitted anyway, for consistency.
if (!dispatched)
{
g_signal_emit (client, signals[RAW_MESSAGE], 0, xml_payload);
@@ -2071,9 +2015,18 @@ yts_client_status_cb (TpConnection *proxy,
status[arg_Status], reason[arg_Reason]);
if (arg_Status == TP_CONNECTION_STATUS_CONNECTED)
- g_signal_emit (self, signals[AUTHENTICATED], 0);
+ {
+ g_signal_emit (self, signals[AUTHENTICATED], 0);
+ }
else if (arg_Status == TP_CONNECTION_STATUS_DISCONNECTED)
- g_signal_emit (self, signals[DISCONNECTED], 0);
+ {
+ yts_client_cleanup_connection_resources (self);
+
+ if (priv->reconnect)
+ yts_client_reconnect_after (self, RECONNECT_DELAY);
+
+ g_signal_emit (self, signals[DISCONNECTED], 0);
+ }
}
static gboolean
@@ -2252,19 +2205,6 @@ yts_client_process_status (YtsClient *self)
g_message ("No discovered services");
}
-/* FIXME is this really needed or can we just advertise the new
- * per-capability status on any change? */
-static void
-yts_client_dispatch_status (YtsClient *self)
-{
- YtsClientPrivate *priv = GET_PRIVATE (self);
-
- yts_client_status_foreach_capability (
- priv->client_status,
- (YtsClientStatusCapabilityIterator) _client_status_foreach_capability_advertise_status,
- self);
-}
-
static void
_tp_yts_status_changed (TpYtsStatus *tp_status,
char const *contact_id,
@@ -2311,8 +2251,12 @@ yts_client_yts_status_cb (GObject *obj,
G_CALLBACK (_tp_yts_status_changed),
self, 0);
+ /* Advertise statii that have been set before our TpStatus was ready. */
+ yts_client_status_foreach_capability (
+ priv->client_status,
+ (YtsClientStatusCapabilityIterator) _client_status_foreach_capability_advertise_status,
+ self);
- yts_client_dispatch_status (self);
yts_client_process_status (self);
if (!priv->ready)
@@ -3207,7 +3151,7 @@ _service_destroyed (ServiceData *data,
*
* Publish a service to the Ytstenut network.
*
- * Returns: %true if publishing succeeded.
+ * Returns: <literal>true</literal> if publishing succeeded.
*
* Since 0.3
*/
@@ -3401,7 +3345,7 @@ yts_client_unregister_proxy (YtsClient *self,
*
* Iterate over @self's published services.
*
- * Returns: %true if all the services have been iterated.
+ * Returns: <literal>true</literal> if all the services have been iterated.
*
* Since: 0.3
*/
diff --git a/ytstenut/yts-client.h b/ytstenut/yts-client.h
index 2d64e3b..554172f 100644
--- a/ytstenut/yts-client.h
+++ b/ytstenut/yts-client.h
@@ -47,43 +47,13 @@ G_BEGIN_DECLS
(G_TYPE_INSTANCE_GET_CLASS ((obj), YTS_TYPE_CLIENT, YtsClientClass))
typedef struct {
-
/*< private >*/
GObject parent;
-
} YtsClient;
-/**
- * YtsClientClass:
- * @authenticated: virtual function for the #YtsClient::authenticated signal.
- * @disconnected: virtual function for the #YtsClient::disconnected signal.
- * @raw_message: virtual function for the #YtsClient::raw-message signal.
- * @ready: virtual function for the #YtsClient::ready signal.
- *
- * Deprecated: the class handlers for signals are deprecated and will be
- * removed in 0.4.
- * Since: 0.1
- */
typedef struct {
-
/*< private >*/
GObjectClass parent;
-
- /*< public >*/
-
- void
- (*authenticated) (YtsClient *self);
-
- void
- (*disconnected) (YtsClient *self);
-
- void
- (*raw_message) (YtsClient *self,
- char const *xml_payload);
-
- void
- (*ready) (YtsClient *self);
-
} YtsClientClass;
GType
@@ -161,7 +131,7 @@ yts_client_publish_service (YtsClient *self,
*
* Callback signature for iterating a an #YtsClient's published services.
*
- * Returns: %false to abort the iteration.
+ * Returns: <literal>false</literal> to abort the iteration.
*
* Since: 0.3
*/
diff --git a/ytstenut/yts-contact.c b/ytstenut/yts-contact.c
index 5822705..f65a84a 100644
--- a/ytstenut/yts-contact.c
+++ b/ytstenut/yts-contact.c
@@ -47,7 +47,6 @@ G_DEFINE_ABSTRACT_TYPE (YtsContact, yts_contact, G_TYPE_OBJECT)
/**
* SECTION: yts-contact
- * @title: YtsContact
* @short_description: Represents a device connected to the
* Ytstenut mesh.
*
@@ -531,7 +530,7 @@ yts_contact_update_service_status (YtsContact *self,
*
* Iterate over @self's services.
*
- * Returns: %true if all the services have been iterated.
+ * Returns: <literal>true</literal> if all the services have been iterated.
*
* Since: 0.4
*/
diff --git a/ytstenut/yts-contact.h b/ytstenut/yts-contact.h
index 4d4dee3..833d22b 100644
--- a/ytstenut/yts-contact.h
+++ b/ytstenut/yts-contact.h
@@ -57,7 +57,7 @@ yts_contact_get_name (YtsContact const *self);
*
* Callback signature for iterating a an #YtsContact's services.
*
- * Returns: %false to abort the iteration.
+ * Returns: <literal>false</literal> to abort the iteration.
*
* Since: 0.4
*/
diff --git a/ytstenut/yts-file-transfer.c b/ytstenut/yts-file-transfer.c
index e6772e8..9c105c1 100644
--- a/ytstenut/yts-file-transfer.c
+++ b/ytstenut/yts-file-transfer.c
@@ -33,7 +33,6 @@ G_DEFINE_INTERFACE (YtsFileTransfer, yts_file_transfer, G_TYPE_OBJECT)
/**
* SECTION: yts-file-transfer
- * @title: YtsFileTransfer
* @short_description: Common interface for file transfers between Ytstenut
* services.
*
@@ -155,7 +154,7 @@ yts_file_transfer_get_file (YtsFileTransfer *self)
* yts_file_transfer_get_progress:
* @self: object on which to invoke this method.
*
- * Get progress of file transfer operation, see #YtsFileTransfer.progress for
+ * Get progress of file transfer operation, see #YtsFileTransfer:progress for
* details about the range of values.
*
* Returns: file transfer progress.
diff --git a/ytstenut/yts-incoming-file.c b/ytstenut/yts-incoming-file.c
index fdd4c32..e4679a3 100644
--- a/ytstenut/yts-incoming-file.c
+++ b/ytstenut/yts-incoming-file.c
@@ -44,7 +44,6 @@ G_DEFINE_TYPE_WITH_CODE (YtsIncomingFile,
/**
* SECTION: yts-incoming-file
- * @title: YtsIncomingFile
* @short_description: File download implementation.
*
* #YtsIncomingFile represents an incoming file downlod operation from another
diff --git a/ytstenut/yts-outgoing-file.c b/ytstenut/yts-outgoing-file.c
index 67a3d38..034517d 100644
--- a/ytstenut/yts-outgoing-file.c
+++ b/ytstenut/yts-outgoing-file.c
@@ -44,7 +44,6 @@ G_DEFINE_TYPE_WITH_CODE (YtsOutgoingFile,
/**
* SECTION: yts-outgoing-file
- * @title: YtsOutgoingFile
* @short_description: File upload implementation.
*
* #YtsOutgoingFile represents an ongoing file upload operation to another
diff --git a/ytstenut/yts-proxy-service.c b/ytstenut/yts-proxy-service.c
index 17275d4..44a9a1f 100644
--- a/ytstenut/yts-proxy-service.c
+++ b/ytstenut/yts-proxy-service.c
@@ -43,7 +43,6 @@ G_DEFINE_ABSTRACT_TYPE (YtsProxyService, yts_proxy_service, YTS_TYPE_SERVICE)
/**
* SECTION: yts-proxy-service
- * @title: YtsProxyService
* @short_description: Represents a remote service with method invocation support.
*/
@@ -256,7 +255,7 @@ _proxy_destroyed (YtsProxyService *self,
*
* Create a proxy for a remote object of service @self, specified by @capability.
*
- * Returns: %true if the YtsProxyService::proxy-created can be expected to
+ * Returns: <literal>true</literal> if the YtsProxyService::proxy-created can be expected to
* deliver.
*
* Since: 0.3
diff --git a/ytstenut/yts-proxy.c b/ytstenut/yts-proxy.c
index 1582834..f2ce7c1 100644
--- a/ytstenut/yts-proxy.c
+++ b/ytstenut/yts-proxy.c
@@ -39,7 +39,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (YtsProxy,
/**
* SECTION: yts-proxy
- * @title: YtsProxy
* @short_description: Represents a remote object, part of a remote service.
*
* A YtsProxy is a local representation of a remote object.
diff --git a/ytstenut/yts-roster.c b/ytstenut/yts-roster.c
index a51ecc5..a7ebea5 100644
--- a/ytstenut/yts-roster.c
+++ b/ytstenut/yts-roster.c
@@ -42,7 +42,6 @@ G_DEFINE_ABSTRACT_TYPE (YtsRoster, yts_roster, G_TYPE_OBJECT)
/**
* SECTION: yts-roster
- * @title: YtsRoster
* @short_description: Represents a roster of devices and services
* connected to the Ytstenut application mesh.
*
@@ -518,7 +517,7 @@ yts_roster_update_contact_status (YtsRoster *self,
*
* Iterate over @self's contacts.
*
- * Returns: %true if all the contacts have been iterated.
+ * Returns: <literal>true</literal> if all the contacts have been iterated.
*
* Since: 0.4
*/
diff --git a/ytstenut/yts-roster.h b/ytstenut/yts-roster.h
index 9ff0d5f..87e7b59 100644
--- a/ytstenut/yts-roster.h
+++ b/ytstenut/yts-roster.h
@@ -53,7 +53,7 @@ yts_roster_find_contact_by_id (YtsRoster const *self,
*
* Callback signature for iterating a an #YtsRoster's published services.
*
- * Returns: %false to abort the iteration.
+ * Returns: <literal>false</literal> to abort the iteration.
*
* Since: 0.4
*/
diff --git a/ytstenut/yts-service.c b/ytstenut/yts-service.c
index 4e3da28..36d3b84 100644
--- a/ytstenut/yts-service.c
+++ b/ytstenut/yts-service.c
@@ -39,7 +39,6 @@ G_DEFINE_ABSTRACT_TYPE_WITH_CODE (
/**
* SECTION: yts-service
- * @title: YtsService
* @short_description: Represents a service connected to the Ytstenut
* application mesh.
*
@@ -252,8 +251,8 @@ yts_service_class_init (YtsServiceClass *klass)
* YtsService:names:
*
* The names of this service, as they should be shown in a user interface.
- * Keys of the hash-table are locale names like %en_GB, pointing to the
- * respective localised name.
+ * Keys of the hash-table are locale names like <literal>en_GB</literal>,
+ * pointing to the respective localised name.
*/
pspec = g_param_spec_boxed ("names", "", "",
G_TYPE_HASH_TABLE,
diff --git a/ytstenut/yts-version.h.in b/ytstenut/yts-version.h.in
index 1465858..b221020 100644
--- a/ytstenut/yts-version.h.in
+++ b/ytstenut/yts-version.h.in
@@ -27,7 +27,6 @@ G_BEGIN_DECLS
/**
* SECTION: yts-version
- * @title: Version macros
* @short_description: Ytstenut version macros.
*/