soc.2008.themes: 0db205a2: start of blist themes (themes have no ef...

ffdragon at soc.pidgin.im ffdragon at soc.pidgin.im
Thu Jul 10 02:55:45 EDT 2008


-----------------------------------------------------------------
Revision: 0db205a258bf14814c7087fe47de444f60c1042a
Ancestor: f9bfc6b0d4ca8328166185a3c9e27075ec6848b6
Author: ffdragon at soc.pidgin.im
Date: 2008-07-10T06:49:45
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/0db205a258bf14814c7087fe47de444f60c1042a

Added files:
        pidgin/gtkblist-loader.c pidgin/gtkblist-loader.h
        pidgin/gtkblist-theme.c pidgin/gtkblist-theme.h
Modified files:
        pidgin/Makefile.am pidgin/gtkblist.c pidgin/gtkblist.h

ChangeLog: 

start of blist themes (themes have no effect on display)

-------------- next part --------------
============================================================
--- pidgin/gtkblist-loader.c	8143f4a98780f778350805b7d16e356a2ffb414b
+++ pidgin/gtkblist-loader.c	8143f4a98780f778350805b7d16e356a2ffb414b
@@ -0,0 +1,115 @@
+/*
+ * GTKBlistThemeLoader for Pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
+ */
+
+#include "gtkblist-loader.h"
+#include "gtkblist-theme.h"
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+/*****************************************************************************
+ * Sound Theme Builder                                                      
+ *****************************************************************************/
+
+static gpointer
+pidgin_buddy_list_loader_build(const gchar *dir)
+{
+	xmlnode *root_node, *sub_node;
+	gchar *filename, *filename_full, *data;
+	GDir *gdir;
+	PidginBuddyListTheme *theme;
+
+	/* Find the theme file */
+	gdir = g_dir_open(dir, 0, NULL);
+	g_return_val_if_fail(gdir != NULL, NULL);
+
+	while ((filename = g_strdup(g_dir_read_name(gdir))) != NULL && ! g_str_has_suffix(filename, ".xml"))
+		g_free(filename);
+	
+	g_return_val_if_fail(filename != NULL, NULL);
+	
+	/* Build the xml tree */
+	filename_full = g_build_filename(dir, filename, NULL);
+
+	root_node = xmlnode_from_file(dir, filename, "sound themes", "sound-loader");
+	g_return_val_if_fail(root_node != NULL, NULL);
+
+	/* Parse the tree */	
+	sub_node = xmlnode_get_child(root_node, "description");
+	data = xmlnode_get_data(sub_node);
+
+	theme = g_object_new(PIDGIN_TYPE_BUDDY_LIST_THEME,
+			    "type", "blist",
+			    "name", xmlnode_get_attrib(root_node, "name"),
+			    "author", xmlnode_get_attrib(root_node, "author"),
+			    "image", xmlnode_get_attrib(root_node, "image"),
+			    "directory", dir,
+			    "description", data, NULL);
+	
+	xmlnode_free(sub_node);
+
+	xmlnode_free(root_node);	
+	g_dir_close(gdir);
+	g_free(filename_full);
+	g_free(data);
+	return theme;
+}
+
+/******************************************************************************
+ * GObject Stuff                                                              
+ *****************************************************************************/
+
+static void
+pidgin_buddy_list_theme_loader_class_init (PidginBuddyListThemeLoaderClass *klass)
+{
+	PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
+
+	loader_klass->purple_theme_loader_build = pidgin_buddy_list_loader_build;
+}
+
+
+GType 
+pidgin_buddy_list_theme_loader_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (PidginBuddyListThemeLoaderClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      (GClassInitFunc)pidgin_buddy_list_theme_loader_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (PidginBuddyListThemeLoader),
+      0,      /* n_preallocs */
+      NULL,    /* instance_init */
+      NULL,   /* value table */
+    };
+    type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
+                                   "PidginBuddyListThemeLoader",
+                                   &info, 0);
+  }
+  return type;
+}
+
+
============================================================
--- pidgin/gtkblist-loader.h	db5e6148d29948e70b1078040015a84a237504cb
+++ pidgin/gtkblist-loader.h	db5e6148d29948e70b1078040015a84a237504cb
@@ -0,0 +1,71 @@
+/**
+ * @file gtkblist-loader.h  Pidgin Buddy List Theme Loader Class API
+ */
+
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#ifndef _PIDGIN_BUDDY_LIST_THEME_LOADER_H_
+#define _PIDGIN_BUDDY_LIST_THEME_LOADER_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include "theme-loader.h"
+
+/**
+ * A pidgin buddy list theme loader. extends PurpleThemeLoader (theme-loader.h)
+ * This is a class designed to build sound themes
+ *
+ * PidginBuddyListThemeLoader is a GObject.
+ */
+typedef struct _PidginBuddyListThemeLoader        PidginBuddyListThemeLoader;
+typedef struct _PidginBuddyListThemeLoaderClass   PidginBuddyListThemeLoaderClass;
+
+#define PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER			  (pidgin_buddy_list_theme_loader_get_type ())
+#define PIDGIN_BUDDY_LIST_THEME_LOADER(obj)			  (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER, PidginBuddyListThemeLoader))
+#define PIDGIN_BUDDY_LIST_THEME_LOADER_CLASS(klass)		  (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER, PidginBuddyListThemeLoaderClass))
+#define PIDGIN_IS_BUDDY_LIST_THEME_LOADER(obj)	  	  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER))
+#define PIDGIN_IS_BUDDY_LIST_THEME_LOADER_CLASS(klass) 	  (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER))
+#define PIDGIN_BUDDY_LIST_THEME_LOADER_GET_CLASS(obj)  	  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME_LOADER, PidginBuddyListThemeLoaderClass))
+
+struct _PidginBuddyListThemeLoader
+{
+	PurpleThemeLoader parent;
+};
+
+struct _PidginBuddyListThemeLoaderClass
+{
+	PurpleThemeLoaderClass parent_class;
+};
+
+/**************************************************************************/
+/** @name Buddy List Theme-Loader API                                     */
+/**************************************************************************/
+G_BEGIN_DECLS
+
+/**
+ * GObject foo.
+ * @internal.
+ */
+GType pidgin_buddy_list_theme_loader_get_type(void);
+
+G_END_DECLS
+#endif /* _PIDGIN_BUDDY_LIST_THEME_LOADER_H_ */
============================================================
--- pidgin/gtkblist-theme.c	ae28bdee7b375f4939c6a97a9bbd3235039f201a
+++ pidgin/gtkblist-theme.c	ae28bdee7b375f4939c6a97a9bbd3235039f201a
@@ -0,0 +1,149 @@
+/*
+ * Buddy List Themes for Pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ *
+ */
+
+#include "gtkblist-theme.h"
+
+#define PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(Gobject) \
+	((PidginBuddyListThemePrivate *) ((PIDGIN_BUDDY_LIST_THEME(Gobject))->priv))
+
+
+/******************************************************************************
+ * Structs
+ *****************************************************************************/
+typedef struct {
+	gchar *icon_theme;
+
+	/* Buddy list */
+	gchar *blist_color;
+	gdouble opacity;
+	
+	/* groups */
+	gchar *expanded_bgcolor;
+	gchar *expanded_tcolor;
+	gchar *expanded_font;
+
+	gchar *minimized_bgcolor;
+	gchar *minimized_tcolor;
+	gchar *minimized_font;
+
+	/* buddy */
+	gchar *buddy_bgcolor1;
+	gchar *buddy_bgcolor2;
+	
+	gint icon;
+	gint text;
+	gint status_icon;
+	gboolean status; 
+
+	gchar *online_font;
+	gchar *online_color;
+	
+	gchar *away_font;
+	gchar *away_color;
+
+	gchar *offline_font;
+	gchar *offline_color;
+
+	gchar *message_font;
+	gchar *message_color;
+
+	gchar *status_font;
+	gchar *status_color;
+
+} PidginBuddyListThemePrivate;
+
+/******************************************************************************
+ * Globals
+ *****************************************************************************/
+
+static GObjectClass *parent_class = NULL;
+
+/******************************************************************************
+ * Enums
+ *****************************************************************************/
+
+/******************************************************************************
+ * GObject Stuff                                                              
+ *****************************************************************************/
+
+static void
+pidgin_buddy_list_theme_init(GTypeInstance *instance,
+			gpointer klass)
+{
+	PidginBuddyListThemePrivate *priv;
+
+	(PIDGIN_BUDDY_LIST_THEME(instance))->priv = g_new0(PidginBuddyListThemePrivate, 1);
+
+	priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(instance);
+
+}
+
+static void 
+pidgin_buddy_list_theme_finalize (GObject *obj)
+{
+	PidginBuddyListThemePrivate *priv;
+
+	priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(obj);
+
+	parent_class->finalize (obj);
+}
+
+static void
+pidgin_buddy_list_theme_class_init (PidginBuddyListThemeClass *klass)
+{
+	GObjectClass *obj_class = G_OBJECT_CLASS(klass);
+
+	parent_class = g_type_class_peek_parent (klass);
+
+        obj_class->finalize = pidgin_buddy_list_theme_finalize;
+}
+
+GType 
+pidgin_buddy_list_theme_get_type (void)
+{
+  static GType type = 0;
+  if (type == 0) {
+    static const GTypeInfo info = {
+      sizeof (PidginBuddyListThemeClass),
+      NULL,   /* base_init */
+      NULL,   /* base_finalize */
+      (GClassInitFunc)pidgin_buddy_list_theme_class_init,   /* class_init */
+      NULL,   /* class_finalize */
+      NULL,   /* class_data */
+      sizeof (PidginBuddyListTheme),
+      0,      /* n_preallocs */
+      pidgin_buddy_list_theme_init,    /* instance_init */
+      NULL,   /* value table */
+    };
+    type = g_type_register_static (PURPLE_TYPE_THEME,
+                                   "PidginBuddyListTheme",
+                                   &info, 0);
+  }
+  return type;
+}
+
+
+/*****************************************************************************
+ * Public API functions                                                      
+ *****************************************************************************/
+
============================================================
--- pidgin/gtkblist-theme.h	06bde3bf86371952d182b962ab9f8dc6688396a9
+++ pidgin/gtkblist-theme.h	06bde3bf86371952d182b962ab9f8dc6688396a9
@@ -0,0 +1,75 @@
+/**
+ * @file gtkblist-theme.h GTK+ Buddy List Theme API
+ */
+
+/* pidgin
+ *
+ * Pidgin is the legal property of its developers, whose names are too numerous
+ * to list here.  Please refer to the COPYRIGHT file distributed with this
+ * source distribution.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
+ */
+
+#ifndef _PIDGIN_BUDDY_LIST_THEME_H_
+#define _PIDGIN_BUDDY_LIST_THEME_H_
+
+#include <glib.h>
+#include <glib-object.h>
+#include "theme.h"
+#include "sound.h"
+
+/**
+ * extends PurpleTheme (theme.h)
+ * A pidgin buddy list theme.
+ * This is an object for Purple to represent a sound theme.
+ *
+ * PidginBuddyListTheme is a PurpleTheme Object.
+ */
+typedef struct _PidginBuddyListTheme        PidginBuddyListTheme;
+typedef struct _PidginBuddyListThemeClass   PidginBuddyListThemeClass;
+
+#define PIDGIN_TYPE_BUDDY_LIST_THEME		  	(pidgin_buddy_list_theme_get_type ())
+#define PIDGIN_BUDDY_LIST_THEME(obj)		  	(G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME, PidginBuddyListTheme))
+#define PIDGIN_BUDDY_LIST_THEME_CLASS(klass)	  	(G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_BUDDY_LIST_THEME, PidginBuddyListThemeClass))
+#define PIDGIN_IS_BUDDY_LIST_THEME(obj)	  		(G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME))
+#define PIDGIN_IS_BUDDY_LIST_THEME_CLASS(klass) 	(G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_BUDDY_LIST_THEME))
+#define PIDGIN_BUDDY_LIST_THEME_GET_CLASS(obj)  	(G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_BUDDY_LIST_THEME, PidginBuddyListThemeClass))
+
+struct _PidginBuddyListTheme
+{
+	PurpleTheme parent;
+	gpointer priv;
+};
+
+struct _PidginBuddyListThemeClass
+{
+	PurpleThemeClass parent_class;
+};
+
+/**************************************************************************/
+/** @name Purple Sound Theme API                                          */
+/**************************************************************************/
+G_BEGIN_DECLS
+
+/**
+ * GObject foo.
+ * @internal.
+ */
+GType pidgin_buddy_list_theme_get_type(void);
+
+
+G_END_DECLS
+#endif /* _PIDGIN_BUDDY_LIST_THEME_H_ */
============================================================
--- pidgin/Makefile.am	dcb4b4e3b78d20b8574c563d56afd0f611594255
+++ pidgin/Makefile.am	0a3cdfe8269e71aa4e5a053bd1aa45c1da043025
@@ -78,6 +78,8 @@ pidgin_SOURCES = \
 	pidginstock.c \
 	gtkaccount.c \
 	gtkblist.c \
