summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-08-02 14:34:57 +0200
committerXavier Claessens <xclaesse@gmail.com>2011-08-02 16:43:17 +0200
commitef8fe8be1a8a631fa406a03fa2db3c54146b0bd5 (patch)
treebf7923ff2ac22d68312b07fac002f5292d2d8b0b /examples
parent98568941339b7f177c790036fdd20a813398dbc8 (diff)
Deprecate constructors of TpBaseClient subclasses which do not take a TpAccountManager
Those are misleading, if app created its own TpSimpleClientFactory and is using a TpAccountManager from it, they must pass their AM instead otherwise the default one will be used.
Diffstat (limited to 'examples')
-rw-r--r--examples/client/approver.c16
-rw-r--r--examples/client/media-observer.c18
-rw-r--r--examples/client/stream-tubes/accepter.c11
-rw-r--r--examples/client/text-handler.c18
4 files changed, 19 insertions, 44 deletions
diff --git a/examples/client/approver.c b/examples/client/approver.c
index 1a48fcedc..4a02013b4 100644
--- a/examples/client/approver.c
+++ b/examples/client/approver.c
@@ -150,23 +150,15 @@ int
main (int argc,
char **argv)
{
- TpDBusDaemon *bus_daemon;
+ TpAccountManager *manager;
GError *error = NULL;
TpBaseClient *approver;
g_type_init ();
tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
- bus_daemon = tp_dbus_daemon_dup (&error);
-
- if (bus_daemon == NULL)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- return 1;
- }
-
- approver = tp_simple_approver_new (bus_daemon, "ExampleApprover",
+ manager = tp_account_manager_dup ();
+ approver = tp_simple_approver_new_with_am (manager, "ExampleApprover",
FALSE, add_dispatch_operation_cb, NULL, NULL);
/* contact text chat */
@@ -217,7 +209,7 @@ main (int argc,
g_main_loop_unref (mainloop);
out:
- g_object_unref (bus_daemon);
+ g_object_unref (manager);
g_object_unref (approver);
return 0;
diff --git a/examples/client/media-observer.c b/examples/client/media-observer.c
index c54fc19f7..088a53b66 100644
--- a/examples/client/media-observer.c
+++ b/examples/client/media-observer.c
@@ -78,24 +78,16 @@ main (int argc,
char **argv)
{
GMainLoop *mainloop;
- TpDBusDaemon *bus_daemon;
+ TpAccountManager *manager;
GError *error = NULL;
TpBaseClient *observer;
g_type_init ();
tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
- bus_daemon = tp_dbus_daemon_dup (&error);
-
- if (bus_daemon == NULL)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- return 1;
- }
-
- observer = tp_simple_observer_new (bus_daemon, FALSE, "ExampleMediaObserver",
- FALSE, observe_channels_cb, NULL, NULL);
+ manager = tp_account_manager_dup ();
+ observer = tp_simple_observer_new_with_am (manager, FALSE,
+ "ExampleMediaObserver", FALSE, observe_channels_cb, NULL, NULL);
tp_base_client_take_observer_filter (observer, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
@@ -120,7 +112,7 @@ main (int argc,
g_main_loop_unref (mainloop);
out:
- g_object_unref (bus_daemon);
+ g_object_unref (manager);
g_object_unref (observer);
return 0;
diff --git a/examples/client/stream-tubes/accepter.c b/examples/client/stream-tubes/accepter.c
index 915e18546..8f6e580eb 100644
--- a/examples/client/stream-tubes/accepter.c
+++ b/examples/client/stream-tubes/accepter.c
@@ -139,17 +139,15 @@ int
main (int argc,
const char **argv)
{
- TpDBusDaemon *dbus;
+ TpAccountManager *manager;
TpBaseClient *handler;
GError *error = NULL;
g_type_init ();
- dbus = tp_dbus_daemon_dup (&error);
- g_assert_no_error (error);
-
- handler = tp_simple_handler_new (dbus, FALSE, FALSE, "ExampleServiceHandler",
- FALSE, _handle_channels, NULL, NULL);
+ manager = tp_account_manager_dup ();
+ handler = tp_simple_handler_new_with_am (manager, FALSE, FALSE,
+ "ExampleServiceHandler", FALSE, _handle_channels, NULL, NULL);
tp_base_client_take_handler_filter (handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE,
@@ -176,6 +174,7 @@ main (int argc,
g_main_loop_unref (loop);
g_object_unref (handler);
+ g_object_unref (manager);
return 0;
}
diff --git a/examples/client/text-handler.c b/examples/client/text-handler.c
index d093b3063..536d26aaa 100644
--- a/examples/client/text-handler.c
+++ b/examples/client/text-handler.c
@@ -118,24 +118,16 @@ main (int argc,
char **argv)
{
GMainLoop *mainloop;
- TpDBusDaemon *bus_daemon;
+ TpAccountManager *manager;
GError *error = NULL;
TpBaseClient *handler;
g_type_init ();
tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));
- bus_daemon = tp_dbus_daemon_dup (&error);
-
- if (bus_daemon == NULL)
- {
- g_warning ("%s", error->message);
- g_error_free (error);
- return 1;
- }
-
- handler = tp_simple_handler_new (bus_daemon, FALSE, FALSE, "ExampleHandler",
- FALSE, handle_channels_cb, NULL, NULL);
+ manager = tp_account_manager_dup ();
+ handler = tp_simple_handler_new_with_am (manager, FALSE, FALSE,
+ "ExampleHandler", FALSE, handle_channels_cb, NULL, NULL);
tp_base_client_take_handler_filter (handler, tp_asv_new (
TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
@@ -161,7 +153,7 @@ main (int argc,
g_main_loop_unref (mainloop);
out:
- g_object_unref (bus_daemon);
+ g_object_unref (manager);
g_object_unref (handler);
return 0;