changeset 25858:1eacf60a73dd

Fix some theme manager assertion failures.
author Richard Laager <rlaager@wiktel.com>
date Mon, 01 Dec 2008 17:04:29 +0000
parents 01a66776064a
children 103d0d6ffab6
files libpurple/core.c libpurple/theme-loader.c libpurple/theme-manager.c libpurple/theme.c
diffstat 4 files changed, 16 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/core.c	Sun Nov 30 17:25:50 2008 +0000
+++ b/libpurple/core.c	Mon Dec 01 17:04:29 2008 +0000
@@ -174,6 +174,8 @@
 	purple_xfers_init();
 	purple_idle_init();
 	purple_smileys_init();
+	purple_theme_manager_init();
+	purple_theme_manager_refresh();
 	/*
 	 * Call this early on to try to auto-detect our IP address and
 	 * hopefully save some time later.
@@ -182,8 +184,6 @@
 
 	if (ops != NULL && ops->ui_init != NULL)
 		ops->ui_init();
-	
-	purple_theme_manager_refresh();
 
 	return TRUE;
 }
--- a/libpurple/theme-loader.c	Sun Nov 30 17:25:50 2008 +0000
+++ b/libpurple/theme-loader.c	Mon Dec 01 17:04:29 2008 +0000
@@ -20,7 +20,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  *
  */
-
+#include "internal.h"
 #include "theme-loader.h"
 
 #define PURPLE_THEME_LOADER_GET_PRIVATE(PurpleThemeLoader) \
--- a/libpurple/theme-manager.c	Sun Nov 30 17:25:50 2008 +0000
+++ b/libpurple/theme-manager.c	Mon Dec 01 17:04:29 2008 +0000
@@ -20,9 +20,10 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  *
  */
-
+#include <glib.h>
 #include <string.h>
 
+#include "internal.h"
 #include "theme-manager.h"
 #include "util.h"
 
@@ -67,8 +68,8 @@
 static gchar *
 purple_theme_manager_make_key(const gchar *name, const gchar *type)
 {
-	g_return_val_if_fail(name && strlen(name), NULL);
-	g_return_val_if_fail(type && strlen(type), NULL);		
+	g_return_val_if_fail(name && *name, NULL);
+	g_return_val_if_fail(type && *type, NULL);		
 	return g_strconcat(type, "/", name, NULL);
 }
 
@@ -109,12 +110,13 @@
 
 	rdir = g_dir_open(root, 0, NULL);
 
-	g_return_if_fail(rdir);
+	if (!rdir)
+		return;
 
 	/* Parses directory by root/name/purple/type */
 	while((name = g_dir_read_name(rdir))) {
 		purple_dir = g_build_filename(root, name, "purple", NULL);
-		tdir =  g_dir_open(purple_dir, 0, NULL);
+		tdir = g_dir_open(purple_dir, 0, NULL);
 	
 		if(!tdir) {
 			g_free(purple_dir);
@@ -150,9 +152,9 @@
 purple_theme_manager_init(void)
 {
 	theme_table = g_hash_table_new_full(g_str_hash,
-               	                             g_str_equal,
-               	                             g_free,
-               	                             g_object_unref);
+	       	                             g_str_equal,
+	       	                             g_free,
+	       	                             g_object_unref);
 }
 
 void 
--- a/libpurple/theme.c	Sun Nov 30 17:25:50 2008 +0000
+++ b/libpurple/theme.c	Mon Dec 01 17:04:29 2008 +0000
@@ -20,12 +20,13 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
  *
  */
+#include <glib.h>
+#include <string.h>
 
+#include "internal.h"
 #include "theme.h"
 #include "util.h"
 
-#include <string.h>
-
 #define PURPLE_THEME_GET_PRIVATE(PurpleTheme) \
 	((PurpleThemePrivate *) ((PurpleTheme)->priv))