[Bug 27871] TpSimpleObserver - observe channels without writing a TpBaseClient subclass

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Thu Apr 29 14:07:12 CEST 2010


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

--- Comment #2 from Simon McVittie <simon.mcvittie at collabora.co.uk> 2010-04-29 05:07:12 PDT ---
+ * |[
+ * client = tp_simple_observer_new (dbus, TRUE, "MyObserver", FALSE,
+ *    my_observe_channels, user_data);

I'd like this comment to include a stub implementation of my_observe_channels:

static void
my_observe_channels (TpSimpleObserver *self,
    TpAccount *account,
    TpConnection *connection,
    GList *channels,
    TpChannelDispatchOperation *dispatch_operation,
    GList *requests,
    TpObserveChannelsContext *context,
    gpointer user_data)
{
  /* ... do something useful with the channels here ... */

  tp_observe_channels_context_accept (context);
}

I'd also prefer a more realistic filter: matching every TEXT channel is likely
to be a mistake (unless your observer is written very carefully), and matching
CONTACT TEXT channels would be more normal.

> + * but are not garanteed to be prepared.

"guaranteed"

> + * @channels: a #GPtrArray of #TpChannel having all %TP_CHANNEL_FEATURE_CORE
> + * prepared

"#GList of #TpChannel, all having"

> + * @user_data: arbitrary user-supplied data passed to the callback

This *is* the callback. "passed to tp_simple_observer_new()"

> +      case PROP_OBSERV_IMPL:

I'd prefer this property to be called "callback".

> +tp_simple_observer_new (TpDBusDaemon *dbus,

Shouldn't this take a GDestroyNotify for the user_data, too?

> + * Returns: a new #TpSimpleObserver

"Returns: (type Tp.SimpleObserver): a new #TpSimpleObserver" would be better, I
think; we're deliberately "getting the type wrong" for C's benefit, but g-i
(and documentation) can benefit from knowing more specifically.

It would be good to update telepathy-doc's example to use this, once it's in.

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



More information about the telepathy-bugs mailing list