Don't react to non-sms/chat events
authorArtem Garmash <artemgarmash@gmail.com>
Sun, 24 Jan 2010 18:07:49 +0000 (20:07 +0200)
committerArtem Garmash <artem.garmash@nokia.com>
Sun, 27 Jun 2010 19:13:44 +0000 (22:13 +0300)
src/el-home-applet.c

index 20da3fd..03322fa 100644 (file)
 #define NOTIFICATION_UI_DBUS_PATH     "/org/freedesktop/Telepathy/Client/NotificationUI"
 #define NOTIFICATION_UI_DBUS_IFACE    "com.nokia.RtcomNotificationUi"
 
+static const gchar *conv_services[] = {"RTCOM_EL_SERVICE_SMS",
+                                       "RTCOM_EL_SERVICE_CHAT",
+                                       NULL};
+static const gchar *conv_event_types[] = {"RTCOM_EL_EVENTTYPE_SMS_INBOUND",
+                                          "RTCOM_EL_EVENTTYPE_CHAT_INBOUND",
+                                          NULL};
+
 typedef enum {
         SELECTED_NONE,
         SELECTED_HEADER,
@@ -834,28 +841,18 @@ make_query (RTComEl *el, gint event_id)
         RTComElQuery *query = NULL;
         RTComElIter *it = NULL;
 
-        static const gchar *services[] = {"RTCOM_EL_SERVICE_SMS",
-                                          "RTCOM_EL_SERVICE_CHAT",
-                                          NULL};
-        static const gchar *event_types[] = {"RTCOM_EL_EVENTTYPE_SMS_INBOUND",
-                                             "RTCOM_EL_EVENTTYPE_CHAT_INBOUND",
-                                             NULL};
-
         query = rtcom_el_query_new (el);
         rtcom_el_query_set_limit (query, 1);
         if (event_id >= 0) {
                 rtcom_el_query_prepare (query,
-                                        "is-read", FALSE, RTCOM_EL_OP_EQUAL,
                                         "id", event_id, RTCOM_EL_OP_EQUAL,
-                                        "service", services, RTCOM_EL_OP_IN_STRV,
-                                        "event-type", event_types, RTCOM_EL_OP_IN_STRV,
                                         NULL);
         }
         else {
                 rtcom_el_query_prepare (query,
                                         "is-read", FALSE, RTCOM_EL_OP_EQUAL,
-                                        "service", services, RTCOM_EL_OP_IN_STRV,
-                                        "event-type", event_types, RTCOM_EL_OP_IN_STRV,
+                                        "service", conv_services, RTCOM_EL_OP_IN_STRV,
+                                        "event-type", conv_event_types, RTCOM_EL_OP_IN_STRV,
                                         NULL);
         }
         it = rtcom_el_get_events (el, query);
@@ -1102,8 +1099,15 @@ new_event_cb (RTComEl      *backend,
               const gchar  *service,
               ELHomeApplet *self)
 {
-        /* TODO: avoid updating if not related */
-        add_new_idle (self);
+        const gchar** conv_service = conv_services;
+
+        do {
+                if (!g_strcmp0 (*conv_service, service)) {
+                        add_new_idle (self);
+                        return;
+                }
+        }
+        while(++conv_service);
 }
 
 static gboolean