diff options
author | Ted Gould <ted@gould.cx> | 2013-08-15 15:21:52 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2013-08-15 15:21:52 -0500 |
commit | 1f28cf89abf224957c3e9eb60e103d4204958fcc (patch) | |
tree | 818f4d7b582b80b19de30a81d669b5b600c967d7 | |
parent | 5ca1b7a06fe94cb7e2d760d9a5a98de022e5376b (diff) | |
download | ayatana-indicator-messages-1f28cf89abf224957c3e9eb60e103d4204958fcc.tar.gz ayatana-indicator-messages-1f28cf89abf224957c3e9eb60e103d4204958fcc.tar.bz2 ayatana-indicator-messages-1f28cf89abf224957c3e9eb60e103d4204958fcc.zip |
Setting up a callback on the activation to set the state and update the applications
-rw-r--r-- | src/im-application-list.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/im-application-list.c b/src/im-application-list.c index d9b3e2f..8083704 100644 --- a/src/im-application-list.c +++ b/src/im-application-list.c @@ -71,6 +71,12 @@ typedef struct GCancellable *cancellable; } Application; + +/* Prototypes */ +static void status_activated (GSimpleAction * action, + GVariant * param, + gpointer user_data); + static void application_free (gpointer data) { @@ -432,6 +438,7 @@ im_application_list_init (ImApplicationList *list) g_simple_action_group_add_entries (list->globalactions, action_entries, G_N_ELEMENTS (action_entries), list); list->statusaction = g_simple_action_new_stateful("status", G_VARIANT_TYPE_STRING, g_variant_new_string("offline")); + g_signal_connect(list->statusaction, "activate", G_CALLBACK(status_activated), list); g_simple_action_group_insert(list->globalactions, G_ACTION(list->statusaction)); list->muxer = g_action_muxer_new (); @@ -989,6 +996,24 @@ im_application_list_get_application (ImApplicationList *list, return app ? app->info : NULL; } +static void +status_activated (GSimpleAction * action, GVariant * param, gpointer user_data) +{ + g_return_if_fail (IM_IS_APPLICATION_LIST(user_data)); + ImApplicationList * list = IM_APPLICATION_LIST(user_data); + + g_simple_action_set_state(action, param); + + /* We assume all the applications are now seeing our status + and updating. We don't need to track their status until + they tell us different. */ + g_hash_table_remove_all(list->app_status); + + /* TODO: Emit a state change */ + + return; +} + void im_application_list_set_status (ImApplicationList * list, const gchar * id, const gchar *status) { |