soc.2008.themes: f9bfc6b0: Changed the theme_manager_init function ...
ffdragon at soc.pidgin.im
ffdragon at soc.pidgin.im
Sun Jul 6 18:50:46 EDT 2008
-----------------------------------------------------------------
Revision: f9bfc6b0d4ca8328166185a3c9e27075ec6848b6
Ancestor: 79b99b1e33a8cd351a5874f6ab77560cb5315ff2
Author: ffdragon at soc.pidgin.im
Date: 2008-07-06T05:57:26
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/f9bfc6b0d4ca8328166185a3c9e27075ec6848b6
Modified files:
libpurple/core.c libpurple/sound.c libpurple/theme-manager.c
libpurple/theme-manager.h
ChangeLog:
Changed the theme_manager_init function to do less, makes it cleaner and faster (won't have to build
2+ times)
-------------- next part --------------
============================================================
--- libpurple/core.c afe679fd9db56229ca84533e2929afd9afd7e6c9
+++ libpurple/core.c cc1e678923fd5a58b8eec435ca31467b904654fa
@@ -143,13 +143,13 @@ purple_core_init(const char *ui)
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_core_init(const char *ui)
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 @@ purple_core_init(const char *ui)
if (ops != NULL && ops->ui_init != NULL)
ops->ui_init();
+ purple_theme_manager_refresh();
return TRUE;
}
============================================================
--- libpurple/sound.c ec972da5a428e915aefa7312cce3b2cf737c955a
+++ libpurple/sound.c 92030314bbc769bb3c9cb23e16f4171651c2e017
@@ -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_sound_init()
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
============================================================
--- libpurple/theme-manager.c 5f0cb37cf420ac9cbb506d1abe2a6fdf71364bfa
+++ libpurple/theme-manager.c 095e56d2f88c675655202a46dfac21125cfe34e7
@@ -142,25 +142,12 @@ void
*****************************************************************************/
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 @@ purple_theme_manager_refresh()
(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 @@ purple_theme_manager_unregister_type(Pur
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 @@ purple_theme_manager_unregister_type(Pur
(GHRFunc) purple_theme_manager_is_theme_type,
type);
}/* only free if given registered loader */
-
- g_free(type);
}
PurpleTheme *
============================================================
--- libpurple/theme-manager.h 20b160dd0fc5a67964f480510dc989ac4e9b72ad
+++ libpurple/theme-manager.h 63c24e158e56466ceb9c2c51505743fa1419b510
@@ -63,24 +63,22 @@ GType purple_theme_manager_get_type (voi
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
* (removes all current themes but keeps the added loaders)
*/
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
More information about the Commits
mailing list