From b5e7ce6b32941e831e325ea2503dc698eee91b5e Mon Sep 17 00:00:00 2001 From: Artem Garmash Date: Sun, 10 Jan 2010 19:43:06 +0200 Subject: [PATCH 1/1] Remove notification from status aread when marking as read --- src/el-home-applet.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) diff --git a/src/el-home-applet.c b/src/el-home-applet.c index 3d58568..c73026d 100644 --- a/src/el-home-applet.c +++ b/src/el-home-applet.c @@ -59,6 +59,10 @@ #define SCROLL_STEP 1 /* pixel */ #define TEXT_Y_OFFSET (HEADER_HEIGHT + HILDON_MARGIN_HALF) +#define NOTIFICATION_UI_DBUS_NAME "org.freedesktop.Telepathy.Client.NotificationUI" +#define NOTIFICATION_UI_DBUS_PATH "/org/freedesktop/Telepathy/Client/NotificationUI" +#define NOTIFICATION_UI_DBUS_IFACE "com.nokia.RtcomNotificationUi" + struct _ELHomeAppletPrivate { RTComEl *eventlogger; @@ -824,6 +828,72 @@ read_event (ELHomeApplet *self) } static void +remove_notification (ELHomeApplet *self) +{ + ELHomeAppletPrivate *priv = self->priv; + + DBusGConnection* conn; + GError *error; + DBusGProxy *proxy; + GPtrArray *conv_structs; + GType conv_structs_type; + GValueArray *account_info; + GValue value = {0, }; + DBusGProxyCall *call; + + if (!(priv->remote_id && priv->local_id)) + return; + + conn = hd_home_plugin_item_get_dbus_g_connection (HD_HOME_PLUGIN_ITEM (self), + DBUS_BUS_SESSION, + &error); + if (!conn) { + g_error ("Failed get dbus g connection %s", error->message); + g_error_free (error); + return; + } + + proxy = dbus_g_proxy_new_for_name (conn, + NOTIFICATION_UI_DBUS_NAME, + NOTIFICATION_UI_DBUS_PATH, + NOTIFICATION_UI_DBUS_IFACE); + + conv_structs = g_ptr_array_sized_new (1); + account_info = g_value_array_new (2); + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, priv->local_id); + g_value_array_append (account_info, &value); + g_value_unset (&value); + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, priv->remote_id); + g_value_array_append (account_info, &value); + g_value_unset (&value); + + g_ptr_array_add (conv_structs, account_info); + + conv_structs_type = dbus_g_type_get_collection + ("GPtrArray", + dbus_g_type_get_struct ("GValueArray", + G_TYPE_STRING, + G_TYPE_STRING, + G_TYPE_INVALID)); + + call = dbus_g_proxy_begin_call (proxy, + "ClearConversationNotifications", + NULL, NULL, NULL, + conv_structs_type, + conv_structs, + G_TYPE_INVALID); + + g_value_array_free (account_info); + g_ptr_array_free (conv_structs, TRUE); + + g_object_unref (proxy); +} + +static void mark_as_read (ELHomeApplet *self) { ELHomeAppletPrivate *priv = self->priv; @@ -833,6 +903,7 @@ mark_as_read (ELHomeApplet *self) priv->event_id, TRUE, NULL); + remove_notification (self); } } -- 1.7.9.5