soc.2008.themes: 9ff1c998: fixes initialize icon theme bug by pre-l...

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Sat Aug 9 22:40:44 EDT 2008


-----------------------------------------------------------------
Revision: 9ff1c99844d815e89ceeb09b3b506fef23ada867
Ancestor: f424012faa736393548c2892a144c24d19a678fa
Author: ffdragon at soc.pidgin.im
Date: 2008-08-10T02:36:00
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/9ff1c99844d815e89ceeb09b3b506fef23ada867

Modified files:
        libpurple/theme-loader.c pidgin/gtkblist.c pidgin/gtkprefs.c
        pidgin/pidginstock.c

ChangeLog: 

fixes initialize icon theme bug by pre-loading the theme

-------------- next part --------------
============================================================
--- libpurple/theme-loader.c	9dbdab64f13cc2dcc95abc56b37ff07e0545d178
+++ libpurple/theme-loader.c	7689fe1bae2ae95d315839167b54b8a4607051e4
@@ -180,7 +180,7 @@ gpointer
 }
 
 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);
 }
============================================================
--- pidgin/gtkblist.c	81db9a9e37000b5bab910cfe789648509d286f35
+++ pidgin/gtkblist.c	f2751026048d339a1f4f4aff0e7957f5cc732590
@@ -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 @@ pidgin_blist_build_layout(PurpleBuddyLis
 			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 @@ static void pidgin_blist_show(PurpleBudd
 
 	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);
 
============================================================
--- pidgin/gtkprefs.c	40762a60c43cd6dc073bc846869ad5c31fd8d5a4
+++ pidgin/gtkprefs.c	88b663a13af79d4029f5bd2eb6575c95e67df45c
@@ -706,6 +706,9 @@ prefs_build_theme_combo_box(GtkListStore
 	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 @@ interface_page(void)
 	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);
 
============================================================
--- pidgin/pidginstock.c	4822b4bbb8c5a30399bb9e329c1fb10d03c609ff
+++ pidgin/pidginstock.c	5a47e942bd5fd9b8c304a591381a7b0788bf4326
@@ -269,7 +269,7 @@ find_icon_file(PidginStatusIconTheme *th
 	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 @@ pidgin_stock_load_status_icon_theme(Pidg
 	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 @@ pidgin_stock_init(void)
 	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,8 +505,16 @@ pidgin_stock_init(void)
 	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));
 }


More information about the Commits mailing list