summaryrefslogtreecommitdiff
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
parent98568941339b7f177c790036fdd20a813398dbc8 (diff)
downloadtelepathy-glib-ef8fe8be1a8a631fa406a03fa2db3c54146b0bd5.tar.gz
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.
-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
-rw-r--r--telepathy-glib/simple-approver.c1
-rw-r--r--telepathy-glib/simple-approver.h3
-rw-r--r--telepathy-glib/simple-handler.c1
-rw-r--r--telepathy-glib/simple-handler.h3
-rw-r--r--telepathy-glib/simple-observer.c1
-rw-r--r--telepathy-glib/simple-observer.h3
10 files changed, 28 insertions, 47 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;
diff --git a/telepathy-glib/simple-approver.c b/telepathy-glib/simple-approver.c
index 2fd03f24e..a3e5a9892 100644
--- a/telepathy-glib/simple-approver.c
+++ b/telepathy-glib/simple-approver.c
@@ -277,6 +277,7 @@ tp_simple_approver_class_init (TpSimpleApproverClass *cls)
* Returns: (type TelepathyGLib.SimpleApprover): a new #TpSimpleApprover
*
* Since: 0.11.5
+ * Deprecated: New code should use tp_simple_approver_new_with_am() instead.
*/
TpBaseClient *
tp_simple_approver_new (TpDBusDaemon *dbus,
diff --git a/telepathy-glib/simple-approver.h b/telepathy-glib/simple-approver.h
index e2b3cdabf..6d7c46653 100644
--- a/telepathy-glib/simple-approver.h
+++ b/telepathy-glib/simple-approver.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <telepathy-glib/base-client.h>
+#include <telepathy-glib/defs.h>
G_BEGIN_DECLS
@@ -76,7 +77,7 @@ TpBaseClient * tp_simple_approver_new (TpDBusDaemon *dbus,
gboolean uniquify,
TpSimpleApproverAddDispatchOperationImpl callback,
gpointer user_data,
- GDestroyNotify destroy);
+ GDestroyNotify destroy) _TP_GNUC_DEPRECATED;
TpBaseClient *tp_simple_approver_new_with_am (
TpAccountManager *account_manager,
diff --git a/telepathy-glib/simple-handler.c b/telepathy-glib/simple-handler.c
index b0e750e64..89cc0c0aa 100644
--- a/telepathy-glib/simple-handler.c
+++ b/telepathy-glib/simple-handler.c
@@ -331,6 +331,7 @@ tp_simple_handler_class_init (TpSimpleHandlerClass *cls)
* Returns: (type TelepathyGLib.SimpleHandler): a new #TpSimpleHandler
*
* Since: 0.11.6
+ * Deprecated: New code should use tp_simple_handler_new_with_am() instead.
*/
TpBaseClient *
tp_simple_handler_new (TpDBusDaemon *dbus,
diff --git a/telepathy-glib/simple-handler.h b/telepathy-glib/simple-handler.h
index 27dd5bbf9..3d3d76cac 100644
--- a/telepathy-glib/simple-handler.h
+++ b/telepathy-glib/simple-handler.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <telepathy-glib/base-client.h>
+#include <telepathy-glib/defs.h>
G_BEGIN_DECLS
@@ -79,7 +80,7 @@ TpBaseClient * tp_simple_handler_new (TpDBusDaemon *dbus,
gboolean uniquify,
TpSimpleHandlerHandleChannelsImpl callback,
gpointer user_data,
- GDestroyNotify destroy);
+ GDestroyNotify destroy) _TP_GNUC_DEPRECATED;
TpBaseClient *tp_simple_handler_new_with_am (TpAccountManager *account_manager,
gboolean bypass_approval,
diff --git a/telepathy-glib/simple-observer.c b/telepathy-glib/simple-observer.c
index 81b0a5e69..b0e673994 100644
--- a/telepathy-glib/simple-observer.c
+++ b/telepathy-glib/simple-observer.c
@@ -303,6 +303,7 @@ tp_simple_observer_class_init (TpSimpleObserverClass *cls)
* Returns: (type TelepathyGLib.SimpleObserver): a new #TpSimpleObserver
*
* Since: 0.11.5
+ * Deprecated: New code should use tp_simple_observer_new_with_am() instead.
*/
TpBaseClient *
tp_simple_observer_new (TpDBusDaemon *dbus,
diff --git a/telepathy-glib/simple-observer.h b/telepathy-glib/simple-observer.h
index 7896392db..89f501d86 100644
--- a/telepathy-glib/simple-observer.h
+++ b/telepathy-glib/simple-observer.h
@@ -25,6 +25,7 @@
#include <glib-object.h>
#include <telepathy-glib/base-client.h>
+#include <telepathy-glib/defs.h>
G_BEGIN_DECLS
@@ -78,7 +79,7 @@ TpBaseClient * tp_simple_observer_new (TpDBusDaemon *dbus,
gboolean uniquify,
TpSimpleObserverObserveChannelsImpl callback,
gpointer user_data,
- GDestroyNotify destroy);
+ GDestroyNotify destroy) _TP_GNUC_DEPRECATED;
TpBaseClient *tp_simple_observer_new_with_am (
TpAccountManager *account_manager,