Mercurial > pidgin.yaz
changeset 25268:7ddaa405936e
renamed gtkblist-loader.[ch] to gtblist-theme-loader.[ch]
renmaed gtkicon-loader.[ch] to gtkicon-theme-loader.[ch]
other updates as necessary due to the renames
author | Gary Kramlich <grim@reaperworld.com> |
---|---|
date | Thu, 28 Aug 2008 13:13:39 +0000 |
parents | e0a596a0a020 |
children | 25af9b1994c8 |
files | pidgin/Makefile.am pidgin/gtkblist-loader.c pidgin/gtkblist-loader.h pidgin/gtkblist-theme-loader.c pidgin/gtkblist-theme-loader.h pidgin/gtkblist.c pidgin/gtkicon-loader.c pidgin/gtkicon-loader.h pidgin/gtkicon-theme-loader.c pidgin/gtkicon-theme-loader.h pidgin/pidginstock.c |
diffstat | 11 files changed, 537 insertions(+), 537 deletions(-) [+] |
line wrap: on
line diff
--- a/pidgin/Makefile.am Thu Aug 28 13:00:23 2008 +0000 +++ b/pidgin/Makefile.am Thu Aug 28 13:13:39 2008 +0000 @@ -78,7 +78,7 @@ pidginstock.c \ gtkaccount.c \ gtkblist.c \ - gtkblist-loader.c \ + gtkblist-theme-loader.c \ gtkblist-theme.c \ gtkcelllayout.c \ gtkcellrendererexpander.c \ @@ -97,7 +97,7 @@ gtkexpander.c \ gtkft.c \ gtkicon-theme.c \ - gtkicon-loader.c \ + gtkicon-theme-loader.c \ gtkidle.c \ gtkimhtml.c \ gtkimhtmltoolbar.c \ @@ -132,7 +132,7 @@ eggtrayicon.h \ gtkaccount.h \ gtkblist.h \ - gtkblist-loader.h \ + gtkblist-theme-loader.h \ gtkblist-theme.h \ gtkcelllayout.h \ gtkcellrendererexpander.h \ @@ -154,7 +154,7 @@ gtkexpander.h \ gtkft.h \ gtkicon-theme.h \ - gtkicon-loader.h \ + gtkicon-theme-loader.h \ gtkidle.h \ gtkgaim-compat.h \ gtkimhtml.h \
--- a/pidgin/gtkblist-loader.c Thu Aug 28 13:00:23 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,274 +0,0 @@ -/* - * 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 <stdlib.h> - -#include "xmlnode.h" - -#include "gtkblist-loader.h" -#include "gtkblist-theme.h" - -/****************************************************************************** - * Globals - *****************************************************************************/ -#define DEFAULT_TEXT_COLOR "black" -/***************************************************************************** - * Buddy List Theme Builder - *****************************************************************************/ - -static PurpleTheme * -pidgin_blist_loader_build(const gchar *dir) -{ - xmlnode *root_node = NULL, *sub_node, *sub_sub_node; - gchar *filename_full, *data; - const gchar *temp; - gboolean sucess = TRUE; - GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; - GdkColor color; - FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *status; - PidginBlistLayout *layout; - PidginBlistTheme *theme; - - /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); - filename_full = g_build_filename(dir, "theme.xml", NULL); - - if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); - - g_free(filename_full); - g_return_val_if_fail(root_node != NULL, NULL); - - sub_node = xmlnode_get_child(root_node, "description"); - data = xmlnode_get_data(sub_node); - - /* init all structs and colors */ - bgcolor = g_new0(GdkColor, 1); - expanded_bgcolor = g_new0(GdkColor, 1); - collapsed_bgcolor = g_new0(GdkColor, 1); - - layout = g_new0(PidginBlistLayout, 1); - - contact_color = g_new0(GdkColor, 1); - - expanded = g_new0(FontColorPair, 1); - collapsed = g_new0(FontColorPair, 1); - contact = g_new0(FontColorPair, 1); - online = g_new0(FontColorPair, 1); - away = g_new0(FontColorPair, 1); - offline = g_new0(FontColorPair, 1); - idle = g_new0(FontColorPair, 1); - message = g_new0(FontColorPair, 1); - status = g_new0(FontColorPair, 1); - - /* <blist> */ - if ((sucess = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) { - if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE); - else { - g_free(bgcolor); - bgcolor = NULL; - } - } - - /* <groups> */ - if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "groups")) != NULL - && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL)) { - - expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - - if ((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) - expanded->color = g_strdup(temp); - else expanded->color = g_strdup(DEFAULT_TEXT_COLOR); - - - if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, expanded_bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE); - else { - g_free(expanded_bgcolor); - expanded_bgcolor = NULL; - } - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) { - - collapsed->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - - if((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) - collapsed->color = g_strdup(temp); - else collapsed->color = g_strdup(DEFAULT_TEXT_COLOR); - - if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, collapsed_bgcolor)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), collapsed_bgcolor, FALSE, TRUE); - else { - g_free(collapsed_bgcolor); - collapsed_bgcolor = NULL; - } - } - - /* <buddys> */ - if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && - (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) { - - layout->status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; - layout->text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; - layout->emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; - layout->protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; - layout->buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; - layout->show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL)) { - if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), contact_color)) - gdk_colormap_alloc_color(gdk_colormap_get_system(), contact_color, FALSE, TRUE); - else { - g_free(contact_color); - contact_color = NULL; - } - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL)) { - contact->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - contact->color = g_strdup(temp); - else contact->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "online_text")) != NULL)) { - online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "away_text")) != NULL)) { - away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - away->color = g_strdup(temp); - else away->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "offline_text")) != NULL)) { - offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - online->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "idle_text")) != NULL)) { - idle->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - idle->color = g_strdup(temp); - else online->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_text")) != NULL)) { - message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - message->color = g_strdup(temp); - else message->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "status_text")) != NULL)) { - status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); - if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) - status->color = g_strdup(temp); - else status->color = g_strdup(DEFAULT_TEXT_COLOR); - } - - /* name is required for theme manager */ - sucess = sucess && xmlnode_get_attrib(root_node, "name") != NULL; - - /* the new 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"), - "image", xmlnode_get_attrib(root_node, "image"), - "directory", dir, - "description", data, - "background-color", bgcolor, - "layout", layout, - "expanded-color", expanded_bgcolor, - "expanded-text", expanded, - "collapsed-color", collapsed_bgcolor, - "collapsed-text", collapsed, - "contact-color", contact_color, - "contact", contact, - "online", online, - "away", away, - "offline", offline, - "idle", idle, - "message", message, - "status", status, NULL); - - xmlnode_free(root_node); - g_free(data); - - /* malformed xml file - also frees all partial data*/ - if (!sucess) { - g_object_unref(theme); - theme = NULL; - } - - return PURPLE_THEME(theme); -} - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_blist_theme_loader_class_init(PidginBlistThemeLoaderClass *klass) -{ - PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); - - loader_klass->purple_theme_loader_build = pidgin_blist_loader_build; -} - - -GType -pidgin_blist_theme_loader_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (PidginBlistThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PidginBlistThemeLoader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, - "PidginBlistThemeLoader", - &info, 0); - } - return type; -} - -
--- a/pidgin/gtkblist-loader.h Thu Aug 28 13:00:23 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/** - * @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_BLIST_THEME_LOADER_H_ -#define _PIDGIN_BLIST_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 - * - * PidginBlistThemeLoader is a GObject. - */ -typedef struct _PidginBlistThemeLoader PidginBlistThemeLoader; -typedef struct _PidginBlistThemeLoaderClass PidginBlistThemeLoaderClass; - -#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 _PidginBlistThemeLoader -{ - PurpleThemeLoader parent; -}; - -struct _PidginBlistThemeLoaderClass -{ - PurpleThemeLoaderClass parent_class; -}; - -/**************************************************************************/ -/** @name Buddy List Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType pidgin_blist_theme_loader_get_type(void); - -G_END_DECLS -#endif /* _PIDGIN_BLIST_THEME_LOADER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/gtkblist-theme-loader.c Thu Aug 28 13:13:39 2008 +0000 @@ -0,0 +1,274 @@ +/* + * 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 <stdlib.h> + +#include "xmlnode.h" + +#include "gtkblist-theme-loader.h" +#include "gtkblist-theme.h" + +/****************************************************************************** + * Globals + *****************************************************************************/ +#define DEFAULT_TEXT_COLOR "black" +/***************************************************************************** + * Buddy List Theme Builder + *****************************************************************************/ + +static PurpleTheme * +pidgin_blist_loader_build(const gchar *dir) +{ + xmlnode *root_node = NULL, *sub_node, *sub_sub_node; + gchar *filename_full, *data; + const gchar *temp; + gboolean sucess = TRUE; + GdkColor *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color; + GdkColor color; + FontColorPair *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *status; + PidginBlistLayout *layout; + PidginBlistTheme *theme; + + /* Find the theme file */ + g_return_val_if_fail(dir != NULL, NULL); + filename_full = g_build_filename(dir, "theme.xml", NULL); + + if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) + root_node = xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader"); + + g_free(filename_full); + g_return_val_if_fail(root_node != NULL, NULL); + + sub_node = xmlnode_get_child(root_node, "description"); + data = xmlnode_get_data(sub_node); + + /* init all structs and colors */ + bgcolor = g_new0(GdkColor, 1); + expanded_bgcolor = g_new0(GdkColor, 1); + collapsed_bgcolor = g_new0(GdkColor, 1); + + layout = g_new0(PidginBlistLayout, 1); + + contact_color = g_new0(GdkColor, 1); + + expanded = g_new0(FontColorPair, 1); + collapsed = g_new0(FontColorPair, 1); + contact = g_new0(FontColorPair, 1); + online = g_new0(FontColorPair, 1); + away = g_new0(FontColorPair, 1); + offline = g_new0(FontColorPair, 1); + idle = g_new0(FontColorPair, 1); + message = g_new0(FontColorPair, 1); + status = g_new0(FontColorPair, 1); + + /* <blist> */ + if ((sucess = (sub_node = xmlnode_get_child(root_node, "blist")) != NULL)) { + if ((temp = xmlnode_get_attrib(sub_node, "color")) != NULL && gdk_color_parse(temp, bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), bgcolor, FALSE, TRUE); + else { + g_free(bgcolor); + bgcolor = NULL; + } + } + + /* <groups> */ + if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "groups")) != NULL + && (sub_sub_node = xmlnode_get_child(sub_node, "expanded")) != NULL)) { + + expanded->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + + if ((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) + expanded->color = g_strdup(temp); + else expanded->color = g_strdup(DEFAULT_TEXT_COLOR); + + + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, expanded_bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), expanded_bgcolor, FALSE, TRUE); + else { + g_free(expanded_bgcolor); + expanded_bgcolor = NULL; + } + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "collapsed")) != NULL)) { + + collapsed->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + + if((temp = xmlnode_get_attrib(sub_sub_node, "text_color")) != NULL && gdk_color_parse(temp, &color)) + collapsed->color = g_strdup(temp); + else collapsed->color = g_strdup(DEFAULT_TEXT_COLOR); + + if ((temp = xmlnode_get_attrib(sub_sub_node, "background")) != NULL && gdk_color_parse(temp, collapsed_bgcolor)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), collapsed_bgcolor, FALSE, TRUE); + else { + g_free(collapsed_bgcolor); + collapsed_bgcolor = NULL; + } + } + + /* <buddys> */ + if ((sucess = sucess && (sub_node = xmlnode_get_child(root_node, "buddys")) != NULL && + (sub_sub_node = xmlnode_get_child(sub_node, "placement")) != NULL)) { + + layout->status_icon = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0; + layout->text = (temp = xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1; + layout->emblem = (temp = xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2; + layout->protocol_icon = (temp = xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3; + layout->buddy_icon = (temp = xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4; + layout->show_status = (temp = xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1; + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "background")) != NULL)) { + if(gdk_color_parse(xmlnode_get_attrib(sub_sub_node, "color"), contact_color)) + gdk_colormap_alloc_color(gdk_colormap_get_system(), contact_color, FALSE, TRUE); + else { + g_free(contact_color); + contact_color = NULL; + } + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "contact_text")) != NULL)) { + contact->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + contact->color = g_strdup(temp); + else contact->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "online_text")) != NULL)) { + online->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + online->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "away_text")) != NULL)) { + away->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + away->color = g_strdup(temp); + else away->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "offline_text")) != NULL)) { + offline->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + online->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "idle_text")) != NULL)) { + idle->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + idle->color = g_strdup(temp); + else online->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "message_text")) != NULL)) { + message->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + message->color = g_strdup(temp); + else message->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + if ((sucess = sucess && sub_node != NULL && (sub_sub_node = xmlnode_get_child(sub_node, "status_text")) != NULL)) { + status->font = g_strdup(xmlnode_get_attrib(sub_sub_node, "font")); + if(gdk_color_parse(temp = xmlnode_get_attrib(sub_sub_node, "color"), &color)) + status->color = g_strdup(temp); + else status->color = g_strdup(DEFAULT_TEXT_COLOR); + } + + /* name is required for theme manager */ + sucess = sucess && xmlnode_get_attrib(root_node, "name") != NULL; + + /* the new 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"), + "image", xmlnode_get_attrib(root_node, "image"), + "directory", dir, + "description", data, + "background-color", bgcolor, + "layout", layout, + "expanded-color", expanded_bgcolor, + "expanded-text", expanded, + "collapsed-color", collapsed_bgcolor, + "collapsed-text", collapsed, + "contact-color", contact_color, + "contact", contact, + "online", online, + "away", away, + "offline", offline, + "idle", idle, + "message", message, + "status", status, NULL); + + xmlnode_free(root_node); + g_free(data); + + /* malformed xml file - also frees all partial data*/ + if (!sucess) { + g_object_unref(theme); + theme = NULL; + } + + return PURPLE_THEME(theme); +} + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +static void +pidgin_blist_theme_loader_class_init(PidginBlistThemeLoaderClass *klass) +{ + PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); + + loader_klass->purple_theme_loader_build = pidgin_blist_loader_build; +} + + +GType +pidgin_blist_theme_loader_get_type(void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof (PidginBlistThemeLoaderClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)pidgin_blist_theme_loader_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PidginBlistThemeLoader), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static(PURPLE_TYPE_THEME_LOADER, + "PidginBlistThemeLoader", + &info, 0); + } + return type; +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/gtkblist-theme-loader.h Thu Aug 28 13:13:39 2008 +0000 @@ -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_BLIST_THEME_LOADER_H_ +#define _PIDGIN_BLIST_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 + * + * PidginBlistThemeLoader is a GObject. + */ +typedef struct _PidginBlistThemeLoader PidginBlistThemeLoader; +typedef struct _PidginBlistThemeLoaderClass PidginBlistThemeLoaderClass; + +#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 _PidginBlistThemeLoader +{ + PurpleThemeLoader parent; +}; + +struct _PidginBlistThemeLoaderClass +{ + PurpleThemeLoaderClass parent_class; +}; + +/**************************************************************************/ +/** @name Buddy List Theme-Loader API */ +/**************************************************************************/ +G_BEGIN_DECLS + +/** + * GObject foo. + * @internal. + */ +GType pidgin_blist_theme_loader_get_type(void); + +G_END_DECLS +#endif /* _PIDGIN_BLIST_THEME_LOADER_H_ */
--- a/pidgin/gtkblist.c Thu Aug 28 13:00:23 2008 +0000 +++ b/pidgin/gtkblist.c Thu Aug 28 13:13:39 2008 +0000 @@ -60,7 +60,7 @@ #include "gtkstatusbox.h" #include "gtkscrollbook.h" #include "gtksmiley.h" -#include "gtkblist-loader.h" +#include "gtkblist-theme-loader.h" #include "gtkblist-theme.h" #include "gtkutils.h" #include "pidgin/minidialog.h"
--- a/pidgin/gtkicon-loader.c Thu Aug 28 13:00:23 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* - * PidginIconThemeLoader 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 "gtkicon-loader.h" -#include "gtkstatus-icon-theme.h" - -#include "xmlnode.h" - -/***************************************************************************** - * Icon Theme Builder - *****************************************************************************/ - -static PurpleTheme * -pidgin_icon_loader_build(const gchar *dir) -{ - xmlnode *root_node = NULL, *sub_node; - gchar *filename_full, *data; - PidginIconTheme *theme = NULL; - - /* Find the theme file */ - g_return_val_if_fail(dir != NULL, NULL); - filename_full = g_build_filename(dir, "theme.xml", NULL); - - if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) - root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader"); - - g_free(filename_full); - 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); - - if (xmlnode_get_attrib(root_node, "name") != NULL) { - theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME, - "type", "status-icon", - "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); - - sub_node = xmlnode_get_child(root_node, "icon"); - - while (sub_node){ - pidgin_icon_theme_set_icon(theme, - xmlnode_get_attrib(sub_node, "id"), - xmlnode_get_attrib(sub_node, "file")); - sub_node = xmlnode_get_next_twin(sub_node); - } - } - - xmlnode_free(root_node); - g_free(data); - return PURPLE_THEME(theme); -} - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_icon_theme_loader_class_init (PidginIconThemeLoaderClass *klass) -{ - PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); - - loader_klass->purple_theme_loader_build = pidgin_icon_loader_build; -} - - -GType -pidgin_icon_theme_loader_get_type (void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (PidginIconThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_icon_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PidginIconThemeLoader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, - "PidginIconThemeLoader", - &info, 0); - } - return type; -} - -
--- a/pidgin/gtkicon-loader.h Thu Aug 28 13:00:23 2008 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/** - * @file gtkicon-loader.h Pidgin Icon Theme Loader Class API - */ - -/* purple - * - * Purple 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_ICON_THEME_LOADER_H_ -#define _PIDGIN_ICON_THEME_LOADER_H_ - -#include <glib.h> -#include <glib-object.h> -#include "theme-loader.h" - -/** - * A pidgin icon theme loader. Extends PurpleThemeLoader (theme-loader.h) - * This is a class designed to build icon themes - * - * PidginIconThemeLoader is a GObject. - */ -typedef struct _PidginIconThemeLoader PidginIconThemeLoader; -typedef struct _PidginIconThemeLoaderClass PidginIconThemeLoaderClass; - -#define PIDGIN_TYPE_ICON_THEME_LOADER (pidgin_icon_theme_loader_get_type ()) -#define PIDGIN_ICON_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoader)) -#define PIDGIN_ICON_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoaderClass)) -#define PIDGIN_IS_ICON_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_ICON_THEME_LOADER)) -#define PIDGIN_IS_ICON_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_ICON_THEME_LOADER)) -#define PIDGIN_ICON_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoaderClass)) - -struct _PidginIconThemeLoader -{ - PurpleThemeLoader parent; -}; - -struct _PidginIconThemeLoaderClass -{ - PurpleThemeLoaderClass parent_class; -}; - -/**************************************************************************/ -/** @name Pidgin Icon Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -/** - * GObject foo. - * @internal. - */ -GType pidgin_icon_theme_loader_get_type(void); - -G_END_DECLS -#endif /* _PIDGIN_ICON_THEME_LOADER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/gtkicon-theme-loader.c Thu Aug 28 13:13:39 2008 +0000 @@ -0,0 +1,115 @@ +/* + * PidginIconThemeLoader 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 "gtkicon-theme-loader.h" +#include "gtkstatus-icon-theme.h" + +#include "xmlnode.h" + +/***************************************************************************** + * Icon Theme Builder + *****************************************************************************/ + +static PurpleTheme * +pidgin_icon_loader_build(const gchar *dir) +{ + xmlnode *root_node = NULL, *sub_node; + gchar *filename_full, *data; + PidginIconTheme *theme = NULL; + + /* Find the theme file */ + g_return_val_if_fail(dir != NULL, NULL); + filename_full = g_build_filename(dir, "theme.xml", NULL); + + if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR)) + root_node = xmlnode_from_file(dir, "theme.xml", "sound themes", "sound-loader"); + + g_free(filename_full); + 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); + + if (xmlnode_get_attrib(root_node, "name") != NULL) { + theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME, + "type", "status-icon", + "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); + + sub_node = xmlnode_get_child(root_node, "icon"); + + while (sub_node){ + pidgin_icon_theme_set_icon(theme, + xmlnode_get_attrib(sub_node, "id"), + xmlnode_get_attrib(sub_node, "file")); + sub_node = xmlnode_get_next_twin(sub_node); + } + } + + xmlnode_free(root_node); + g_free(data); + return PURPLE_THEME(theme); +} + +/****************************************************************************** + * GObject Stuff + *****************************************************************************/ + +static void +pidgin_icon_theme_loader_class_init (PidginIconThemeLoaderClass *klass) +{ + PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); + + loader_klass->purple_theme_loader_build = pidgin_icon_loader_build; +} + + +GType +pidgin_icon_theme_loader_get_type (void) +{ + static GType type = 0; + if (type == 0) { + static const GTypeInfo info = { + sizeof (PidginIconThemeLoaderClass), + NULL, /* base_init */ + NULL, /* base_finalize */ + (GClassInitFunc)pidgin_icon_theme_loader_class_init, /* class_init */ + NULL, /* class_finalize */ + NULL, /* class_data */ + sizeof (PidginIconThemeLoader), + 0, /* n_preallocs */ + NULL, /* instance_init */ + NULL, /* value table */ + }; + type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, + "PidginIconThemeLoader", + &info, 0); + } + return type; +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pidgin/gtkicon-theme-loader.h Thu Aug 28 13:13:39 2008 +0000 @@ -0,0 +1,71 @@ +/** + * @file gtkicon-loader.h Pidgin Icon Theme Loader Class API + */ + +/* purple + * + * Purple 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_ICON_THEME_LOADER_H_ +#define _PIDGIN_ICON_THEME_LOADER_H_ + +#include <glib.h> +#include <glib-object.h> +#include "theme-loader.h" + +/** + * A pidgin icon theme loader. Extends PurpleThemeLoader (theme-loader.h) + * This is a class designed to build icon themes + * + * PidginIconThemeLoader is a GObject. + */ +typedef struct _PidginIconThemeLoader PidginIconThemeLoader; +typedef struct _PidginIconThemeLoaderClass PidginIconThemeLoaderClass; + +#define PIDGIN_TYPE_ICON_THEME_LOADER (pidgin_icon_theme_loader_get_type ()) +#define PIDGIN_ICON_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoader)) +#define PIDGIN_ICON_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoaderClass)) +#define PIDGIN_IS_ICON_THEME_LOADER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_ICON_THEME_LOADER)) +#define PIDGIN_IS_ICON_THEME_LOADER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_ICON_THEME_LOADER)) +#define PIDGIN_ICON_THEME_LOADER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_ICON_THEME_LOADER, PidginIconThemeLoaderClass)) + +struct _PidginIconThemeLoader +{ + PurpleThemeLoader parent; +}; + +struct _PidginIconThemeLoaderClass +{ + PurpleThemeLoaderClass parent_class; +}; + +/**************************************************************************/ +/** @name Pidgin Icon Theme-Loader API */ +/**************************************************************************/ +G_BEGIN_DECLS + +/** + * GObject foo. + * @internal. + */ +GType pidgin_icon_theme_loader_get_type(void); + +G_END_DECLS +#endif /* _PIDGIN_ICON_THEME_LOADER_H_ */