summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-07-04 12:40:01 +0200
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-07-04 17:25:15 +0200
commit2b3713458ef41d382054f2105162c1f10da51707 (patch)
treed3c463b7bfab54ec3f4b00942d5ffe249a63487b
parentc44986c2179c142350f317eb212e22f415ee88bd (diff)
downloadtelepathy-logger-2b3713458ef41d382054f2105162c1f10da51707.tar.gz
Stop using TplChannel interface
That interface is used only to prepare TplTextChannel and TplCallChannel, but they now have a CORE feature doing that job, so they can be prepared like any other proxy.
-rw-r--r--telepathy-logger/call-channel-internal.h2
-rw-r--r--telepathy-logger/call-channel.c78
-rw-r--r--telepathy-logger/log-store-sqlite.c2
-rw-r--r--telepathy-logger/observer-internal.h4
-rw-r--r--telepathy-logger/observer.c9
-rw-r--r--telepathy-logger/text-channel-internal.h2
-rw-r--r--telepathy-logger/text-channel.c77
7 files changed, 16 insertions, 158 deletions
diff --git a/telepathy-logger/call-channel-internal.h b/telepathy-logger/call-channel-internal.h
index 9ec0d5f..a9e8a8c 100644
--- a/telepathy-logger/call-channel-internal.h
+++ b/telepathy-logger/call-channel-internal.h
@@ -24,8 +24,6 @@
#include <glib-object.h>
#include <telepathy-glib/telepathy-glib.h>
-#include <telepathy-logger/channel-internal.h>
-
G_BEGIN_DECLS
#define TPL_TYPE_CALL_CHANNEL (_tpl_call_channel_get_type ())
#define TPL_CALL_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TPL_TYPE_CALL_CHANNEL, TplCallChannel))
diff --git a/telepathy-logger/call-channel.c b/telepathy-logger/call-channel.c
index 711422f..0413b35 100644
--- a/telepathy-logger/call-channel.c
+++ b/telepathy-logger/call-channel.c
@@ -27,7 +27,6 @@
#include "call-event.h"
#include "call-event-internal.h"
-#include "channel-internal.h"
#include "entity-internal.h"
#include "event-internal.h"
#include "log-manager-internal.h"
@@ -52,11 +51,7 @@ struct _TplCallChannelPriv
gchar *detailed_end_reason;
};
-static void tpl_call_channel_iface_init (TplChannelInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (TplCallChannel, _tpl_call_channel,
- TP_TYPE_CALL_CHANNEL,
- G_IMPLEMENT_INTERFACE (TPL_TYPE_CHANNEL, tpl_call_channel_iface_init))
+G_DEFINE_TYPE (TplCallChannel, _tpl_call_channel, TP_TYPE_CALL_CHANNEL)
static gboolean
@@ -274,18 +269,18 @@ channel_invalidated_cb (TpProxy *proxy,
gchar *message,
gpointer user_data)
{
- TplChannel *tpl_chan = TPL_CHANNEL (user_data);
+ TpChannel *chan = TP_CHANNEL (user_data);
TplObserver *observer = _tpl_observer_dup (NULL);
g_return_if_fail (observer);
- PATH_DEBUG (tpl_chan, "%s #%d %s",
+ PATH_DEBUG (chan, "%s #%d %s",
g_quark_to_string (domain), code, message);
store_call (TPL_CALL_CHANNEL (user_data));
- if (!_tpl_observer_unregister_channel (observer, tpl_chan))
- PATH_DEBUG (tpl_chan, "Channel couldn't be unregistered correctly (BUG?)");
+ if (!_tpl_observer_unregister_channel (observer, chan))
+ PATH_DEBUG (chan, "Channel couldn't be unregistered correctly (BUG?)");
g_object_unref (observer);
}
@@ -306,61 +301,6 @@ connect_signals (TplCallChannel *self)
static void
-proxy_prepared_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- GSimpleAsyncResult *my_result = user_data;
- GError *error = NULL;
-
- if (!tp_proxy_prepare_finish (source, result, &error))
- {
- g_simple_async_result_take_error (my_result, error);
- }
-
- g_simple_async_result_complete (my_result);
- g_object_unref (my_result);
-}
-
-
-static void
-tpl_call_channel_prepare_async (TplChannel *chan,
- GAsyncReadyCallback cb,
- gpointer user_data)
-{
- TplCallChannel *self = (TplCallChannel *) chan;
- GSimpleAsyncResult *result;
- GQuark chan_features[] = {
- TPL_CALL_CHANNEL_FEATURE_CORE,
- 0
- };
-
- result = g_simple_async_result_new ((GObject *) self, cb, user_data,
- tpl_call_channel_prepare_async);
-
- tp_proxy_prepare_async (self, chan_features, proxy_prepared_cb, result);
-}
-
-
-static gboolean
-tpl_call_channel_prepare_finish (TplChannel *chan,
- GAsyncResult *result,
- GError **error)
-{
- g_return_val_if_fail (
- g_simple_async_result_is_valid (result,
- G_OBJECT (chan), tpl_call_channel_prepare_async),
- FALSE);
-
- if (g_simple_async_result_propagate_error (
- G_SIMPLE_ASYNC_RESULT (result), error))
- return FALSE;
-
- return TRUE;
-}
-
-
-static void
_tpl_call_channel_prepare_core_async (TpProxy *proxy,
const TpProxyFeature *feature,
GAsyncReadyCallback callback,
@@ -464,14 +404,6 @@ _tpl_call_channel_class_init (TplCallChannelClass *klass)
static void
-tpl_call_channel_iface_init (TplChannelInterface *iface)
-{
- iface->prepare_async = tpl_call_channel_prepare_async;
- iface->prepare_finish = tpl_call_channel_prepare_finish;
-}
-
-
-static void
_tpl_call_channel_init (TplCallChannel *self)
{
gchar *date;
diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c
index f288d4f..1c0f11f 100644
--- a/telepathy-logger/log-store-sqlite.c
+++ b/telepathy-logger/log-store-sqlite.c
@@ -683,7 +683,7 @@ _tpl_log_store_sqlite_get_pending_messages (TplLogStore *self,
int e;
g_return_val_if_fail (TPL_IS_LOG_STORE_SQLITE (self), NULL);
- g_return_val_if_fail (TPL_IS_CHANNEL (channel), NULL);
+ g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
DEBUG ("Listing pending messages for channel %s",
diff --git a/telepathy-logger/observer-internal.h b/telepathy-logger/observer-internal.h
index 670ebb3..5be5526 100644
--- a/telepathy-logger/observer-internal.h
+++ b/telepathy-logger/observer-internal.h
@@ -25,8 +25,6 @@
#include <telepathy-glib/telepathy-glib.h>
-#include <telepathy-logger/channel-internal.h>
-
#define TPL_OBSERVER_WELL_KNOWN_BUS_NAME \
"org.freedesktop.Telepathy.Client.Logger"
#define TPL_OBSERVER_OBJECT_PATH \
@@ -61,7 +59,7 @@ GType _tpl_observer_get_type (void);
TplObserver * _tpl_observer_dup (GError **error);
gboolean _tpl_observer_unregister_channel (TplObserver *self,
- TplChannel *channel);
+ TpChannel *channel);
G_END_DECLS
diff --git a/telepathy-logger/observer.c b/telepathy-logger/observer.c
index 1798928..9c3bd9c 100644
--- a/telepathy-logger/observer.c
+++ b/telepathy-logger/observer.c
@@ -25,7 +25,6 @@
#include <telepathy-glib/telepathy-glib.h>
#include <telepathy-glib/telepathy-glib-dbus.h>
-#include <telepathy-logger/channel-internal.h>
#include <telepathy-logger/log-manager.h>
#define DEBUG_FLAG TPL_DEBUG_OBSERVER
@@ -125,12 +124,12 @@ tpl_observer_observe_channels (TpBaseClient *client,
static gboolean
_tpl_observer_register_channel (TplObserver *self,
- TplChannel *channel)
+ TpChannel *channel)
{
gchar *key;
g_return_val_if_fail (TPL_IS_OBSERVER (self), FALSE);
- g_return_val_if_fail (TPL_IS_CHANNEL (channel), FALSE);
+ g_return_val_if_fail (TP_IS_CHANNEL (channel), FALSE);
key = (char *) tp_proxy_get_object_path (G_OBJECT (channel));
@@ -339,13 +338,13 @@ _tpl_observer_dup (GError **error)
*/
gboolean
_tpl_observer_unregister_channel (TplObserver *self,
- TplChannel *channel)
+ TpChannel *channel)
{
gboolean retval;
gchar *key;
g_return_val_if_fail (TPL_IS_OBSERVER (self), FALSE);
- g_return_val_if_fail (TPL_IS_CHANNEL (channel), FALSE);
+ g_return_val_if_fail (TP_IS_CHANNEL (channel), FALSE);
key = (char *) tp_proxy_get_object_path (TP_PROXY (channel));
diff --git a/telepathy-logger/text-channel-internal.h b/telepathy-logger/text-channel-internal.h
index c1ae5ca..e6bb27f 100644
--- a/telepathy-logger/text-channel-internal.h
+++ b/telepathy-logger/text-channel-internal.h
@@ -28,8 +28,6 @@
#include <glib-object.h>
#include <telepathy-glib/telepathy-glib.h>
-#include "channel-internal.h"
-
G_BEGIN_DECLS
#define TPL_TYPE_TEXT_CHANNEL (_tpl_text_channel_get_type ())
diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c
index 3c3b5cd..546bce4 100644
--- a/telepathy-logger/text-channel.c
+++ b/telepathy-logger/text-channel.c
@@ -26,7 +26,6 @@
#include <telepathy-glib/telepathy-glib.h>
#include "action-chain-internal.h"
-#include "channel-internal.h"
#include "entity-internal.h"
#include "event-internal.h"
#include "log-manager-internal.h"
@@ -47,11 +46,7 @@ struct _TplTextChannelPriv
TplEntity *remote;
};
-static void tpl_text_channel_iface_init (TplChannelInterface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (TplTextChannel, _tpl_text_channel,
- TP_TYPE_TEXT_CHANNEL,
- G_IMPLEMENT_INTERFACE (TPL_TYPE_CHANNEL, tpl_text_channel_iface_init))
+G_DEFINE_TYPE (TplTextChannel, _tpl_text_channel, TP_TYPE_TEXT_CHANNEL)
static void
@@ -102,16 +97,16 @@ on_channel_invalidated_cb (TpProxy *proxy,
gchar *message,
gpointer user_data)
{
- TplChannel *tpl_chan = TPL_CHANNEL (user_data);
+ TpChannel *chan = TP_CHANNEL (user_data);
TplObserver *observer = _tpl_observer_dup (NULL);
g_return_if_fail (observer);
- PATH_DEBUG (tpl_chan, "%s #%d %s",
+ PATH_DEBUG (chan, "%s #%d %s",
g_quark_to_string (domain), code, message);
- if (!_tpl_observer_unregister_channel (observer, tpl_chan))
- PATH_DEBUG (tpl_chan, "Channel couldn't be unregistered correctly (BUG?)");
+ if (!_tpl_observer_unregister_channel (observer, chan))
+ PATH_DEBUG (chan, "Channel couldn't be unregistered correctly (BUG?)");
g_object_unref (observer);
}
@@ -560,60 +555,6 @@ connect_message_signals (TplTextChannel *self)
G_CALLBACK (on_pending_message_removed_cb), self, 0);
}
-static void
-channel_prepared_cb (GObject *source,
- GAsyncResult *result,
- gpointer user_data)
-{
- GSimpleAsyncResult *my_result = user_data;
- GError *error = NULL;
-
- if (!tp_proxy_prepare_finish (source, result, &error))
- {
- g_simple_async_result_take_error (my_result, error);
- }
-
- g_simple_async_result_complete (my_result);
- g_object_unref (my_result);
-}
-
-
-static void
-tpl_text_channel_prepare_async (TplChannel *chan,
- GAsyncReadyCallback cb,
- gpointer user_data)
-{
- TplTextChannel *self = (TplTextChannel *) chan;
- GSimpleAsyncResult *result;
- GQuark chan_features[] = {
- TPL_TEXT_CHANNEL_FEATURE_CORE,
- 0
- };
-
- result = g_simple_async_result_new ((GObject *) self, cb, user_data,
- tpl_text_channel_prepare_async);
-
- tp_proxy_prepare_async (chan, chan_features, channel_prepared_cb, result);
-}
-
-
-static gboolean
-tpl_text_channel_prepare_finish (TplChannel *chan,
- GAsyncResult *result,
- GError **error)
-{
- g_return_val_if_fail (
- g_simple_async_result_is_valid (result,
- G_OBJECT (chan), tpl_text_channel_prepare_async),
- FALSE);
-
- if (g_simple_async_result_propagate_error (
- G_SIMPLE_ASYNC_RESULT (result), error))
- return FALSE;
-
- return TRUE;
-}
-
static void
_tpl_text_channel_prepare_core_async (TpProxy *proxy,
@@ -712,14 +653,6 @@ _tpl_text_channel_class_init (TplTextChannelClass *klass)
static void
-tpl_text_channel_iface_init (TplChannelInterface *iface)
-{
- iface->prepare_async = tpl_text_channel_prepare_async;
- iface->prepare_finish = tpl_text_channel_prepare_finish;
-}
-
-
-static void
_tpl_text_channel_init (TplTextChannel *self)
{
TplTextChannelPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE (self,