aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-12-08 15:31:12 -0600
committerTed Gould <ted@gould.cx>2010-12-08 15:31:12 -0600
commit36d0bc801369edb79da28871a00c3cc4ef9ee001 (patch)
tree4f4564ec0e42fb48365d876cbb689b377563bbb5 /example
parent3acbfb57c4800b7f8611d1ce5db391cad96f398b (diff)
parent0d8a2c601b50a1d9ce6ccd1140f624c84558cf9d (diff)
downloadlibayatana-appindicator-36d0bc801369edb79da28871a00c3cc4ef9ee001.tar.gz
libayatana-appindicator-36d0bc801369edb79da28871a00c3cc4ef9ee001.tar.bz2
libayatana-appindicator-36d0bc801369edb79da28871a00c3cc4ef9ee001.zip
* Upstream Merge
* Removing service, lib only * Switching from dbus-glib to GDBus
Diffstat (limited to 'example')
-rw-r--r--example/Makefile.am8
-rw-r--r--example/simple-client-test-icon.pngbin0 -> 3310 bytes
-rw-r--r--example/simple-client.c20
3 files changed, 26 insertions, 2 deletions
diff --git a/example/Makefile.am b/example/Makefile.am
index f4f2ab2..e23e08d 100644
--- a/example/Makefile.am
+++ b/example/Makefile.am
@@ -10,10 +10,14 @@ simple_client_SOURCES = \
simple-client.c
simple_client_CFLAGS = \
- $(INDICATOR_CFLAGS) \
+ $(LIBRARY_CFLAGS) \
+ -DLOCAL_ICON="\"$(abs_srcdir)/simple-client-test-icon.png\"" \
-Wall -Werror \
-I$(top_srcdir)/src
simple_client_LDADD = \
- $(INDICATOR_LIBS) \
+ $(LIBRARY_LIBS) \
$(top_builddir)/src/libappindicator.la
+
+EXTRA_DIST = \
+ simple-client-test-icon.png
diff --git a/example/simple-client-test-icon.png b/example/simple-client-test-icon.png
new file mode 100644
index 0000000..30dbb9d
--- /dev/null
+++ b/example/simple-client-test-icon.png
Binary files differ
diff --git a/example/simple-client.c b/example/simple-client.c
index f2fac6f..734aff6 100644
--- a/example/simple-client.c
+++ b/example/simple-client.c
@@ -60,6 +60,20 @@ activate_clicked_cb (GtkWidget *widget, gpointer data)
}
static void
+local_icon_toggle_cb (GtkWidget *widget, gpointer data)
+{
+ AppIndicator * ci = APP_INDICATOR(data);
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
+ app_indicator_set_icon(ci, LOCAL_ICON);
+ } else {
+ app_indicator_set_icon(ci, "indicator-messages");
+ }
+
+ return;
+}
+
+static void
item_clicked_cb (GtkWidget *widget, gpointer data)
{
const gchar *text = (const gchar *)data;
@@ -192,6 +206,12 @@ main (int argc, char ** argv)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show(item);
+ item = gtk_check_menu_item_new_with_label ("Set Local Icon");
+ g_signal_connect (item, "activate",
+ G_CALLBACK (local_icon_toggle_cb), ci);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ gtk_widget_show(item);
+
app_indicator_set_menu (ci, GTK_MENU (menu));
mainloop = g_main_loop_new(NULL, FALSE);