+	gtkblist-loader.c \
+	gtkblist-theme.c \
 	gtkcelllayout.c \
 	gtkcellrendererexpander.c \
 	gtkcellrendererprogress.c \
@@ -127,6 +129,8 @@ pidgin_headers = \
 	eggtrayicon.h \
 	gtkaccount.h \
 	gtkblist.h \
+	gtkblist-loader.h \
+	gtkblist-theme.h \
 	gtkcelllayout.h \
 	gtkcellrendererexpander.h \
 	gtkcellrendererprogress.h \
============================================================
--- pidgin/gtkblist.c	6d8b0c67ceb053487114b4efc8c004f703b9d0c2
+++ pidgin/gtkblist.c	7b7dca12ba9c24bfbe02117fe9779ef15dd14421
@@ -38,6 +38,8 @@
 #include "request.h"
 #include "signals.h"
 #include "pidginstock.h"
+#include "theme-loader.h"
+#include "theme-manager.h"
 #include "util.h"
 
 #include "gtkaccount.h"
@@ -121,6 +123,8 @@ typedef struct
 	 *  is showing; @c NULL otherwise.
 	 */
 	PidginMiniDialog *signed_on_elsewhere;
+
+	PidginBuddyListTheme *current_theme;
 } PidginBuddyListPrivate;
 
 #define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
