aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-02-08 09:23:36 -0600
committerTed Gould <ted@gould.cx>2010-02-08 09:23:36 -0600
commit585f9e3a0d77d945e9270b95c2fba77242ba06b9 (patch)
tree363c4aa0aab02907f47d3b85eabbc07c13fc88a4 /example
parent5bd28754757d8fa61fdad1d7f065d1c25c75befa (diff)
parent821e84539deec041e24410ce83f5b0c196f13814 (diff)
downloadayatana-indicator-application-585f9e3a0d77d945e9270b95c2fba77242ba06b9.tar.gz
ayatana-indicator-application-585f9e3a0d77d945e9270b95c2fba77242ba06b9.tar.bz2
ayatana-indicator-application-585f9e3a0d77d945e9270b95c2fba77242ba06b9.zip
* Upstream Merge
* Fixing copying of the attention icon * Adding status changing to the example application * Adding a test for status changing getting sent over DBus.
Diffstat (limited to 'example')
-rw-r--r--example/simple-client.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/example/simple-client.c b/example/simple-client.c
index 6dcf5d1..f1b8d37 100644
--- a/example/simple-client.c
+++ b/example/simple-client.c
@@ -25,6 +25,24 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include "libdbusmenu-glib/menuitem.h"
GMainLoop * mainloop = NULL;
+static gboolean active = TRUE;
+
+static void
+activate_clicked_cb (GtkWidget *widget, gpointer data)
+{
+ AppIndicator * ci = APP_INDICATOR(data);
+
+ if (active) {
+ app_indicator_set_status (ci, APP_INDICATOR_STATUS_ATTENTION);
+ gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "I'm okay now");
+ active = FALSE;
+ } else {
+ app_indicator_set_status (ci, APP_INDICATOR_STATUS_ACTIVE);
+ gtk_menu_item_set_label(GTK_MENU_ITEM(widget), "Get Attention");
+ active = TRUE;
+ }
+
+}
static void
item_clicked_cb (GtkWidget *widget, gpointer data)
@@ -99,6 +117,12 @@ main (int argc, char ** argv)
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
gtk_widget_show(item);
+ item = gtk_menu_item_new_with_label ("Get Attention");
+ g_signal_connect (item, "activate",
+ G_CALLBACK (activate_clicked_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);