[empathy/next: 63/79] log_window_create_observer: use TpChannelFilter



commit a95d5db7118722ae8f43746fbb2494ca87eefd88
Author: Simon McVittie <simon mcvittie collabora co uk>
Date:   Tue Mar 25 19:06:41 2014 +0000

    log_window_create_observer: use TpChannelFilter

 libempathy-gtk/empathy-log-window.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index c1fecf9..c0a9829 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -1036,6 +1036,7 @@ static void
 log_window_create_observer (EmpathyLogWindow *self)
 {
   TpAccountManager *am;
+  TpChannelFilter *filter;
 
   am = tp_account_manager_dup ();
 
@@ -1045,12 +1046,18 @@ log_window_create_observer (EmpathyLogWindow *self)
   self->priv->channels = g_hash_table_new_full (g_direct_hash, g_direct_equal,
       g_object_unref, g_object_unref);
 
-  tp_base_client_add_observer_filter (self->priv->observer,
-      g_variant_new_parsed ("{ %s: <%s> }",
-        TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_TEXT));
-  tp_base_client_add_observer_filter (self->priv->observer,
-      g_variant_new_parsed ("{ %s: <%s> }",
-          TP_PROP_CHANNEL_CHANNEL_TYPE, TP_IFACE_CHANNEL_TYPE_CALL1));
+  /* FIXME: either there should be an easier way to create channel filters for
+   * text and calls with an arbitrary entity type, or we should only watch
+   * for sensible entity types (NONE, CONTACT and ROOM) */
+  filter = tp_channel_filter_new_for_all_types ();
+  tp_channel_filter_require_property (filter, TP_PROP_CHANNEL_CHANNEL_TYPE,
+      g_variant_new_string (TP_IFACE_CHANNEL_TYPE_TEXT));
+  tp_base_client_take_observer_filter (self->priv->observer, filter);
+
+  filter = tp_channel_filter_new_for_all_types ();
+  tp_channel_filter_require_property (filter, TP_PROP_CHANNEL_CHANNEL_TYPE,
+      g_variant_new_string (TP_IFACE_CHANNEL_TYPE_CALL1));
+  tp_base_client_take_observer_filter (self->priv->observer, filter);
 
   tp_base_client_register (self->priv->observer, NULL);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]