aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-04 14:55:07 -0500
committerTed Gould <ted@gould.cx>2010-08-04 14:55:07 -0500
commit6eeaa491a8749fc13b7fc5a63fc8e62134d5c803 (patch)
tree0b3f492704dfbab0341608aad877d288de72f982 /example
parent3f326bdebf4052e5ae620caf2cf1e17909c2f8f8 (diff)
parentf2b808303f336aad4ee2663efb80a096dd61dcbd (diff)
downloadlibayatana-appindicator-6eeaa491a8749fc13b7fc5a63fc8e62134d5c803.tar.gz
libayatana-appindicator-6eeaa491a8749fc13b7fc5a63fc8e62134d5c803.tar.bz2
libayatana-appindicator-6eeaa491a8749fc13b7fc5a63fc8e62134d5c803.zip
* Upstream Merge
* Adding label support into the library
Diffstat (limited to 'example')
-rw-r--r--example/simple-client.c15
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");