[Bug 43819] New: [API break] Simplify TpBaseClient constructors

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed Dec 14 13:48:32 CET 2011


https://bugs.freedesktop.org/show_bug.cgi?id=43819

             Bug #: 43819
           Summary: [API break] Simplify TpBaseClient constructors
    Classification: Unclassified
           Product: Telepathy
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: medium
         Component: tp-glib
        AssignedTo: telepathy-bugs at lists.freedesktop.org
        ReportedBy: xclaesse at gmail.com
         QAContact: telepathy-bugs at lists.freedesktop.org


atm a simple handler that just wants to catch its channels without preparing a
full TpAccountManager have to do:

dbus = tp_dbus_daemon_dup(NULL);
factory = tp_automatic_client_factory_new (dbus);
handler = tp_simple_handler_new_with_factory (factory, ...);
...
g_object_unref (dbus);
g_object_unref (factory);
g_object_unref (handler);

IMO this is a bit too much, the only thing TpBaseClient really needs is a
factory, all the rest is just legacy or constructor helpers. Since we are going
to break API in "next" branch, let's sort this out.

What I suggest:

1) tp_simple_handler_new (TpSimpleClientFactory *factory, ...);
if factory is NULL, then internally it does dbus = tp_dbus_daemon_dup();
self->priv->factory = tp_automatic_client_factory_new(dbus);

2) tp_simple_handler_new_with_am (TpAccountManager *am, ...){return
tp_simple_handler_new (tp_proxy_get_factory (am), ...);} this is a trivial
helper in the case the user already has an IM.

Like this, the example above strips down to:

handler = tp_simple_handler_new (NULL, ...);
...
g_object_unref (handler);

-- 
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA Contact for the bug.
You are the assignee for the bug.



More information about the telepathy-bugs mailing list