changeset 23700:2d436084d866

fixes initialize icon theme bug by pre-loading the theme
author Justin Rodriguez <ffdragon@soc.pidgin.im>
date Sun, 10 Aug 2008 02:36:00 +0000
parents fc8047e1fa39
children b37ccfd1697b
files libpurple/theme-loader.c pidgin/gtkblist.c pidgin/gtkprefs.c pidgin/pidginstock.c
diffstat 4 files changed, 32 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/theme-loader.c	Fri Aug 08 21:26:12 2008 +0000
+++ b/libpurple/theme-loader.c	Sun Aug 10 02:36:00 2008 +0000
@@ -180,7 +180,7 @@
 }
 
 gpointer
-purple_theme_loader_build (PurpleThemeLoader *loader, const gchar *dir)
+purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir)
 {
 	return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir);
 }
--- a/pidgin/gtkblist.c	Fri Aug 08 21:26:12 2008 +0000
+++ b/pidgin/gtkblist.c	Sun Aug 10 02:36:00 2008 +0000
@@ -50,7 +50,6 @@
 #include "gtkdebug.h"
 #include "gtkdialogs.h"
 #include "gtkft.h"
-#include "gtkicon-theme.h"
 #include "gtklog.h"
 #include "gtkmenutray.h"
 #include "gtkpounce.h"
@@ -5304,7 +5303,6 @@
 			g_signal_connect(G_OBJECT(rend), "editing-canceled", G_CALLBACK(gtk_blist_renderer_editing_cancelled_cb), list);
 #endif
 			g_signal_connect(G_OBJECT(rend), "edited", G_CALLBACK(gtk_blist_renderer_edited_cb), list);
-			g_object_set(rend, "ypad", 0, "yalign", 0.5, NULL);
 #if GTK_CHECK_VERSION(2,6,0)
 			g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
 #endif
@@ -5392,8 +5390,6 @@
 
 	priv->current_theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), "blist"));
 
-	pidgin_stock_load_status_icon_theme(PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme"), "status-icon")));
-
 	gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
 	gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
 
--- a/pidgin/gtkprefs.c	Fri Aug 08 21:26:12 2008 +0000
+++ b/pidgin/gtkprefs.c	Sun Aug 10 02:36:00 2008 +0000
@@ -706,6 +706,9 @@
 	cell_rend = gtk_cell_renderer_text_new();
 	gtk_cell_layout_pack_start(GTK_CELL_LAYOUT (combo_box), cell_rend, FALSE);
 	gtk_cell_layout_set_attributes(GTK_CELL_LAYOUT(combo_box), cell_rend, "markup", 1, NULL);
+/*#if GTK_CHECK_VERSION(2,6,0)
+			g_object_set(cell_rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+#endif*/
 	
 	if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
 		do {
@@ -1189,7 +1192,7 @@
 	g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_blist_theme_cb, NULL);
 
 	/* Status Icon Themes */
-	combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme"));
+	combo_box = prefs_build_theme_combo_box(prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme"));
 	gtk_box_pack_start(GTK_BOX (vbox), combo_box, FALSE, FALSE, 0);
 	g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_status_icon_theme_cb, NULL);
 
--- a/pidgin/pidginstock.c	Fri Aug 08 21:26:12 2008 +0000
+++ b/pidgin/pidginstock.c	Sun Aug 10 02:36:00 2008 +0000
@@ -269,7 +269,7 @@
 	gchar *file_full = NULL;
 
 	if (theme != NULL) {
-		file = pidgin_icon_theme_get_file(theme, sized_icon.name);
+		file = pidgin_icon_theme_get_file(PIDGIN_ICON_THEME(theme), sized_icon.name);
 		dir = purple_theme_get_dir(PURPLE_THEME(theme));
 
 		if (rtl)
@@ -356,11 +356,16 @@
 	GtkIconSet *translucent = NULL;
 	GtkWidget *win;
 
-	if (theme != NULL)
-		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/icon/status/theme", 
-				purple_theme_get_name(PURPLE_THEME(theme)));
-	else purple_prefs_set_string(PIDGIN_PREFS_ROOT "/icon/status/theme", "");
-
+	if (theme != NULL) {
+		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", 
+				        purple_theme_get_name(PURPLE_THEME(theme)));
+		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", 
+				      purple_theme_get_dir(PURPLE_THEME(theme)));
+	}
+	else {
+		purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", "");
+		purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", "");
+	}
 	
 	icon_factory = gtk_icon_factory_new();
 
@@ -408,16 +413,19 @@
 	GtkIconFactory *icon_factory;
 	size_t i;
 	GtkWidget *win;
+	PidginIconThemeLoader *loader;
+	const gchar *path = NULL;
 
 	if (stock_initted)
 		return;
 
 	stock_initted = TRUE;
 
-	/* Setup the theme */
-	purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "status-icon", NULL));
-	purple_prefs_add_none(PIDGIN_PREFS_ROOT "/icon/status");
-	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/icon/status/theme", "");
+	/* Setup the status icon theme */
+	loader = g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "status-icon", NULL);
+	purple_theme_manager_register_type(PURPLE_THEME_LOADER(loader));
+	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/status/icon-theme", "");
+	purple_prefs_add_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", "");
 
 	/* Setup the icon factory. */
 	icon_factory = gtk_icon_factory_new();
@@ -497,7 +505,15 @@
 	gtk_widget_destroy(win);
 	g_object_unref(G_OBJECT(icon_factory));
 
-	pidgin_stock_load_status_icon_theme(NULL);
+	/* Pre-load Status icon theme*/
+	if (purple_prefs_get_string(PIDGIN_PREFS_ROOT "/icon/status/theme") && 
+	   (path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir"))) {
+		
+		PidginStatusIconTheme *theme = purple_theme_loader_build(PURPLE_THEME_LOADER(loader), path);
+		pidgin_stock_load_status_icon_theme(theme);
+		g_object_unref(G_OBJECT(theme));
+
+	} else pidgin_stock_load_status_icon_theme(NULL);
 
 	/* Register the stock items. */
 	gtk_stock_add_static(stock_items, G_N_ELEMENTS(stock_items));