2009-01-09 [colin] 3.7.0cvs19
authorColin Leroy <colin@colino.net>
Fri, 9 Jan 2009 08:02:05 +0000 (08:02 +0000)
committerColin Leroy <colin@colino.net>
Fri, 9 Jan 2009 08:02:05 +0000 (08:02 +0000)
* src/prefs_themes.c
* src/stock_pixmap.c
* src/stock_pixmap.h
* src/common/utils.c
* src/common/utils.h
Win32: Fix bug 1813, 'Installing Theme Creates Error'

ChangeLog
PATCHSETS
configure.ac
src/common/utils.c
src/common/utils.h
src/prefs_themes.c
src/stock_pixmap.c
src/stock_pixmap.h

index e7fbb211dc34f56835e7c77731e0fd19579db6b4..87e4980361b50da5ca5bec84ed8768c14abcc47d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-01-09 [colin]     3.7.0cvs19
+
+       * src/prefs_themes.c
+       * src/stock_pixmap.c
+       * src/stock_pixmap.h
+       * src/common/utils.c
+       * src/common/utils.h
+               Win32: Fix bug 1813, 'Installing Theme Creates Error'
+
 2009-01-08 [colin]     3.7.0cvs18
 
        * src/mimeview.c
index 9b0e02f47427b361aac33e9c098730ca5951e810..5b6e7fc0c55f24678ef440edd6016241346f6638 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.23 -r 1.1.2.24 src/plugins/pgpcore/select-keys.c;  ) > 3.7.0cvs16.patchset
 ( cvs diff -u -r 1.12.2.25 -r 1.12.2.26 src/html.c;  ) > 3.7.0cvs17.patchset
 ( cvs diff -u -r 1.83.2.151 -r 1.83.2.152 src/mimeview.c;  ) > 3.7.0cvs18.patchset
+( cvs diff -u -r 1.3.2.61 -r 1.3.2.62 src/prefs_themes.c;  cvs diff -u -r 1.25.2.62 -r 1.25.2.63 src/stock_pixmap.c;  cvs diff -u -r 1.18.2.39 -r 1.18.2.40 src/stock_pixmap.h;  cvs diff -u -r 1.36.2.160 -r 1.36.2.161 src/common/utils.c;  cvs diff -u -r 1.20.2.65 -r 1.20.2.66 src/common/utils.h;  ) > 3.7.0cvs19.patchset
index 6d362fbd030150f158405cc9c71bf09f14769949..a3bbd3aee310090531b6e557578ffb51a1b34e18 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=7
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=18
+EXTRA_VERSION=19
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 6c109888badb59219c7c9defeee64d15bd907781..4c421c69cecf49bd27fb683c103aa349a4ba82c2 100644 (file)
@@ -1996,6 +1996,21 @@ const gchar *get_plugin_dir(void)
 #endif
 }
 
