From 065c8aaa01f165a019c69bc54a12c1838475e2aa Mon Sep 17 00:00:00 2001 From: Jon Gjengset Date: Thu, 5 Sep 2013 19:51:05 +0100 Subject: Allow removal of tooltips --- mktrayicon.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/mktrayicon.c b/mktrayicon.c index d19f80a..76f056b 100644 --- a/mktrayicon.c +++ b/mktrayicon.c @@ -31,6 +31,12 @@ void tray_icon_on_menu(GtkStatusIcon *status_icon, guint button, gboolean set_tooltip(gpointer data) { char *p = (char*)data; + if (*p == '\0') { + printf("Removing tooltip\n"); + gtk_status_icon_set_has_tooltip(icon, FALSE); + return FALSE; + } + printf("Setting tooltip to '%s'\n", p); gtk_status_icon_set_tooltip_text(icon, p); return FALSE; @@ -93,6 +99,9 @@ void *watch_fifo(void *argv) /* only read from this if you *know* there are more arguments */ param = buf + 2; + if (len < 3) { + *param = '\0'; + } switch (*buf) { case 'q': @@ -116,7 +125,7 @@ void *watch_fifo(void *argv) onclick = NULL; } - if (len < 3) { + if (*param == '\0') { printf("Removing onclick handler\n"); break; } -- cgit