summaryrefslogtreecommitdiff
path: root/mktrayicon.c
diff options
context:
space:
mode:
authorJon Gjengset <jon@thesquareplanet.com>2019-10-16 12:44:08 -0400
committerGitHub <noreply@github.com>2019-10-16 12:44:08 -0400
commiteecb095076a89f92dfdc203ec474ceac5d85d225 (patch)
tree335b6a58653ca6a438de6b35adcd3dd772fb00e1 /mktrayicon.c
parentAdd examples directory (diff)
parentUpdate README.md (diff)
downloadmktrayicon-eecb095076a89f92dfdc203ec474ceac5d85d225.tar.gz
mktrayicon-eecb095076a89f92dfdc203ec474ceac5d85d225.tar.bz2
mktrayicon-eecb095076a89f92dfdc203ec474ceac5d85d225.zip
Merge pull request #3 from bdantas/handle-custom-icons
add handling for custom icons
Diffstat (limited to 'mktrayicon.c')
-rw-r--r--mktrayicon.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/mktrayicon.c b/mktrayicon.c
index f4deb10..d793c89 100644
--- a/mktrayicon.c
+++ b/mktrayicon.c
@@ -55,7 +55,14 @@ gboolean set_icon(gpointer data)
#ifdef DEBUG
printf("Setting icon to '%s'\n", p);
#endif
- gtk_status_icon_set_from_icon_name(icon, p);
+ if (strchr(p, '/'))
+ {
+ gtk_status_icon_set_from_file(icon, p);
+ }
+ else
+ {
+ gtk_status_icon_set_from_icon_name(icon, p);
+ }
free(data);
return FALSE;
}
@@ -189,7 +196,14 @@ static GtkStatusIcon *create_tray_icon(char *start_icon)
{
GtkStatusIcon *tray_icon;
- tray_icon = gtk_status_icon_new_from_icon_name(start_icon);
+ if (strchr(start_icon, '/'))
+ {
+ tray_icon = gtk_status_icon_new_from_file(start_icon);
+ }
+ else
+ {
+ tray_icon = gtk_status_icon_new_from_icon_name(start_icon);
+ }
g_signal_connect(G_OBJECT(tray_icon), "activate", G_CALLBACK(tray_icon_on_click), NULL);
g_signal_connect(G_OBJECT(tray_icon), "popup-menu", G_CALLBACK(tray_icon_on_menu), NULL);
gtk_status_icon_set_visible(tray_icon, TRUE);
bgstack15