changeset 23474:331a7a69d955

Changed the theme_manager_init function to do less, makes it cleaner and faster (won't have to build 2+ times)
author Justin Rodriguez <ffdragon@soc.pidgin.im>
date Sun, 06 Jul 2008 05:57:26 +0000
parents 60d3ba8c9047
children 1242a922a4bc
files libpurple/core.c libpurple/sound.c libpurple/theme-manager.c libpurple/theme-manager.h
diffstat 4 files changed, 16 insertions(+), 29 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/core.c	Mon Jun 30 23:12:54 2008 +0000
+++ b/libpurple/core.c	Sun Jul 06 05:57:26 2008 +0000
@@ -143,13 +143,13 @@
 
 	purple_plugins_probe(G_MODULE_SUFFIX);
 
+	purple_theme_manager_init();
 	/* The buddy icon code uses the imgstore, so init it early. */
 	purple_imgstore_init();
 
 	/* Accounts use status, buddy icons and connection signals, so
 	 * initialize these before accounts
 	 */
-	purple_theme_manager_init(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL), NULL);
 	purple_status_init();
 	purple_buddy_icons_init();
 	purple_connections_init();
@@ -172,7 +172,6 @@
 	purple_xfers_init();
 	purple_idle_init();
 	purple_smileys_init();
-		
 	/*
 	 * Call this early on to try to auto-detect our IP address and
 	 * hopefully save some time later.
@@ -182,6 +181,7 @@
 	if (ops != NULL && ops->ui_init != NULL)
 		ops->ui_init();
 	
+	purple_theme_manager_refresh();
 
 	return TRUE;
 }
--- a/libpurple/sound.c	Mon Jun 30 23:12:54 2008 +0000
+++ b/libpurple/sound.c	Sun Jul 06 05:57:26 2008 +0000
@@ -25,6 +25,8 @@
 #include "blist.h"
 #include "prefs.h"
 #include "sound.h"
+#include "sound-loader.h"
+#include "theme-manager.h"
 
 static PurpleSoundUiOps *sound_ui_ops = NULL;
 
@@ -134,6 +136,8 @@
 	purple_prefs_add_none("/purple/sound");
 	purple_prefs_add_int("/purple/sound/while_status", STATUS_AVAILABLE);
 	memset(last_played, 0, sizeof(last_played));
+
+	purple_theme_manager_register_type(g_object_new(PURPLE_TYPE_SOUND_THEME_LOADER, "type", "sound", NULL));
 }
 
 void
--- a/libpurple/theme-manager.c	Mon Jun 30 23:12:54 2008 +0000
+++ b/libpurple/theme-manager.c	Sun Jul 06 05:57:26 2008 +0000
@@ -142,25 +142,12 @@
  *****************************************************************************/
 
 void
-purple_theme_manager_init (PurpleThemeLoader *loader1, ...)
+purple_theme_manager_init (void)
 {
-	va_list args;
-	PurpleThemeLoader *loader;
-
-	/*g_return_if_fail(theme_table != NULL);*/
-
 	theme_table = g_hash_table_new_full (g_str_hash,
                	                             g_str_equal,
                	                             g_free,
                	                             g_object_unref);
-
-	va_start(args, loader1);
-	for (loader = loader1; loader != NULL; loader = va_arg(args, PurpleThemeLoader *))
-		purple_theme_manager_register_type(loader);
-	va_end(args);
-
-	/* TODO: add themes properly */
-	purple_theme_manager_build_dir("/usr/share/themes");
 }
 
 void 
@@ -170,7 +157,7 @@
                 	             (GHRFunc) purple_theme_manager_is_theme,
                 	             NULL);	
 	
-	/* TODO: this also needs to be fixed the same as new */
+	/* TODO: add correct directories to parse */
 	purple_theme_manager_build_dir("/usr/share/themes");
 
 }
@@ -200,7 +187,7 @@
 void
 purple_theme_manager_unregister_type(PurpleThemeLoader *loader)
 {
-	gchar *type;
+	const gchar *type;
 
 	g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
 
@@ -215,8 +202,6 @@
                 	                     (GHRFunc) purple_theme_manager_is_theme_type,
                 	                     type);		
 	}/* only free if given registered loader */
-
-	g_free(type);
 }
 
 PurpleTheme *
--- a/libpurple/theme-manager.h	Mon Jun 30 23:12:54 2008 +0000
+++ b/libpurple/theme-manager.h	Sun Jul 06 05:57:26 2008 +0000
@@ -63,11 +63,14 @@
 GType purple_theme_manager_get_type (void);
 
 /**
- * Initalizes the manager then add the loaders to the theme manager 
- * and builds with the given loaders 
- * @param 	the loaders to build with 
+ * Initalizes the theme manager
  */
-void purple_theme_manager_init (PurpleThemeLoader *loader1, ...);
+void purple_theme_manager_init (void);
+
+/**
+ * Uninitalizes the manager then frees all the themes an loaders it is responsible for 
+ */
+void purple_theme_manager_uninit (void);
 
 /**
  * Rebuilds all the themes in the theme manager
@@ -76,11 +79,6 @@
 void purple_theme_manager_refresh(void);
 
 /**
- * Uninitalizes the manager then frees all the themes an loaders it is responsible for 
- */
-void purple_theme_manager_uninit (void);
-
-/**
  * Finds the PurpleTheme object stored by the theme manager
  * 
  * @param name		the name of the PurpleTheme