about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorDavid <petrodavi@gmail.com>2016-03-09 20:09:31 +0100
committerDavid <petrodavi@gmail.com>2016-03-09 20:09:31 +0100
commit4abdad03ecd3680f17dcccfe3285b14989f758df (patch)
treec0182bbeaf8a01290a2570cf41beefb22781cb3b
parent898be1244a00feeb9c7c9ee4bf233cc0a43711a1 (diff)
downloadprofani-tty-4abdad03ecd3680f17dcccfe3285b14989f758df.tar.gz
Fix icons when installed in share... it is working now!
-rw-r--r--src/tray.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/tray.c b/src/tray.c
index c02b3dc7..999c9446 100644
--- a/src/tray.c
+++ b/src/tray.c
@@ -49,11 +49,22 @@ static guint timer;
 static gchar*
 _get_icons_dir(void)
 {
+    GString *icons_dir =  NULL;
+
+#ifdef ICONS_PATH
+
+    icons_dir = g_string_new(ICONS_PATH);
+
+#else
+
     gchar *xdg_config = xdg_get_config_home();
-    GString *icons_dir = g_string_new(xdg_config);
+    icons_dir = g_string_new(xdg_config);
     g_free(xdg_config);
     g_string_append(icons_dir, "/profanity/icons");
-    return g_string_free(icons_dir, true);
+
+#endif /* ICONS_PATH */
+
+    return g_string_free(icons_dir, false);
 }
 
 gboolean tray_change_icon(gpointer data)
@@ -75,15 +86,15 @@ gboolean tray_change_icon(gpointer data)
 
 void create_tray(void)
 {
-    gchar *icons_dir = _get_icons_dir();
-    icon_filename = g_string_new(icons_dir);
-    icon_msg_filename = g_string_new(icons_dir);
+    gchar *icons_dir_ret = _get_icons_dir();
+    icon_filename = g_string_new(icons_dir_ret);
+    icon_msg_filename = g_string_new(icons_dir_ret);
     g_string_append(icon_filename, "/proIcon.png");
     g_string_append(icon_msg_filename, "/proIconMsg.png");
     prof_tray = gtk_status_icon_new_from_file(icon_filename->str);
     shutting_down = false;
     timer = g_timeout_add(5000, tray_change_icon, NULL);
-    g_free(icons_dir);
+    g_free(icons_dir_ret);
 }
 
 void destroy_tray(void)