@@ -5255,6 +5259,8 @@ static void pidgin_blist_show(PurpleBudd
 	gtkblist = PIDGIN_BLIST(list);
 	priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
 
+	priv->current_theme = PIDGIN_BUDDY_LIST_THEME(purple_theme_manager_find_theme(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"), "blist"));
+
 	gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
 	gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
 
@@ -5287,8 +5293,8 @@ static void pidgin_blist_show(PurpleBudd
 	gtk_item_factory_create_items(gtkblist->ift, sizeof(blist_menu) / sizeof(*blist_menu),
 								  blist_menu, NULL);
 	pidgin_load_accels();
-	g_signal_connect(G_OBJECT(accel_group), "accel-changed",
-														G_CALLBACK(pidgin_save_accels_cb), NULL);
+	g_signal_connect(G_OBJECT(accel_group), "accel-changed", G_CALLBACK(pidgin_save_accels_cb), NULL);
+
 	menu = gtk_item_factory_get_widget(gtkblist->ift, "<PurpleMain>");
 	gtkblist->menutray = pidgin_menu_tray_new();
 	gtk_menu_shell_append(GTK_MENU_SHELL(menu), gtkblist->menutray);
@@ -5438,11 +5444,13 @@ static void pidgin_blist_show(PurpleBudd
 
 	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(gtkblist->treeview), FALSE);
 
+	/* columns */
 	column = gtk_tree_view_column_new();
 	gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
 	gtk_tree_view_column_set_visible(column, FALSE);
 	gtk_tree_view_set_expander_column(GTK_TREE_VIEW(gtkblist->treeview), column);
 
+	/* group */
 	gtkblist->text_column = column = gtk_tree_view_column_new ();
 	rend = pidgin_cell_renderer_expander_new();
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
@@ -5455,6 +5463,7 @@ static void pidgin_blist_show(PurpleBudd
 #endif
 					    NULL);
 
+	/* contact */
 	rend = pidgin_cell_renderer_expander_new();
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
 	gtk_tree_view_column_set_attributes(column, rend,
@@ -5466,6 +5475,7 @@ static void pidgin_blist_show(PurpleBudd
 					    "visible", CONTACT_EXPANDER_VISIBLE_COLUMN,
 					    NULL);
 
+	/* status icons */
 	rend = gtk_cell_renderer_pixbuf_new();
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
 	gtk_tree_view_column_set_attributes(column, rend,
@@ -5477,14 +5487,15 @@ static void pidgin_blist_show(PurpleBudd
 					    NULL);
 	g_object_set(rend, "xalign", 0.0, "xpad", 6, "ypad", 0, NULL);
 
+	/* name */
 	gtkblist->text_rend = rend = gtk_cell_renderer_text_new();
 	gtk_tree_view_column_pack_start (column, rend, TRUE);
 	gtk_tree_view_column_set_attributes(column, rend,
 #if GTK_CHECK_VERSION(2,6,0)
-					    	    "cell-background-gdk", BGCOLOR_COLUMN,
+					    "cell-background-gdk", BGCOLOR_COLUMN,
 #endif
-										"markup", NAME_COLUMN,
-										NULL);
+					    "markup", NAME_COLUMN,
+					    NULL);
 #if GTK_CHECK_VERSION(2,6,0)
 	g_signal_connect(G_OBJECT(rend), "editing-started", G_CALLBACK(gtk_blist_renderer_editing_started_cb), NULL);
 	g_signal_connect(G_OBJECT(rend), "editing-canceled", G_CALLBACK(gtk_blist_renderer_editing_cancelled_cb), list);
@@ -5496,6 +5507,7 @@ static void pidgin_blist_show(PurpleBudd
 #endif
 	gtk_tree_view_append_column(GTK_TREE_VIEW(gtkblist->treeview), column);
 
+	/* idle */
 	rend = gtk_cell_renderer_text_new();
 	g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
@@ -5507,6 +5519,7 @@ static void pidgin_blist_show(PurpleBudd
 #endif
 					    NULL);
 
+	/* emblem */
 	rend = gtk_cell_renderer_pixbuf_new();
 	g_object_set(rend, "xalign", 1.0, "yalign", 0.5, "ypad", 0, "xpad", 3, NULL);
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
@@ -5516,6 +5529,7 @@ static void pidgin_blist_show(PurpleBudd
 #endif
 							  "visible", EMBLEM_VISIBLE_COLUMN, NULL);
 
+	/* protocol icon */
 	rend = gtk_cell_renderer_pixbuf_new();
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
 	gtk_tree_view_column_set_attributes(column, rend,
@@ -5527,6 +5541,7 @@ static void pidgin_blist_show(PurpleBudd
 					  NULL);
 	g_object_set(rend, "xalign", 0.0, "xpad", 3, "ypad", 0, NULL);
 
+	/* buddy icon */
 	rend = gtk_cell_renderer_pixbuf_new();
 	g_object_set(rend, "xalign", 1.0, "ypad", 0, NULL);
 	gtk_tree_view_column_pack_start(column, rend, FALSE);
@@ -5971,6 +5986,10 @@ static void pidgin_blist_update_group(Pu
 
 		bgcolor = gtkblist->treeview->style->bg[GTK_STATE_ACTIVE];
 
+/*		gdk_color_parse("red", &bgcolor);
+		gdk_colormap_alloc_color(gdk_colormap_get_system(), &bgcolor, TRUE, FALSE);
+g_print("\n\n%s\n\n", gdk_color_to_string(&bgcolor));*/
+
 		path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
 		expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(gtkblist->treeview), path);
 		gtk_tree_path_free(path);
@@ -5987,7 +6006,7 @@ static void pidgin_blist_update_group(Pu
 				   STATUS_ICON_COLUMN, NULL,
 				   NAME_COLUMN, title,
 				   NODE_COLUMN, gnode,
-	/*			   BGCOLOR_COLUMN, &bgcolor,     */
+				   BGCOLOR_COLUMN, &bgcolor,
 				   GROUP_EXPANDER_COLUMN, TRUE,
 				   GROUP_EXPANDER_VISIBLE_COLUMN, TRUE,
 				   CONTACT_EXPANDER_VISIBLE_COLUMN, FALSE,
@@ -7159,6 +7178,25 @@ static void buddy_signonoff_cb(PurpleBud
 			(GSourceFunc)buddy_signonoff_timeout_cb, buddy);
 }
 
+void 
+pidgin_blist_set_theme(PidginBuddyListTheme *theme)
+{
+	PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
+	
+	g_return_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme));	
+	
+	priv->current_theme = theme;
+}
+
+
+PidginBuddyListTheme *
+pidgin_blist_get_theme()
+{
+	PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);	
+	
+	return priv->current_theme;
+}
+
 void pidgin_blist_init(void)
 {
 	void *gtk_blist_handle = pidgin_blist_get_handle();
@@ -7184,6 +7222,7 @@ void pidgin_blist_init(void)
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/width", 250); /* Golden ratio, baby */
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/height", 405); /* Golden ratio, baby */
 	purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/tooltip_delay", 500);
+	purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
 
 	/* Register our signals */
 	purple_signal_register(gtk_blist_handle, "gtkblist-hiding",
============================================================
--- pidgin/gtkblist.h	1432074dfa3f5aab3563e5db7c1ee41e7e759fa9
+++ pidgin/gtkblist.h	8a062449a1d8a7e74bd90332d51fa559cf2d34a1
@@ -59,6 +59,7 @@ typedef enum {
 
 #include "pidgin.h"
 #include "blist.h"
+#include "gtkblist-theme.h"
 
 /**************************************************************************
  * @name Structures
@@ -250,7 +251,20 @@ void pidgin_blist_add_alert(GtkWidget *w
  */
 void pidgin_blist_add_alert(GtkWidget *widget);
 
+/**
+ * Sets the current theme for Pidgin to use
+ *
+ * @param theme	the new theme to use
+ */
+void pidgin_blist_set_theme(PidginBuddyListTheme *theme);
 
+/**
+ * Gets Pidgin's current buddy list theme
+ *
+ * @returns	the current theme 
+ */
+PidginBuddyListTheme *pidgin_blist_get_theme(void);
+
 /**************************************************************************
  * @name GTK+ Buddy List sorting functions
  **************************************************************************/


More information about the Commits mailing list