diff options
author | Ted Gould <ted@gould.cx> | 2010-08-04 14:50:13 -0500 |
---|---|---|
committer | Ted Gould <ted@gould.cx> | 2010-08-04 14:50:13 -0500 |
commit | f2b808303f336aad4ee2663efb80a096dd61dcbd (patch) | |
tree | d237b3563a2a8ebb1efd6dd8f7e02e791d163f67 | |
parent | 43e185e0c4828a5eaa0422186198d08edefd12a1 (diff) | |
download | libayatana-appindicator-f2b808303f336aad4ee2663efb80a096dd61dcbd.tar.gz libayatana-appindicator-f2b808303f336aad4ee2663efb80a096dd61dcbd.tar.bz2 libayatana-appindicator-f2b808303f336aad4ee2663efb80a096dd61dcbd.zip |
Setting the label in the simple client
-rw-r--r-- | example/simple-client.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/example/simple-client.c b/example/simple-client.c index fbcaaaa..d756988 100644 --- a/example/simple-client.c +++ b/example/simple-client.c @@ -97,6 +97,18 @@ append_submenu (GtkWidget *item) gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), menu); } +guint percentage = 0; + +static gboolean +percent_change (gpointer user_data) +{ + percentage = (percentage + 1) % 100; + gchar * percentstr = g_strdup_printf("%d%%", percentage); + app_indicator_set_label (APP_INDICATOR(user_data), percentstr, "100%"); + g_free(percentstr); + return TRUE; +} + int main (int argc, char ** argv) { @@ -114,6 +126,9 @@ main (int argc, char ** argv) app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE); app_indicator_set_attention_icon(ci, "indicator-messages-new"); + app_indicator_set_label (ci, "1%", "100%"); + + g_timeout_add_seconds(1, percent_change, ci); menu = gtk_menu_new (); GtkWidget *item = gtk_check_menu_item_new_with_label ("1"); |