aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2011-07-22 12:06:02 -0500
committerTed Gould <ted@gould.cx>2011-07-22 12:06:02 -0500
commit0eb92a1061c5e00827169f3f419daf01e1a006fc (patch)
tree1f7172f63969cdf6502d8e1249b6eae69989ee2f
parentf525c9fe26e3c1393d3c97b2d984f0829a121940 (diff)
downloadayatana-indicator-messages-0eb92a1061c5e00827169f3f419daf01e1a006fc.tar.gz
ayatana-indicator-messages-0eb92a1061c5e00827169f3f419daf01e1a006fc.tar.bz2
ayatana-indicator-messages-0eb92a1061c5e00827169f3f419daf01e1a006fc.zip
Adding in the clear attention menu item
-rw-r--r--src/messages-service.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/messages-service.c b/src/messages-service.c
index 63549e3..dfa7725 100644
--- a/src/messages-service.c
+++ b/src/messages-service.c
@@ -28,6 +28,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <libindicate/listener.h>
#include <libindicator/indicator-service.h>
#include <gio/gio.h>
+#include <glib/gi18n.h>
#include <libdbusmenu-glib/client.h>
#include <libdbusmenu-glib/server.h>
@@ -49,6 +50,7 @@ static GList * launcherList = NULL;
static DbusmenuMenuitem * root_menuitem = NULL;
static DbusmenuMenuitem * status_separator = NULL;
+static DbusmenuMenuitem * clear_attention = NULL;
static GMainLoop * mainloop = NULL;
static MessageServiceDbus * dbus_interface = NULL;
@@ -1439,12 +1441,31 @@ service_shutdown (IndicatorService * service, gpointer user_data)
return;
}
+/* Respond to changing status by updating the icon that
+ is on the panel */
static void
status_update_callback (void)
{
return;
}
+/* The clear attention item has been clicked on, what to do? */
+static void
+clear_attention_activate (DbusmenuMenuitem * mi, guint timestamp, MessageServiceDbus * dbus)
+{
+ message_service_dbus_set_attention(dbus, FALSE);
+ return;
+}
+
+/* Handle an update of the active state to ensure that we're
+ only enabled when we could do something. */
+static void
+clear_attention_handler (MessageServiceDbus * msd, gboolean attention, DbusmenuMenuitem * clearitem)
+{
+ dbusmenu_menuitem_property_set_bool(clearitem, DBUSMENU_MENUITEM_PROP_ENABLED, attention);
+ return;
+}
+
/* Oh, if you don't know what main() is for
we really shouldn't be talking. */
int
@@ -1484,6 +1505,13 @@ main (int argc, char ** argv)
dbusmenu_menuitem_property_set(status_separator, DBUSMENU_MENUITEM_PROP_TYPE, DBUSMENU_CLIENT_TYPES_SEPARATOR);
dbusmenu_menuitem_child_append(root_menuitem, status_separator);
+ /* Add in the clear attention item */
+ clear_attention = dbusmenu_menuitem_new();
+ dbusmenu_menuitem_property_set(clear_attention, DBUSMENU_MENUITEM_PROP_LABEL, _("Clear Attention"));
+ dbusmenu_menuitem_child_append(root_menuitem, clear_attention);
+ g_signal_connect(G_OBJECT(dbus_interface), MESSAGE_SERVICE_DBUS_SIGNAL_ATTENTION_CHANGED, G_CALLBACK(clear_attention_handler), clear_attention);
+ g_signal_connect(G_OBJECT(clear_attention), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(clear_attention_activate), dbus_interface);
+
/* Start up the libindicate listener */
listener = indicate_listener_ref_default();
serverList = NULL;