+
+#ifdef G_OS_WIN32
+/* Return the default directory for Themes. */
+const gchar *get_themes_dir(void)
+{
+       static gchar *themes_dir = NULL;
+
+       if (!themes_dir)
+               themes_dir = g_strconcat(w32_get_module_dir(),
+                                        "\\share\\claws-mail\\themes",
+                                        NULL);
+       return themes_dir;
+}
+#endif
+
 const gchar *get_tmp_dir(void)
 {
        static gchar *tmp_dir = NULL;
index 73d679e9beb3faace5b6fb04ff5df2167b63c446..b7df76ba9d78fe6bd91e8c93564ca08b8131444a 100644 (file)
@@ -359,7 +359,8 @@ const gchar *get_locale_dir         (void);
 gchar *get_tmp_file                    (void);
 const gchar *get_domain_name           (void);
 #ifdef G_OS_WIN32
-const gchar *get_cert_file(void);
+const gchar *get_themes_dir             (void);
+const gchar *get_cert_file             (void);
 #endif
 /* file / directory handling */
 off_t get_file_size            (const gchar    *file);
index a8b67349a72590f163085b9d81685fcb5de3e2f5..c6fa47e7ce728e62ab3f92837d210fdda2bdf99d 100644 (file)
@@ -253,14 +253,19 @@ static void prefs_themes_foreach_file(const gchar *dirname, const FileFunc func,
 static gboolean prefs_themes_is_system_theme(const gchar *dirname)
 {
        gint len;
-       
+       gchar *system_theme_dir;
+       gboolean is_sys = FALSE;
+
        g_return_val_if_fail(dirname != NULL, FALSE);
 
-       len = strlen(PACKAGE_DATA_DIR);
-       if (strlen(dirname) > len && 0 == strncmp(dirname, PACKAGE_DATA_DIR, len))
-               return TRUE;
+       system_theme_dir = stock_pixmap_get_system_theme_dir_for_theme(NULL);
+       len = strlen(system_theme_dir);
+       if (strlen(dirname) > len && 0 == strncmp(dirname, system_theme_dir, len))
+               is_sys = TRUE;
        
-       return FALSE;
+       g_free(system_theme_dir);
+
+       return is_sys;
 }
 
 static void prefs_themes_set_themes_menu(GtkComboBox *combo, const ThemesData *tdata)
@@ -526,9 +531,8 @@ static void prefs_themes_btn_install_clicked_cb(GtkWidget *widget, gpointer data
                                 GTK_STOCK_NO, GTK_STOCK_YES, NULL);
                switch (val) {
                case G_ALERTALTERNATE:
-                       cinfo->dest = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
-                                                 PIXMAP_THEME_DIR, G_DIR_SEPARATOR_S, 
-                                                 themename, NULL);
+                       cinfo->dest = stock_pixmap_get_system_theme_dir_for_theme(
+                                               themename);
                        break;
                case G_ALERTDEFAULT:
                        break;
index 3640f615e1373f9b3d9a9e18e484422a07f11e70..b9e3fd7bdd674185147d61a7d1ad99bbbb012f1e 100644 (file)
@@ -527,6 +527,19 @@ static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname)
        closedir(dp);
 }
 
+gchar *stock_pixmap_get_system_theme_dir_for_theme(const gchar *theme)
+{
+       const gchar *sep = NULL;
+       if (theme && *theme)
+               sep = G_DIR_SEPARATOR_S;
+#ifndef G_OS_WIN32
+       return g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
+                          PIXMAP_THEME_DIR, sep, theme, NULL);
+#else
+       return g_strconcat(get_themes_dir(), sep, theme, NULL);
+#endif
+}
+
 GList *stock_pixmap_themes_list_new(void)
 {
        gchar *defaulttheme;
@@ -537,11 +550,9 @@ GList *stock_pixmap_themes_list_new(void)
        defaulttheme = g_strdup(DEFAULT_PIXMAP_THEME);
        userthemes   = g_strconcat(get_rc_dir(), G_DIR_SEPARATOR_S, 
                                   PIXMAP_THEME_DIR, NULL);
-       systemthemes = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S,
-                                  PIXMAP_THEME_DIR, NULL);
+       systemthemes = stock_pixmap_get_system_theme_dir_for_theme(NULL);
 
        list = g_list_append(list, defaulttheme);
-       
        stock_pixmap_find_themes_in_dir(&list, userthemes);
        stock_pixmap_find_themes_in_dir(&list, systemthemes);
 
index b9f0a3f597aa58086d5165960e0de3cb784f552a..bc46f4002136753a169bb0fb05190f4b82231d6b 100644 (file)
@@ -216,5 +216,6 @@ GtkWidget *stock_pixmap_widget_with_overlay (GtkWidget              *window,
                                             OverlayPosition     pos,
                                             gint                border_x,
                                             gint                border_y);
+gchar *stock_pixmap_get_system_theme_dir_for_theme(const gchar *theme);
 
 #endif /* __STOCK_PIXMAP_H__ */