soc.2008.themes: ba788154: restructured much of the loader and them...
ffdragon at soc.pidgin.im
ffdragon at soc.pidgin.im
Tue Jul 15 02:35:44 EDT 2008
-----------------------------------------------------------------
Revision: ba7881546c85ebb1c6df2def641cc938d2ab01c7
Ancestor: ce398169fc1ad2354bfb45377604aa178c196391
Author: ffdragon at soc.pidgin.im
Date: 2008-07-15T06:29:46
Branch: im.pidgin.soc.2008.themes
URL: http://d.pidgin.im/viewmtn/revision/info/ba7881546c85ebb1c6df2def641cc938d2ab01c7
Modified files:
libpurple/xmlnode.h pidgin/gtkblist-loader.c
pidgin/gtkblist-loader.h pidgin/gtkblist-theme.c
pidgin/gtkblist-theme.h pidgin/gtkblist.c pidgin/gtkblist.h
pidgin/gtkprefs.c
ChangeLog:
restructured much of the loader and themes for the buddy list, along with a basic trial of group background
color
-------------- next part --------------
============================================================
--- libpurple/xmlnode.h 82359d838b91847933034561dd626583d325dfa7
+++ libpurple/xmlnode.h 5278c3c3c551a6645c6b3234f760f39ff812c3ac
@@ -26,6 +26,8 @@
#ifndef _PURPLE_XMLNODE_H_
#define _PURPLE_XMLNODE_H_
+#include <glib.h>
+
#ifdef __cplusplus
extern "C" {
#endif
============================================================
--- pidgin/gtkblist-loader.c 96c7eb1fefa872697df3e4545b071696db4fc524
+++ pidgin/gtkblist-loader.c dd3759f92998bdf956d82f23903cdb37c30f1a91
@@ -21,6 +21,9 @@
*
*/
+#include <stdlib.h>
+
+#include "xmlnode.h"
#include "gtkblist-loader.h"
#include "gtkblist-theme.h"
@@ -32,11 +35,16 @@ static gpointer
*****************************************************************************/
static gpointer
-pidgin_buddy_list_loader_build(const gchar *dir)
+pidgin_blist_loader_build(const gchar *dir)
{
xmlnode *root_node, *sub_node, *sub_sub_node;
gchar *filename, *filename_full, *data;
- const gchar *icon_theme, *bgcolor, *expanded_bgcolor, *minimized_bgcolor, *buddy_bgcolor1, *buddy_bgcolor2;
+ const gchar *icon_theme;
+ GdkColor *bgcolor = NULL,
+ *expanded_bgcolor = NULL,
+ *minimized_bgcolor = NULL,
+ *buddy_bgcolor1 = NULL,
+ *buddy_bgcolor2 = NULL;
font_color_pair *expanded = g_new0(font_color_pair, 1),
*minimized = g_new0(font_color_pair, 1),
*online = g_new0(font_color_pair, 1),
@@ -47,7 +55,7 @@ pidgin_buddy_list_loader_build(const gch
gdouble transparency;
blist_layout *layout = g_new0(blist_layout, 1);
GDir *gdir;
- PidginBuddyListTheme *theme;
+ PidginBlistTheme *theme;
/* Find the theme file */
gdir = g_dir_open(dir, 0, NULL);
@@ -68,26 +76,32 @@ pidgin_buddy_list_loader_build(const gch
sub_node = xmlnode_get_child(root_node, "description");
data = xmlnode_get_data(sub_node);
- /* <inon_theme> */
+ /* <icon_theme> */
sub_node = xmlnode_get_child(root_node, "icon_theme");
icon_theme = xmlnode_get_attrib(sub_node, "name");
- /* <buddy_list> */
- sub_node = xmlnode_get_child(root_node, "buddy_list");
- bgcolor = xmlnode_get_attrib(sub_node, "color");
+ /* <blist> */
+ sub_node = xmlnode_get_child(root_node, "blist");
transparency = atof(xmlnode_get_attrib(sub_node, "transparency"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_node, "color"), bgcolor))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE);
+
/* <groups> */
sub_node = xmlnode_get_child(root_node, "groups");
sub_sub_node = xmlnode_get_child(root_node, "expanded");
expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- expanded->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
- expanded_bgcolor = g_strdup(xmlnode_get_attrib(sub_sub_node, "background"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), expanded->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded->color, FALSE, TRUE);
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "background"), expanded_bgcolor))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "minimized");
minimized->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- minimized->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
- minimized_bgcolor = xmlnode_get_attrib(sub_sub_node, "background");
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), minimized->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), minimized->color, FALSE, TRUE);
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "background"), minimized_bgcolor))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), minimized_bgcolor, FALSE, TRUE);
/* <buddys> */
sub_node = xmlnode_get_child(root_node, "buddys");
@@ -100,31 +114,38 @@ pidgin_buddy_list_loader_build(const gch
layout->show_status = (gboolean) atoi(xmlnode_get_attrib(sub_sub_node, "status_icon"));
sub_sub_node = xmlnode_get_child(root_node, "background");
- buddy_bgcolor1 = xmlnode_get_attrib(sub_sub_node, "color1");
- buddy_bgcolor2 = xmlnode_get_attrib(sub_sub_node, "color2");
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color1"), buddy_bgcolor1))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), buddy_bgcolor1, FALSE, TRUE);
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color2"), buddy_bgcolor2))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), buddy_bgcolor2, FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "online_text");
online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- online->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), (online->color)))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), (online->color), FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "away_text");
away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- away->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), away->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), away->color, FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "offline_text");
offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- offline->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), offline->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), offline->color, FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "message_text");
message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- message->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), message->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), message->color, FALSE, TRUE);
sub_sub_node = xmlnode_get_child(root_node, "status_text");
status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font"));
- status->color = g_strdup(xmlnode_get_attrib(sub_sub_node, "color"));
+ if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), status->color))
+ gdk_colormap_alloc_color(gdk_colormap_get_system(), status->color, FALSE, TRUE);
/* the new theme */
- theme = g_object_new(PIDGIN_TYPE_BUDDY_LIST_THEME,
+ theme = g_object_new(PIDGIN_TYPE_BLIST_THEME,
"type", "blist",
"name", xmlnode_get_attrib(root_node, "name"),
"author", xmlnode_get_attrib(root_node, "author"),
@@ -161,33 +182,33 @@ static void
*****************************************************************************/
static void
-pidgin_buddy_list_theme_loader_class_init (PidginBuddyListThemeLoaderClass *klass)
+pidgin_blist_theme_loader_class_init (PidginBlistThemeLoaderClass *klass)
{
PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass);
- loader_klass->purple_theme_loader_build = pidgin_buddy_list_loader_build;
+ loader_klass->purple_theme_loader_build = pidgin_blist_loader_build;
}
GType
-pidgin_buddy_list_theme_loader_get_type (void)
+pidgin_blist_theme_loader_get_type (void)
{
static GType type = 0;
if (type == 0) {
static const GTypeInfo info = {
- sizeof (PidginBuddyListThemeLoaderClass),
+ sizeof (PidginBlistThemeLoaderClass),
NULL, /* base_init */
NULL, /* base_finalize */
- (GClassInitFunc)pidgin_buddy_list_theme_loader_class_init, /* class_init */
+ (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
- sizeof (PidginBuddyListThemeLoader),
+ sizeof (PidginBlistThemeLoader),
0, /* n_preallocs */
NULL, /* instance_init */
NULL, /* value table */
};
type = g_type_register_static (PURPLE_TYPE_THEME_LOADER,
- "PidginBuddyListThemeLoader",
+ "PidginBlistThemeLoader",
&info, 0);
}
return type;
============================================================
--- pidgin/gtkblist-loader.h db5e6148d29948e70b1078040015a84a237504cb
+++ pidgin/gtkblist-loader.h c1c9c3d2b239d52d74d9644744ff0e84cee04ed7
@@ -23,8 +23,8 @@
* 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_
+#ifndef _PIDGIN_BLIST_THEME_LOADER_H_
+#define _PIDGIN_BLIST_THEME_LOADER_H_
#include <glib.h>
#include <glib-object.h>
@@ -34,24 +34,24 @@
* A pidgin buddy list theme loader. extends PurpleThemeLoader (theme-loader.h)
* This is a class designed to build sound themes
*
- * PidginBuddyListThemeLoader is a GObject.
+ * PidginBlistThemeLoader is a GObject.
*/
-typedef struct _PidginBuddyListThemeLoader PidginBuddyListThemeLoader;
-typedef struct _PidginBuddyListThemeLoaderClass PidginBuddyListThemeLoaderClass;
+typedef struct _PidginBlistThemeLoader PidginBlistThemeLoader;
+typedef struct _PidginBlistThemeLoaderClass PidginBlistThemeLoaderClass;
-#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))
+#define PIDGIN_TYPE_BLIST_THEME_LOADER (pidgin_blist_theme_loader_get_type ())
+#define PIDGIN_BLIST_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_BLIST_THEME_LOADER, PidginBlistThemeLoader))
+#define PIDGIN_BLIST_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_BLIST_THEME_LOADER, PidginBlistThemeLoaderClass))
+#define PIDGIN_IS_BLIST_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_BLIST_THEME_LOADER))
+#define PIDGIN_IS_BLIST_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_BLIST_THEME_LOADER))
+#define PIDGIN_BLIST_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_BLIST_THEME_LOADER, PidginBlistThemeLoaderClass))
-struct _PidginBuddyListThemeLoader
+struct _PidginBlistThemeLoader
{
PurpleThemeLoader parent;
};
-struct _PidginBuddyListThemeLoaderClass
+struct _PidginBlistThemeLoaderClass
{
PurpleThemeLoaderClass parent_class;
};
@@ -65,7 +65,7 @@ G_BEGIN_DECLS
* GObject foo.
* @internal.
*/
-GType pidgin_buddy_list_theme_loader_get_type(void);
+GType pidgin_blist_theme_loader_get_type(void);
G_END_DECLS
+#endif /* _PIDGIN_BLIST_THEME_LOADER_H_ */
-#endif /* _PIDGIN_BUDDY_LIST_THEME_LOADER_H_ */
============================================================
--- pidgin/gtkblist-theme.c 3a7a3c0c5857a42355be182f86bce6c5f5c45b3a
+++ pidgin/gtkblist-theme.c 896223af6f3cd1e837d0620b87a11a644c06e060
@@ -23,12 +23,11 @@
#include "gtkblist-theme.h"
-#define PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(Gobject) \
- ((PidginBuddyListThemePrivate *) ((PIDGIN_BUDDY_LIST_THEME(Gobject))->priv))
+#define PIDGIN_BLIST_THEME_GET_PRIVATE(Gobject) \
+ ((PidginBlistThemePrivate *) ((PIDGIN_BLIST_THEME(Gobject))->priv))
#define free_font_and_color(font_color_pair) \
g_free(font_color_pair->font); \
- g_free(font_color_pair->color); \
g_free(font_color_pair)
/******************************************************************************
* Structs
@@ -37,20 +36,20 @@ typedef struct {
gchar *icon_theme;
/* Buddy list */
- gchar *bgcolor;
+ GdkColor *bgcolor;
gdouble opacity;
blist_layout *layout;
/* groups */
- gchar *expanded_color;
+ GdkColor *expanded_color;
font_color_pair *expanded;
- gchar *minimized_color;
- font_color_pair *minimized;
+ GdkColor *collapsed_color;
+ font_color_pair *collapsed;
/* buddy */
- gchar *buddy_bgcolor1;
- gchar *buddy_bgcolor2;
+ GdkColor *buddy_bgcolor1;
+ GdkColor *buddy_bgcolor2;
font_color_pair *online;
font_color_pair *away;
@@ -58,7 +57,7 @@ typedef struct {
font_color_pair *message;
font_color_pair *status;
-} PidginBuddyListThemePrivate;
+} PidginBlistThemePrivate;
/******************************************************************************
* Globals
@@ -77,8 +76,8 @@ enum {
PROP_LAYOUT,
PROP_EXPANDED_COLOR,
PROP_EXPANDED_TEXT,
- PROP_MINIMIZED_COLOR,
- PROP_MINIMIZED_TEXT,
+ PROP_COLLAPSED_COLOR,
+ PROP_COLLAPSED_TEXT,
PROP_BGCOLOR1,
PROP_BGCOLOR2,
PROP_ONLINE,
@@ -92,18 +91,18 @@ static void
*****************************************************************************/
static void
-pidgin_buddy_list_theme_init(GTypeInstance *instance,
+pidgin_blist_theme_init(GTypeInstance *instance,
gpointer klass)
{
- (PIDGIN_BUDDY_LIST_THEME(instance))->priv = g_new0(PidginBuddyListThemePrivate, 1);
+ (PIDGIN_BLIST_THEME(instance))->priv = g_new0(PidginBlistThemePrivate, 1);
}
static void
-pidgin_buddy_list_theme_get_property(GObject *obj, guint param_id, GValue *value,
+pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value,
GParamSpec *psec)
{
- PidginBuddyListThemePrivate *priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(obj);
+ PidginBlistThemePrivate *priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj);
switch(param_id) {
case PROP_ICON_THEME:
@@ -119,22 +118,22 @@ pidgin_buddy_list_theme_get_property(GOb
g_value_set_pointer(value, priv->layout);
break;
case PROP_EXPANDED_COLOR:
- g_value_set_string(value, priv->expanded_color);
+ g_value_set_pointer(value, priv->expanded_color);
break;
case PROP_EXPANDED_TEXT:
g_value_set_pointer(value, priv->expanded);
break;
- case PROP_MINIMIZED_COLOR:
- g_value_set_string(value, priv->minimized_color);
+ case PROP_COLLAPSED_COLOR:
+ g_value_set_pointer(value, priv->collapsed_color);
break;
- case PROP_MINIMIZED_TEXT:
- g_value_set_pointer(value, priv->minimized);
+ case PROP_COLLAPSED_TEXT:
+ g_value_set_pointer(value, priv->collapsed);
break;
case PROP_BGCOLOR1:
- g_value_set_string(value, priv->buddy_bgcolor1);
+ g_value_set_pointer(value, priv->buddy_bgcolor1);
break;
case PROP_BGCOLOR2:
- g_value_set_string(value, priv->buddy_bgcolor2);
+ g_value_set_pointer(value, priv->buddy_bgcolor2);
break;
case PROP_ONLINE:
g_value_set_pointer(value, priv->online);
@@ -158,10 +157,10 @@ static void
}
static void
-pidgin_buddy_list_theme_set_property(GObject *obj, guint param_id, const GValue *value,
+pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value,
GParamSpec *psec)
{
- PidginBuddyListThemePrivate *priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(obj);
+ PidginBlistThemePrivate *priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj);
switch(param_id) {
case PROP_ICON_THEME:
@@ -169,8 +168,7 @@ pidgin_buddy_list_theme_set_property(GOb
priv->icon_theme = g_strdup(g_value_get_string(value));
break;
case PROP_BACKGROUND_COLOR:
- g_free(priv->bgcolor);
- priv->bgcolor = g_strdup(g_value_get_string(value));
+ priv->bgcolor = g_value_get_pointer(value);
break;
case PROP_OPACITY:
priv->opacity = g_value_get_double(value);
@@ -180,28 +178,24 @@ pidgin_buddy_list_theme_set_property(GOb
priv->layout = g_value_get_pointer(value);
break;
case PROP_EXPANDED_COLOR:
- g_free(priv->expanded_color);
- priv->expanded_color = g_strdup(g_value_get_string(value));
+ priv->expanded_color = g_value_get_pointer(value);
break;
case PROP_EXPANDED_TEXT:
free_font_and_color(priv->expanded);
priv->expanded = g_value_get_pointer(value);
break;
- case PROP_MINIMIZED_COLOR:
- g_free(priv->minimized_color);
- priv->minimized_color = g_strdup(g_value_get_string(value));
+ case PROP_COLLAPSED_COLOR:
+ priv->collapsed_color = g_value_get_pointer(value);
break;
- case PROP_MINIMIZED_TEXT:
- free_font_and_color(priv->minimized);
- priv->minimized = g_value_get_pointer(value);
+ case PROP_COLLAPSED_TEXT:
+ free_font_and_color(priv->collapsed);
+ priv->collapsed = g_value_get_pointer(value);
break;
case PROP_BGCOLOR1:
- g_free(priv->buddy_bgcolor1);
- priv->buddy_bgcolor1 = g_strdup(g_value_get_string(value));
+ priv->buddy_bgcolor1 = g_value_get_pointer(value);
break;
case PROP_BGCOLOR2:
- g_free(priv->buddy_bgcolor2);
- priv->buddy_bgcolor2 = g_strdup(g_value_get_string(value));
+ priv->buddy_bgcolor2 = g_value_get_pointer(value);
break;
case PROP_ONLINE:
free_font_and_color(priv->online);
@@ -229,27 +223,21 @@ static void
}
}
static void
-pidgin_buddy_list_theme_finalize (GObject *obj)
+pidgin_blist_theme_finalize (GObject *obj)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(obj);
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(obj);
/* Buddy List */
g_free(priv->icon_theme);
- g_free(priv->bgcolor);
g_free(priv->layout);
/* Group */
- g_free(priv->expanded_color);
free_font_and_color(priv->expanded);
- g_free(priv->minimized_color);
- free_font_and_color(priv->minimized);
+ free_font_and_color(priv->collapsed);
/* Buddy */
- g_free(priv->buddy_bgcolor1);
- g_free(priv->buddy_bgcolor2);
-
free_font_and_color(priv->online);
free_font_and_color(priv->away);
free_font_and_color(priv->offline);
@@ -262,16 +250,16 @@ static void
}
static void
-pidgin_buddy_list_theme_class_init (PidginBuddyListThemeClass *klass)
+pidgin_blist_theme_class_init (PidginBlistThemeClass *klass)
{
GObjectClass *obj_class = G_OBJECT_CLASS(klass);
GParamSpec *pspec;
parent_class = g_type_class_peek_parent (klass);
- obj_class->get_property = pidgin_buddy_list_theme_get_property;
- obj_class->set_property = pidgin_buddy_list_theme_set_property;
- obj_class->finalize = pidgin_buddy_list_theme_finalize;
+ obj_class->get_property = pidgin_blist_theme_get_property;
+ obj_class->set_property = pidgin_blist_theme_set_property;
+ obj_class->finalize = pidgin_blist_theme_finalize;
/* Icon Theme */
pspec = g_param_spec_string("icon-theme", "Icon Theme",
@@ -281,9 +269,8 @@ pidgin_buddy_list_theme_class_init (Pidg
g_object_class_install_property(obj_class, PROP_ICON_THEME, pspec);
/* Buddy List */
- pspec = g_param_spec_string("background-color", "Background Color",
+ pspec = g_param_spec_pointer("background-color", "Background Color",
"The background color for the buddy list",
- NULL,
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_BACKGROUND_COLOR, pspec);
@@ -301,9 +288,8 @@ pidgin_buddy_list_theme_class_init (Pidg
g_object_class_install_property(obj_class, PROP_LAYOUT, pspec);
/* Group */
- pspec = g_param_spec_string("expanded-color", "Expanded Background Color",
+ pspec = g_param_spec_pointer("expanded-color", "Expanded Background Color",
"The background color of an expanded group",
- NULL,
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_EXPANDED_COLOR, pspec);
@@ -312,27 +298,24 @@ pidgin_buddy_list_theme_class_init (Pidg
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_EXPANDED_TEXT, pspec);
- pspec = g_param_spec_string("minimized-color", "Minimized Background Color",
- "The background color of a minimized group",
- NULL,
+ pspec = g_param_spec_pointer("collapsed-color", "Collapsed Background Color",
+ "The background color of a collapsed group",
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_EXPANDED_COLOR, pspec);
- pspec = g_param_spec_pointer("minimized-text", "Minimized Text",
- "The text information for when a group is minimized",
+ pspec = g_param_spec_pointer("collapsed-text", "Collapsed Text",
+ "The text information for when a group is collapsed",
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_EXPANDED_TEXT, pspec);
/* Buddy */
- pspec = g_param_spec_string("buddy-bgcolor1", "Buddy Background Color 1",
+ pspec = g_param_spec_pointer("buddy-bgcolor1", "Buddy Background Color 1",
"The background color of a buddy",
- NULL,
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_BGCOLOR1, pspec);
- pspec = g_param_spec_string("buddy-bgcolor2", "Buddy Background Color 2",
+ pspec = g_param_spec_pointer("buddy-bgcolor2", "Buddy Background Color 2",
"The background color of a buddy",
- NULL,
G_PARAM_READWRITE);
g_object_class_install_property(obj_class, PROP_BGCOLOR2, pspec);
@@ -363,24 +346,24 @@ GType
}
GType
-pidgin_buddy_list_theme_get_type (void)
+pidgin_blist_theme_get_type (void)
{
static GType type = 0;
if (type == 0) {
static const GTypeInfo info = {
- sizeof (PidginBuddyListThemeClass),
+ sizeof (PidginBlistThemeClass),
NULL, /* base_init */
NULL, /* base_finalize */
- (GClassInitFunc)pidgin_buddy_list_theme_class_init, /* class_init */
+ (GClassInitFunc)pidgin_blist_theme_class_init, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
- sizeof (PidginBuddyListTheme),
+ sizeof (PidginBlistTheme),
0, /* n_preallocs */
- pidgin_buddy_list_theme_init, /* instance_init */
+ pidgin_blist_theme_init, /* instance_init */
NULL, /* value table */
};
type = g_type_register_static (PURPLE_TYPE_THEME,
- "PidginBuddyListTheme",
+ "PidginBlistTheme",
&info, 0);
}
return type;
@@ -392,169 +375,169 @@ const gchar *
*****************************************************************************/
const gchar *
-pidgin_buddy_list_theme_get_icon_theme(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->icon_theme;
}
gdouble
-pidgin_buddy_list_theme_get_opacity(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_opacity(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), 1.0);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), 1.0);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->opacity;
}
const blist_layout *
-pidgin_buddy_list_theme_get_layout(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_layout(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->layout;
}
-const gchar *
-pidgin_buddy_list_theme_get_expanded_background_color(PidginBuddyListTheme *theme)
+const GdkColor *
+pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->expanded_color;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_expanded_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->expanded;
}
-const gchar *
-pidgin_buddy_list_theme_get_minimized_background_color(PidginBuddyListTheme *theme)
+const GdkColor *
+pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
- return priv->minimized_color;
+ return priv->collapsed_color;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_minimized_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
- return priv->minimized;
+ return priv->collapsed;
}
-const gchar *
-pidgin_buddy_list_theme_get_buddy_color_1(PidginBuddyListTheme *theme)
+const GdkColor *
+pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->buddy_bgcolor1;
}
-const gchar *
-pidgin_buddy_list_theme_get_buddy_color_2(PidginBuddyListTheme *theme)
+const GdkColor *
+pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->buddy_bgcolor2;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_online_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->online;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_away_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->away;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_offline_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->offline;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_unread_message_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->message;
}
const font_color_pair *
-pidgin_buddy_list_theme_get_status_text_info(PidginBuddyListTheme *theme)
+pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme)
{
- PidginBuddyListThemePrivate *priv;
+ PidginBlistThemePrivate *priv;
- g_return_val_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme), NULL);
+ g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
- priv = PIDGIN_BUDDY_LIST_THEME_GET_PRIVATE(G_OBJECT(theme));
+ priv = PIDGIN_BLIST_THEME_GET_PRIVATE(G_OBJECT(theme));
return priv->status;
}
============================================================
--- pidgin/gtkblist-theme.h 1b5f1db78d7bde58e3a373f0563c8717bca36276
+++ pidgin/gtkblist-theme.h 106a3d8452ba10dcf6721361ef7b57f74138acb8
@@ -23,38 +23,39 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
*/
-#ifndef _PIDGIN_BUDDY_LIST_THEME_H_
-#define _PIDGIN_BUDDY_LIST_THEME_H_
+#ifndef _PIDGIN_BLIST_THEME_H_
+#define _PIDGIN_BLIST_THEME_H_
#include <glib.h>
#include <glib-object.h>
+#include <gtk/gtk.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.
+ * PidginBlistTheme is a PurpleTheme Object.
*/
-typedef struct _PidginBuddyListTheme PidginBuddyListTheme;
-typedef struct _PidginBuddyListThemeClass PidginBuddyListThemeClass;
+typedef struct _PidginBlistTheme PidginBlistTheme;
+typedef struct _PidginBlistThemeClass PidginBlistThemeClass;
-#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))
+#define PIDGIN_TYPE_BLIST_THEME (pidgin_blist_theme_get_type ())
+#define PIDGIN_BLIST_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_BLIST_THEME, PidginBlistTheme))
+#define PIDGIN_BLIST_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemeClass))
+#define PIDGIN_IS_BLIST_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_BLIST_THEME))
+#define PIDGIN_IS_BLIST_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_BLIST_THEME))
+#define PIDGIN_BLIST_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_BLIST_THEME, PidginBlistThemeClass))
-struct _PidginBuddyListTheme
+struct _PidginBlistTheme
{
PurpleTheme parent;
gpointer priv;
};
-struct _PidginBuddyListThemeClass
+struct _PidginBlistThemeClass
{
PurpleThemeClass parent_class;
};
@@ -62,7 +63,7 @@ typedef struct
typedef struct
{
gchar *font;
- gchar *color;
+ GdkColor *color;
} font_color_pair;
@@ -87,14 +88,14 @@ G_BEGIN_DECLS
* GObject foo.
* @internal.
*/
-GType pidgin_buddy_list_theme_get_type(void);
+GType pidgin_blist_theme_get_type(void);
/**
* Returns the icon theme to be used with the buddy list theme
*
* @returns the icon theme
*/
-const gchar *pidgin_buddy_list_theme_get_icon_theme(PidginBuddyListTheme *theme);
+const gchar *pidgin_blist_theme_get_icon_theme(PidginBlistTheme *theme);
/**
* Returns the opacity of the buddy list window
@@ -102,91 +103,91 @@ const gchar *pidgin_buddy_list_theme_get
*
* @returns the opacity
*/
-gdouble pidgin_buddy_list_theme_get_opacity(PidginBuddyListTheme *theme);
+gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme);
/**
* Returns the layout to be used with the buddy list
*
* @returns the buddy list layout
*/
-const blist_layout *pidgin_buddy_list_theme_get_layout(PidginBuddyListTheme *theme);
+const blist_layout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme);
/**
* Returns the background color to be used with expanded groups
*
* @returns a color
*/
-const gchar *pidgin_buddy_list_theme_get_expanded_background_color(PidginBuddyListTheme *theme);
+const GdkColor *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used with expanded groups
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_expanded_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme);
/**
- * Returns the background color to be used with minimized groups
+ * Returns the background color to be used with collapsed groups
*
* @returns a color
*/
-const gchar *pidgin_buddy_list_theme_get_minimized_background_color(PidginBuddyListTheme *theme);
+const GdkColor *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme);
/**
- * Returns the text font and color to be used with minimized groups
+ * Returns the text font and color to be used with collapsed groups
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_minimized_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme);
/**
* Returns the 1st color to be used for buddys
*
* @returns a color
*/
-const gchar *pidgin_buddy_list_theme_get_buddy_color_1(PidginBuddyListTheme *theme);
+const GdkColor *pidgin_blist_theme_get_buddy_color_1(PidginBlistTheme *theme);
/**
* Returns the 2nd color to be used for buddies
*
* @returns a color
*/
-const gchar *pidgin_buddy_list_theme_get_buddy_color_2(PidginBuddyListTheme *theme);
+const GdkColor *pidgin_blist_theme_get_buddy_color_2(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used for online buddies
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_online_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used for away and idle buddies
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_away_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used for offline buddies
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_offline_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used for buddies with unread messages
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_unread_message_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme);
/**
* Returns the text font and color to be used for a buddy's status message
*
* @returns a font and color pair
*/
-const font_color_pair *pidgin_buddy_list_theme_get_status_text_info(PidginBuddyListTheme *theme);
+const font_color_pair *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme);
G_END_DECLS
+#endif /* _PIDGIN_BLIST_THEME_H_ */
-#endif /* _PIDGIN_BUDDY_LIST_THEME_H_ */
============================================================
--- pidgin/gtkblist.c 16386879029019bd66491aa0e6054f6f0e324e91
+++ pidgin/gtkblist.c 846ba9d2ba70616bfcad364bdce02ee714fd7cac
@@ -60,6 +60,8 @@
#include "gtkstatusbox.h"
#include "gtkscrollbook.h"
#include "gtksmiley.h"
+#include "gtkblist-loader.h"
+#include "gtkblist-theme.h"
#include "gtkutils.h"
#include "pidgin/minidialog.h"
#include "pidgin/pidgintooltip.h"
@@ -124,7 +126,7 @@ typedef struct
*/
PidginMiniDialog *signed_on_elsewhere;
- PidginBuddyListTheme *current_theme;
+ PidginBlistTheme *current_theme;
} PidginBuddyListPrivate;
#define PIDGIN_BUDDY_LIST_GET_PRIVATE(list) \
@@ -5259,7 +5261,7 @@ 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"));
+ priv->current_theme = PIDGIN_BLIST_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);
@@ -5978,17 +5980,20 @@ static void pidgin_blist_update_group(Pu
GtkTreeIter iter;
GtkTreePath *path;
gboolean expanded;
- GdkColor bgcolor;
+ GdkColor *bgcolor;
GdkPixbuf *avatar = NULL;
+ PidginBlistTheme *theme;
if(!insert_node(list, gnode, &iter))
return;
- bgcolor = gtkblist->treeview->style->bg[GTK_STATE_ACTIVE];
+ theme = pidgin_blist_get_theme();
-/* 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));*/
+ if(theme == NULL)
+ bgcolor = &(gtkblist->treeview->style->bg[GTK_STATE_ACTIVE]);
+ else if(purple_blist_node_get_bool(gnode, "collapsed"))
+ bgcolor = (pidgin_blist_theme_get_collapsed_text_info(theme))->color;
+ else bgcolor = (pidgin_blist_theme_get_expanded_text_info(theme))->color;
path = gtk_tree_model_get_path(GTK_TREE_MODEL(gtkblist->treemodel), &iter);
expanded = gtk_tree_view_row_expanded(GTK_TREE_VIEW(gtkblist->treeview), path);
@@ -7179,19 +7184,21 @@ void
}
void
-pidgin_blist_set_theme(PidginBuddyListTheme *theme)
+pidgin_blist_set_theme(PidginBlistTheme *theme)
{
PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
- g_return_if_fail(PIDGIN_IS_BUDDY_LIST_THEME(theme));
+ g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme",
purple_theme_get_name(PURPLE_THEME(theme)));
priv->current_theme = theme;
+
+ pidgin_blist_refresh(purple_get_blist());
}
-PidginBuddyListTheme *
+PidginBlistTheme *
pidgin_blist_get_theme()
{
PidginBuddyListPrivate *priv = PIDGIN_BUDDY_LIST_GET_PRIVATE(gtkblist);
============================================================
--- pidgin/gtkblist.h 8a062449a1d8a7e74bd90332d51fa559cf2d34a1
+++ pidgin/gtkblist.h 6a35d2e32672c580550e3c1d746599057e0d7bc1
@@ -256,14 +256,14 @@ void pidgin_blist_add_alert(GtkWidget *w
*
* @param theme the new theme to use
*/
-void pidgin_blist_set_theme(PidginBuddyListTheme *theme);
+void pidgin_blist_set_theme(PidginBlistTheme *theme);
/**
* Gets Pidgin's current buddy list theme
*
* @returns the current theme
*/
-PidginBuddyListTheme *pidgin_blist_get_theme(void);
+PidginBlistTheme *pidgin_blist_get_theme(void);
/**************************************************************************
* @name GTK+ Buddy List sorting functions
============================================================
--- pidgin/gtkprefs.c 88cb0a1e69377c2c493c99c98a689d86ce452fdf
+++ pidgin/gtkprefs.c 319c99cf3ba539df81e795b28a017b86c8370c5f
@@ -74,6 +74,9 @@ static GtkTreeIter prefs_sound_iter;
static gboolean prefs_themes_unsorted = TRUE;
static GtkListStore *prefs_sound_themes;
static GtkTreeIter prefs_sound_iter;
+static GtkListStore *prefs_blist_themes;
+static GtkTreeIter prefs_blist_iter;
+
/*
* PROTOTYPES
@@ -568,10 +571,11 @@ prefs_themes_sort(PurpleTheme *theme)
GdkPixbuf *pixbuf = NULL;
GtkTreeIter iter;
gchar *image_full;
+ const gchar *pref;
if (PURPLE_IS_SOUND_THEME(theme)){
- /* TODO: string leaks? */
- const gchar *pref = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
+
+ pref = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/theme");
image_full = purple_theme_get_image_full(theme);
if (image_full != NULL){
@@ -586,31 +590,56 @@ prefs_themes_sort(PurpleTheme *theme)
if (pixbuf != NULL)
gdk_pixbuf_unref(pixbuf);
- if (pref && strlen(pref) && !strcmp(purple_theme_get_name(theme), pref))
+ if (g_str_equal(purple_theme_get_name(theme), pref))
prefs_sound_iter = iter;
+ } else if (PIDGIN_IS_BLIST_THEME(theme)){
+
+ pref = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme");
+
+ image_full = purple_theme_get_image_full(theme);
+ if (image_full != NULL){
+ pixbuf = gdk_pixbuf_new_from_file(image_full, NULL);
+ g_free(image_full);
+ }
+ else pixbuf = NULL;
+
+ gtk_list_store_append (prefs_blist_themes, &iter);
+ gtk_list_store_set (prefs_blist_themes, &iter, 0, pixbuf, 1, purple_theme_get_name(theme), 2, theme, -1);
+
+ if (pixbuf != NULL)
+ gdk_pixbuf_unref(pixbuf);
+
+ if (g_str_equal(purple_theme_get_name(theme), pref))
+ prefs_blist_iter = iter;
+
}
}
/* init all the theme variables so that the themes can be sorted later and used by pref pages */
static void
-prefs_themes_init(void)
+prefs_themes_init()
{
GdkPixbuf *pixbuf = NULL;
gchar *filename;
- /* sound themes */
- prefs_sound_themes = gtk_list_store_new (3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
-
filename = g_build_filename(DATADIR, "icons", "hicolor", "16x16", "apps", "pidgin.png", NULL);
pixbuf= gdk_pixbuf_new_from_file(filename, NULL);
g_free(filename);
- gtk_list_store_append (prefs_sound_themes, &prefs_sound_iter);
+ /* sound themes */
+ prefs_sound_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
- gtk_list_store_set (prefs_sound_themes, &prefs_sound_iter, 0, pixbuf, 1, _("(Default)"), 2, NULL, -1);
+ gtk_list_store_append(prefs_sound_themes, &prefs_sound_iter);
+ gtk_list_store_set(prefs_sound_themes, &prefs_sound_iter, 0, pixbuf, 1, _("(Default)"), 2, NULL, -1);
- gdk_pixbuf_unref (pixbuf);
+ /* blist themes */
+ prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, PIDGIN_TYPE_BLIST_THEME);
+
+ gtk_list_store_append(prefs_blist_themes, &prefs_blist_iter);
+ gtk_list_store_set(prefs_blist_themes, &prefs_blist_iter, 0, pixbuf, 1, _("(Default)"), 2, NULL, -1);
+
+ gdk_pixbuf_unref(pixbuf);
}
/* sets the current sound theme */
@@ -628,7 +657,7 @@ prefs_set_sound_theme(GtkComboBox *combo
gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &prefs_sound_iter, 1, &theme_name, -1);
- if (strcmp(theme_name, "(Default)") == 0){
+ if (g_str_equal(theme_name, "(Default)")){
g_free(theme_name);
theme_name = g_strdup("");
}
@@ -1023,6 +1052,21 @@ keyboard_shortcuts(GtkWidget *page)
gtk_box_pack_start(GTK_BOX(vbox), checkbox, FALSE, FALSE, 0);
}
+/* sets the current buddy list theme */
+static void
+prefs_set_blist_theme(GtkComboBox *combo_box, gpointer user_data)
+{
+ PidginBlistTheme *theme;
+
+ g_return_if_fail(gtk_combo_box_get_active_iter(combo_box, &prefs_blist_iter));
+ gtk_tree_model_get(GTK_TREE_MODEL(prefs_sound_themes), &prefs_blist_iter, 1, &theme, -1);
+
+ pidgin_blist_set_theme(theme);
+
+ g_object_unref(theme);
+}
+
+
static GtkWidget *
interface_page(void)
{
@@ -1030,6 +1074,8 @@ interface_page(void)
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *label;
+ GtkWidget *combo_box;
+ GtkCellRenderer *cell_rend;
GtkSizeGroup *sg;
GList *names = NULL;
@@ -1038,6 +1084,23 @@ interface_page(void)
sg = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+ /* Buddy List Themes */
+ vbox = pidgin_make_frame(ret, _("Buddy List Theme"));
+ combo_box = gtk_combo_box_new_with_model(GTK_TREE_MODEL (prefs_blist_themes));
+ gtk_box_pack_start (GTK_BOX (vbox), combo_box, FALSE, FALSE, 0);
+
+ cell_rend = gtk_cell_renderer_pixbuf_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, "pixbuf", 0, NULL);
+
+ 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, "text", 1, NULL);
+
+ gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo_box), &prefs_blist_iter);
+ g_signal_connect(G_OBJECT(combo_box), "changed", (GCallback)prefs_set_blist_theme, NULL);
+
+ /* System Tray */
vbox = pidgin_make_frame(ret, _("System Tray Icon"));
label = pidgin_prefs_dropdown(vbox, _("_Show system tray icon:"), PURPLE_PREF_STRING,
PIDGIN_PREFS_ROOT "/docklet/show",
More information about the Commits
mailing list