From: Artem Garmash Date: Sun, 24 Jan 2010 18:07:49 +0000 (+0200) Subject: Don't react to non-sms/chat events X-Git-Url: https://vcs.maemo.org/git/?p=conv-inbox;a=commitdiff_plain;h=7418d5bd2760aaaf9de181baf9ee0961718fc151 Don't react to non-sms/chat events --- diff --git a/src/el-home-applet.c b/src/el-home-applet.c index 20da3fd..03322fa 100644 --- a/src/el-home-applet.c +++ b/src/el-home-applet.c @@ -72,6 +72,13 @@ #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