aboutsummaryrefslogtreecommitdiff
path: root/example/simple-client.c
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-08-04 14:50:13 -0500
committerTed Gould <ted@gould.cx>2010-08-04 14:50:13 -0500
commitf2b808303f336aad4ee2663efb80a096dd61dcbd (patch)
treed237b3563a2a8ebb1efd6dd8f7e02e791d163f67 /example/simple-client.c
parent43e185e0c4828a5eaa0422186198d08edefd12a1 (diff)
downloadayatana-indicator-application-f2b808303f336aad4ee2663efb80a096dd61dcbd.tar.gz
ayatana-indicator-application-f2b808303f336aad4ee2663efb80a096dd61dcbd.tar.bz2
ayatana-indicator-application-f2b808303f336aad4ee2663efb80a096dd61dcbd.zip
Setting the label in the simple client
Diffstat (limited to 'example/simple-client.c')
-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");