irssi-import / bugs.irssi.org

bugs.irssi.org archive
https://github.com/irssi/irssi/issues
0 stars 0 forks source link

Patch attached: allow themes to reside in ~/.irssi/themes/ #914

Open irssibot opened 10 years ago

irssibot commented 10 years ago

Greetings,

Armin

irssibot commented 10 years ago

0001-enhance-theme-lookup-locations-with-.irssi-themes.patch

From 6ea8f9b2a37954bbc9a47ce7ec726341fd27ac09 Mon Sep 17 00:00:00 2001
From: Armin Jenewein <armin@hinterhof.net>
Date: Sat, 5 Apr 2014 15:06:09 +0200
Subject: [PATCH] enhance theme lookup locations with ~/.irssi/themes/

---
 src/fe-common/core/themes.c |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index 7c50c28..c1fb63b 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -833,17 +833,21 @@ THEME_REC *theme_load(const char *setname)

    theme = theme_find(name);

-   /* check home dir */
-   fname = g_strdup_printf("%s/%s.theme", get_irssi_dir(), name);
+   /* check .irssi/themes/ */
+   fname = g_strdup_printf("%s/themes/%s.theme", get_irssi_dir(), name);
    if (stat(fname, &statbuf) != 0) {
-       /* check global config dir */
        g_free(fname);
-       fname = g_strdup_printf(THEMESDIR"/%s.theme", name);
+       /* check .irssi/ */
+       fname = g_strdup_printf("%s/%s.theme", get_irssi_dir(), name);
        if (stat(fname, &statbuf) != 0) {
-           /* theme not found */
            g_free(fname);
-           g_free(name);
-           return theme; /* use the one in memory if possible */
+           /* check global themes directory */
+           fname = g_strdup_printf(THEMESDIR"/%s.theme", name);
+           if (stat(fname, &statbuf) != 0) {
+               g_free(fname);
+               g_free(name);
+               return theme; /* use the one in memory if possible */
+           }
        }
    }

-- 
1.7.10.4