comparison libpurple/theme-manager.c @ 25858:1eacf60a73dd

Fix some theme manager assertion failures.
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 Dec 2008 17:04:29 +0000
parents 0de17531e9f2
children 0c7b74fc558e
comparison
equal deleted inserted replaced
25857:01a66776064a 25858:1eacf60a73dd
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software 19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
21 * 21 *
22 */ 22 */
23 23 #include <glib.h>
24 #include <string.h> 24 #include <string.h>
25 25
26 #include "internal.h"
26 #include "theme-manager.h" 27 #include "theme-manager.h"
27 #include "util.h" 28 #include "util.h"
28 29
29 /****************************************************************************** 30 /******************************************************************************
30 * Globals 31 * Globals
65 *****************************************************************************/ 66 *****************************************************************************/
66 /* makes a key of <type> + '/' + <name> */ 67 /* makes a key of <type> + '/' + <name> */
67 static gchar * 68 static gchar *
68 purple_theme_manager_make_key(const gchar *name, const gchar *type) 69 purple_theme_manager_make_key(const gchar *name, const gchar *type)
69 { 70 {
70 g_return_val_if_fail(name && strlen(name), NULL); 71 g_return_val_if_fail(name && *name, NULL);
71 g_return_val_if_fail(type && strlen(type), NULL); 72 g_return_val_if_fail(type && *type, NULL);
72 return g_strconcat(type, "/", name, NULL); 73 return g_strconcat(type, "/", name, NULL);
73 } 74 }
74 75
75 /* returns TRUE if theme is of type "user_data" */ 76 /* returns TRUE if theme is of type "user_data" */
76 static gboolean 77 static gboolean
107 GDir *rdir, *tdir; 108 GDir *rdir, *tdir;
108 PurpleThemeLoader *loader; 109 PurpleThemeLoader *loader;
109 110
110 rdir = g_dir_open(root, 0, NULL); 111 rdir = g_dir_open(root, 0, NULL);
111 112
112 g_return_if_fail(rdir); 113 if (!rdir)
114 return;
113 115
114 /* Parses directory by root/name/purple/type */ 116 /* Parses directory by root/name/purple/type */
115 while((name = g_dir_read_name(rdir))) { 117 while((name = g_dir_read_name(rdir))) {
116 purple_dir = g_build_filename(root, name, "purple", NULL); 118 purple_dir = g_build_filename(root, name, "purple", NULL);
117 tdir = g_dir_open(purple_dir, 0, NULL); 119 tdir = g_dir_open(purple_dir, 0, NULL);
118 120
119 if(!tdir) { 121 if(!tdir) {
120 g_free(purple_dir); 122 g_free(purple_dir);
121 123
122 continue; 124 continue;
148 150
149 void 151 void
150 purple_theme_manager_init(void) 152 purple_theme_manager_init(void)
151 { 153 {
152 theme_table = g_hash_table_new_full(g_str_hash, 154 theme_table = g_hash_table_new_full(g_str_hash,
153 g_str_equal, 155 g_str_equal,
154 g_free, 156 g_free,
155 g_object_unref); 157 g_object_unref);
156 } 158 }
157 159
158 void 160 void
159 purple_theme_manager_refresh() 161 purple_theme_manager_refresh()
160 { 162 {