diff options
author | Ted Gould <ted@gould.cx> | 2011-07-13 14:08:39 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2011-07-13 14:08:39 -0500 |
commit | cd0c66774c3f61cee7279211cefd72e980a314aa (patch) | |
tree | 99c7f8581bec226c7f9adb687441246627e8327d | |
parent | 2a04996a4d63a3594c0a5e8e9dbbc3432daf4a29 (diff) | |
download | ayatana-indicator-messages-cd0c66774c3f61cee7279211cefd72e980a314aa.tar.gz ayatana-indicator-messages-cd0c66774c3f61cee7279211cefd72e980a314aa.tar.bz2 ayatana-indicator-messages-cd0c66774c3f61cee7279211cefd72e980a314aa.zip |
Handle users clicking on those silly menu items that we created.
-rw-r--r-- | src/status-items.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/status-items.c b/src/status-items.c index 3442478..ac92aba 100644 --- a/src/status-items.c +++ b/src/status-items.c @@ -46,6 +46,7 @@ static const gchar * panel_active_icons[STATUS_PROVIDER_STATUS_LAST] = { /* Prototypes */ static gboolean provider_directory_parse (gpointer dir); static gboolean load_status_provider (gpointer dir); +static void user_status_change (DbusmenuMenuitem * item, guint timestamp, gpointer pstatus); /* Globals */ static StatusProviderStatus current_status = STATUS_PROVIDER_STATUS_DISCONNECTED; @@ -71,6 +72,8 @@ status_items_build (StatusUpdateFunc status_update_func) dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_TOGGLE_TYPE, DBUSMENU_MENUITEM_TOGGLE_RADIO); dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_TOGGLE_STATE, DBUSMENU_MENUITEM_TOGGLE_STATE_UNCHECKED); + g_signal_connect(G_OBJECT(item), DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, G_CALLBACK(user_status_change), GINT_TO_POINTER(i)); + menuitems = g_list_append(menuitems, item); } @@ -152,6 +155,23 @@ update_status (void) return; } +/* Handle the user requesting a status change */ +static void +user_status_change (DbusmenuMenuitem * item, guint timestamp, gpointer pstatus) +{ + StatusProviderStatus status = GPOINTER_TO_INT(pstatus); + GList * provider; + + /* Set each provider to this status */ + for (provider = status_providers; provider != NULL; provider = g_list_next(provider)) { + status_provider_set_status(STATUS_PROVIDER(provider->data), status); + } + + /* See what we really are now */ + update_status(); + return; +} + /* Start parsing a directory and setting up the entires in the idle loop */ static gboolean provider_directory_parse (gpointer directory) |