diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-02-14 08:50:19 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2011-02-14 08:50:19 +0000 |
commit | ccb32c9fe13bae60d2bc9ab11ee2be19fa374284 (patch) | |
tree | 3d0849f514872d94077ef542541a9c88706132c6 /plugins | |
parent | 6ea7194c5e06f32665e95f5d5d0d12f45fb97743 (diff) |
test plugin: implement create_channel_managers
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/test.c | 66 | ||||
-rw-r--r-- | plugins/test.h | 30 |
2 files changed, 96 insertions, 0 deletions
diff --git a/plugins/test.c b/plugins/test.c index be7a42cd..3326c3e3 100644 --- a/plugins/test.c +++ b/plugins/test.c @@ -122,6 +122,21 @@ test_plugin_create_sidecar ( g_object_unref (result); } +static GPtrArray * +test_plugin_create_channel_managers (GabblePlugin *plugin, + TpBaseConnection *connection) +{ + GPtrArray *ret = g_ptr_array_new (); + + DEBUG ("plugin %p on connection %p", plugin, connection); + + g_ptr_array_add (ret, + g_object_new (TEST_TYPE_CHANNEL_MANAGER, + NULL)); + + return ret; +} + static TpPresenceStatusSpec test_presences[] = { { "testbusy", TP_CONNECTION_PRESENCE_TYPE_BUSY, TRUE, NULL, NULL, NULL }, { "testaway", TP_CONNECTION_PRESENCE_TYPE_AWAY, FALSE, NULL, NULL, NULL }, @@ -143,6 +158,7 @@ plugin_iface_init ( iface->name = "Sidecar test plugin"; iface->sidecar_interfaces = sidecar_interfaces; iface->create_sidecar = test_plugin_create_sidecar; + iface->create_channel_managers = test_plugin_create_channel_managers; iface->presence_statuses = test_presences; iface->privacy_list_map = privacy_list_map; @@ -460,3 +476,53 @@ async_initable_iface_init ( iface->init_async = sidecar_iq_init_async; iface->init_finish = sidecar_iq_init_finish; } + +/*********************************** + * TestChannelManager implementation * + ***********************************/ +static void channel_manager_iface_init (gpointer, gpointer); + +G_DEFINE_TYPE_WITH_CODE (TestChannelManager, test_channel_manager, + G_TYPE_OBJECT, + G_IMPLEMENT_INTERFACE (TP_TYPE_CHANNEL_MANAGER, + channel_manager_iface_init)); + +static void +test_channel_manager_init (TestChannelManager *self) +{ +} + +static void +test_channel_manager_class_init (TestChannelManagerClass *klass) +{ +} + +static void +test_channel_manager_type_foreach_channel_class (GType type, + TpChannelManagerTypeChannelClassFunc func, + gpointer user_data) +{ + GHashTable *table = tp_asv_new ( + "cookies", G_TYPE_STRING, "lolbags", + NULL); + const gchar * const empty[] = { "omg", "hi mum!", NULL }; + + func (type, table, empty, user_data); + + g_hash_table_destroy (table); +} + +static void +channel_manager_iface_init (gpointer g_iface, + gpointer iface_data) +{ + TpChannelManagerIface *iface = g_iface; + + iface->type_foreach_channel_class = test_channel_manager_type_foreach_channel_class; + + /* not requestable. */ + iface->ensure_channel = NULL; + iface->create_channel = NULL; + iface->request_channel = NULL; + iface->foreach_channel_class = NULL; +} diff --git a/plugins/test.h b/plugins/test.h index 46fc562e..0884af8e 100644 --- a/plugins/test.h +++ b/plugins/test.h @@ -123,3 +123,33 @@ GType test_sidecar_iq_get_type (void); #define TEST_SIDECAR_IQ_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_SIDECAR_IQ, \ TestSidecarIQClass)) + +/* Test channel manager */ +typedef struct _TestChannelManager TestChannelManager; +typedef struct _TestChannelManagerClass TestChannelManagerClass; + +struct _TestChannelManagerClass { + GObjectClass parent_class; +}; + +struct _TestChannelManager { + GObject parent; +}; + +GType test_channel_manager_get_type (void); + +/* TYPE MACROS */ +#define TEST_TYPE_CHANNEL_MANAGER \ + (test_channel_manager_get_type ()) +#define TEST_CHANNEL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_CHANNEL_MANAGER, TestChannelManager)) +#define TEST_CHANNEL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TEST_TYPE_CHANNEL_MANAGER,\ + TestChannelManagerClass)) +#define TEST_IS_CHANNEL_MANAGER(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEST_TYPE_CHANNEL_MANAGER)) +#define TEST_IS_CHANNEL_MANAGER_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), TEST_TYPE_CHANNEL_MANAGER)) +#define TEST_CHANNEL_MANAGER_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_CHANNEL_MANAGER,\ + TestChannelManagerClass)) |