talons

Fork of Claws Mail https://www.claws-mail
Log | Files | Refs | README | LICENSE

commit 9a2f44800461f6260b7f60a3d90bf4d463bbd8c5
parent 78f760e6609821eadb529e0a0e909a528d21bd96
Author: Colin Leroy <colin@colino.net>
Date:   Fri,  9 Jan 2009 08:02:05 +0000

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'

Diffstat:
MChangeLog | 9+++++++++
MPATCHSETS | 1+
Mconfigure.ac | 2+-
Msrc/common/utils.c | 15+++++++++++++++
Msrc/common/utils.h | 3++-
Msrc/prefs_themes.c | 20++++++++++++--------
Msrc/stock_pixmap.c | 17++++++++++++++---
Msrc/stock_pixmap.h | 1+
8 files changed, 55 insertions(+), 13 deletions(-)

diff --git 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 diff --git a/PATCHSETS b/PATCHSETS @@ -3680,3 +3680,4 @@ ( 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 diff --git a/configure.ac b/configure.ac @@ -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= diff --git a/src/common/utils.c b/src/common/utils.c @@ -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; diff --git a/src/common/utils.h b/src/common/utils.h @@ -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); diff --git a/src/prefs_themes.c b/src/prefs_themes.c @@ -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; diff --git a/src/stock_pixmap.c b/src/stock_pixmap.c @@ -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); diff --git a/src/stock_pixmap.h b/src/stock_pixmap.h @@ -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__ */