pidgin/pidgin

Remove theming from the buddy list

2021-02-12, Gary Kramlich
a7aca87d5ceb
Parents 3a58ef28ee44
Children 502c78a7f11f
Remove theming from the buddy list

Testing Done:
Build and ran locally.

Reviewed at https://reviews.imfreedom.org/r/415/
--- a/ChangeLog.API Sun Feb 07 01:42:09 2021 -0600
+++ b/ChangeLog.API Fri Feb 12 00:17:08 2021 -0600
@@ -686,7 +686,45 @@
* gtk_imhtml_image_free
* gtk_imhtml_image_new
* gtk_imhtml_image_scale
+ * pidgin_blist_get_theme
+ * pidgin_blist_layout_get_type
+ * pidgin_blist_set_theme
+ * pidgin_blist_theme_get_background_color
+ * pidgin_blist_theme_get_collapsed_background_color
+ * pidgin_blist_theme_get_collapsed_text_info
+ * pidgin_blist_theme_get_contact_color
+ * pidgin_blist_theme_get_contact_text_info
+ * pidgin_blist_theme_get_expanded_background_color
+ * pidgin_blist_theme_get_expanded_text_info
+ * pidgin_blist_theme_get_idle_text_info
+ * pidgin_blist_theme_get_offline_text_info
+ * pidgin_blist_theme_get_online_text_info
+ * pidgin_blist_theme_get_online_text_info
+ * pidgin_blist_theme_get_opacity
+ * pidgin_blist_theme_get_opacity
+ * pidgin_blist_theme_get_status_text_info
+ * pidgin_blist_theme_get_type
+ * pidgin_blist_theme_get_unread_message_nick_said_text_info
+ * pidgin_blist_theme_get_unread_message_text_info
+ * pidgin_blist_theme_loader_get_type
+ * pidgin_blist_theme_set_away_text_info
+ * pidgin_blist_theme_set_background_color
+ * pidgin_blist_theme_set_collapsed_background_color
+ * pidgin_blist_theme_set_collapsed_text_info
+ * pidgin_blist_theme_set_contact_color
+ * pidgin_blist_theme_set_contact_text_info
+ * pidgin_blist_theme_set_expanded_background_color
+ * pidgin_blist_theme_set_expanded_text_info
+ * pidgin_blist_theme_set_idle_text_info
+ * pidgin_blist_theme_set_layout
+ * pidgin_blist_theme_set_offline_text_info
+ * pidgin_blist_theme_set_online_text_info
+ * pidgin_blist_theme_set_opacity
+ * pidgin_blist_theme_set_status_text_info
+ * pidgin_blist_theme_set_unread_message_nick_said_text_info
+ * pidgin_blist_theme_set_unread_message_text_info
* pidgin_blist_update_account_error_state
+ * PidginBlistLayout
* PidginBuddyList.connection_errors
* PidginButtonStyle
* pidgin_check_if_dir
@@ -733,8 +771,17 @@
* pidgin_status_box_set_network_available
* pidgin_stock_id_from_presence
* pidgin_text_combo_box_entry_set_text
+ * pidgin_theme_font_free
+ * pidgin_theme_font_get_color
+ * pidgin_theme_font_get_color_describe
+ * pidgin_theme_font_get_font_face
+ * pidgin_theme_font_get_type
+ * pidgin_theme_font_new
+ * pidgin_theme_font_set_color
+ * pidgin_theme_font_set_font_face
* pidgin_toggle_sensitive, pidgin_toggle_sensitive_array, and
- pidgin_toggle_showhide; use g_object_bind_property instead
+ pidgin_toggle_showhide; use g_object_bind_property instead
+ * PidginThemeFont
* struct _GtkIMHtmlAnimation
* struct _GtkIMHtmlFontDetail
* struct _GtkIMHtmlHr
--- a/doc/reference/pidgin/pidgin-docs.xml Sun Feb 07 01:42:09 2021 -0600
+++ b/doc/reference/pidgin/pidgin-docs.xml Fri Feb 12 00:17:08 2021 -0600
@@ -20,8 +20,6 @@
<title>API Reference</title>
<xi:include href="xml/gtkaccount.xml" />
- <xi:include href="xml/gtkblist-theme-loader.xml" />
- <xi:include href="xml/gtkblist-theme.xml" />
<xi:include href="xml/gtkblist.xml" />
<xi:include href="xml/gtkconn.xml" />
<xi:include href="xml/gtkconv.xml" />
--- a/pidgin/gtkblist-theme-loader.c Sun Feb 07 01:42:09 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,292 +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 <string.h>
-
-#include <purple.h>
-
-#include "gtkblist-theme-loader.h"
-#include "gtkblist-theme.h"
-
-/**
- * PidginBlistThemeLoader:
- *
- * A pidgin buddy list theme loader. extends PurpleThemeLoader (theme-loader.h)
- * This is a class designed to build sound themes
- */
-struct _PidginBlistThemeLoader
-{
- PurpleThemeLoader parent;
-};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-#define DEFAULT_TEXT_COLOR "black"
-
-/*****************************************************************************
- * Buddy List Theme Builder
- *****************************************************************************/
-
-static PidginThemeFont *
-pidgin_theme_font_parse(PurpleXmlNode *node)
-{
- const char *font;
- const char *colordesc;
- GdkRGBA color;
-
- font = purple_xmlnode_get_attrib(node, "font");
-
- if ((colordesc = purple_xmlnode_get_attrib(node, "color")) == NULL ||
- !gdk_rgba_parse(&color, colordesc))
- gdk_rgba_parse(&color, DEFAULT_TEXT_COLOR);
-
- return pidgin_theme_font_new(font, &color);
-}
-
-static GdkRGBA *
-parse_color(PurpleXmlNode *node, const char *tag)
-{
- const char *temp = purple_xmlnode_get_attrib(node, tag);
- GdkRGBA color;
-
- if (temp && gdk_rgba_parse(&color, temp)) {
- return gdk_rgba_copy(&color);
- } else {
- return NULL;
- }
-}
-
-static PurpleTheme *
-pidgin_blist_loader_build(const gchar *theme_dir)
-{
- PurpleXmlNode *root_node = NULL, *sub_node, *sub_sub_node;
- gchar *dir, *filename_full, *data = NULL;
- const gchar *temp, *name;
- gboolean success = TRUE;
- GdkRGBA *bgcolor, *expanded_bgcolor, *collapsed_bgcolor, *contact_color;
- PidginThemeFont *expanded, *collapsed, *contact, *online, *away, *offline, *idle, *message, *message_nick_said, *status;
- PidginBlistLayout layout;
- PidginBlistTheme *theme;
- int i;
- struct {
- const char *tag;
- PidginThemeFont **font;
- } lookups[] = {
- {"contact_text", &contact},
- {"online_text", &online},
- {"away_text", &away},
- {"offline_text", &offline},
- {"idle_text", &idle},
- {"message_text", &message},
- {"message_nick_said_text", &message_nick_said},
- {"status_text", &status},
- {NULL, NULL}
- };
-
- bgcolor = expanded_bgcolor = collapsed_bgcolor = contact_color = NULL;
- expanded = NULL;
- collapsed = NULL;
- contact = NULL;
- online = NULL;
- away = NULL;
- offline = NULL;
- idle = NULL;
- message = NULL;
- message_nick_said = NULL;
- status = NULL;
-
- /* Find the theme file */
- g_return_val_if_fail(theme_dir != NULL, NULL);
- dir = g_build_filename(theme_dir, "purple", "blist", NULL);
- filename_full = g_build_filename(dir, "theme.xml", NULL);
-
- if (g_file_test(filename_full, G_FILE_TEST_IS_REGULAR))
- root_node = purple_xmlnode_from_file(dir, "theme.xml", "buddy list themes", "blist-loader");
-
- g_free(filename_full);
- if (root_node == NULL) {
- g_free(dir);
- return NULL;
- }
-
- sub_node = purple_xmlnode_get_child(root_node, "description");
- data = purple_xmlnode_get_data(sub_node);
-
- name = purple_xmlnode_get_attrib(root_node, "name");
-
- /* <blist> */
- success = name && purple_strequal(purple_xmlnode_get_attrib(root_node, "type"), "pidgin buddy list");
-
- if (!success)
- purple_debug_warning("gtkblist-theme-loader", "Missing attribute or problem with the root element\n");
-
- if (success) {
- if ((success = (sub_node = purple_xmlnode_get_child(root_node, "blist")) != NULL))
- bgcolor = parse_color(sub_node, "color");
- else
- purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <blist>.\n");
- }
-
- /* <groups> */
- if (success) {
- if ((success = (sub_node = purple_xmlnode_get_child(root_node, "groups")) != NULL
- && (sub_sub_node = purple_xmlnode_get_child(sub_node, "expanded")) != NULL)) {
- expanded = pidgin_theme_font_parse(sub_sub_node);
- expanded_bgcolor = parse_color(sub_sub_node, "background");
- } else
- purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <expanded>.\n");
- }
-
- if (success) {
- if ((success = sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "collapsed")) != NULL)) {
- collapsed = pidgin_theme_font_parse(sub_sub_node);
- collapsed_bgcolor = parse_color(sub_sub_node, "background");
- } else
- purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <groups> <collapsed>.\n");
- }
-
- /* <buddys> */
- if (success) {
- if ((success = (sub_node = purple_xmlnode_get_child(root_node, "buddys")) != NULL &&
- (sub_sub_node = purple_xmlnode_get_child(sub_node, "placement")) != NULL)) {
-
- layout.status_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) : 0;
- layout.text = (temp = purple_xmlnode_get_attrib(sub_sub_node, "name")) != NULL ? atoi(temp) : 1;
- layout.emblem = (temp = purple_xmlnode_get_attrib(sub_sub_node, "emblem")) != NULL ? atoi(temp) : 2;
- layout.protocol_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "protocol_icon")) != NULL ? atoi(temp) : 3;
- layout.buddy_icon = (temp = purple_xmlnode_get_attrib(sub_sub_node, "buddy_icon")) != NULL ? atoi(temp) : 4;
- layout.show_status = (temp = purple_xmlnode_get_attrib(sub_sub_node, "status_icon")) != NULL ? atoi(temp) != 0 : 1;
-
- } else purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <placement>.\n");
- }
-
- if (success) {
- if ((success = (sub_node != NULL && (sub_sub_node = purple_xmlnode_get_child(sub_node, "background")) != NULL)))
- contact_color = parse_color(sub_sub_node, "color");
- else
- purple_debug_warning("gtkblist-theme-loader", "Missing or problem with tags: <buddys> <background>.\n");
- }
-
- for (i = 0; success && lookups[i].tag; i++) {
- if ((success = (sub_node != NULL &&
- (sub_sub_node = purple_xmlnode_get_child(sub_node, lookups[i].tag)) != NULL))) {
- *(lookups[i].font) = pidgin_theme_font_parse(sub_sub_node);
- } else {
- *(lookups[i].font) = NULL;
- }
- }
-
- /* name is required for theme manager */
- success = (success && purple_xmlnode_get_attrib(root_node, "name") != NULL);
-
- /* the new theme */
- theme = g_object_new(PIDGIN_TYPE_BLIST_THEME,
- "type", "blist",
- "name", name,
- "author", purple_xmlnode_get_attrib(root_node, "author"),
- "image", purple_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,
- "message-nick-said", message_nick_said,
- "status", status, NULL);
-
- for (i = 0; lookups[i].tag; i++) {
- if (*lookups[i].font) {
- pidgin_theme_font_free(*lookups[i].font);
- }
- }
-
- pidgin_theme_font_free(expanded);
- pidgin_theme_font_free(collapsed);
-
- purple_xmlnode_free(root_node);
- g_free(data);
- g_free(dir);
-
- /* malformed xml file - also frees all partial data*/
- if (!success) {
- g_object_unref(theme);
- theme = NULL;
- }
-
- if (bgcolor)
- gdk_rgba_free(bgcolor);
- if (expanded_bgcolor)
- gdk_rgba_free(expanded_bgcolor);
- if (collapsed_bgcolor)
- gdk_rgba_free(collapsed_bgcolor);
- if (contact_color)
- gdk_rgba_free(contact_color);
-
- 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-theme-loader.h Sun Feb 07 01:42:09 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-/* 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
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_BLIST_THEME_LOADER_H
-#define PIDGIN_BLIST_THEME_LOADER_H
-/**
- * SECTION:gtkblist-theme-loader
- * @section_id: pidgin-gtkblist-theme-loader
- * @short_description: <filename>gtkblist-theme-loader.h</filename>
- * @title: Buddy List Theme Loader Class
- */
-
-#include <glib.h>
-#include <glib-object.h>
-
-#include <purple.h>
-
-#define PIDGIN_TYPE_BLIST_THEME_LOADER pidgin_blist_theme_loader_get_type()
-
-/**************************************************************************/
-/* Buddy List Theme-Loader API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * pidgin_blist_theme_loader_get_type:
- *
- * Returns: The #GType for a blist theme loader.
- */
-G_DECLARE_FINAL_TYPE(PidginBlistThemeLoader, pidgin_blist_theme_loader, PIDGIN,
- BLIST_THEME_LOADER, PurpleThemeLoader)
-
-G_END_DECLS
-
-#endif /* PIDGIN_BLIST_THEME_LOADER_H */
--- a/pidgin/gtkblist-theme.c Sun Feb 07 01:42:09 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,959 +0,0 @@
-/*
- * 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"
-
-#include "libpurple/glibcompat.h"
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-
-/**
- * PidginBlistTheme:
- *
- * A pidgin buddy list theme.
- * This is an object for Purple to represent a buddy list theme.
- *
- * PidginBlistTheme is a PurpleTheme Object.
- */
-struct _PidginBlistTheme
-{
- PurpleTheme parent;
-};
-
-typedef struct {
- /* Buddy list */
- gdouble opacity;
- GdkRGBA *bgcolor;
- PidginBlistLayout *layout;
-
- /* groups */
- GdkRGBA *expanded_color;
- PidginThemeFont *expanded;
-
- GdkRGBA *collapsed_color;
- PidginThemeFont *collapsed;
-
- /* buddy */
- GdkRGBA *contact_color;
-
- PidginThemeFont *contact;
-
- PidginThemeFont *online;
- PidginThemeFont *away;
- PidginThemeFont *offline;
- PidginThemeFont *idle;
- PidginThemeFont *message;
- PidginThemeFont *message_nick_said;
-
- PidginThemeFont *status;
-
-} PidginBlistThemePrivate;
-
-struct _PidginThemeFont
-{
- gchar *font;
- gchar color[10];
- GdkRGBA *gdkcolor;
-};
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-
-enum {
- PROP_ZERO = 0,
- PROP_BACKGROUND_COLOR,
- PROP_OPACITY,
- PROP_LAYOUT,
- PROP_EXPANDED_COLOR,
- PROP_EXPANDED_TEXT,
- PROP_COLLAPSED_COLOR,
- PROP_COLLAPSED_TEXT,
- PROP_CONTACT_COLOR,
- PROP_CONTACT,
- PROP_ONLINE,
- PROP_AWAY,
- PROP_OFFLINE,
- PROP_IDLE,
- PROP_MESSAGE,
- PROP_MESSAGE_NICK_SAID,
- PROP_STATUS,
- PROP_LAST
-};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-static GParamSpec *properties[PROP_LAST];
-
-G_DEFINE_TYPE_WITH_PRIVATE(PidginBlistTheme, pidgin_blist_theme,
- PURPLE_TYPE_THEME);
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-
-PidginThemeFont *
-pidgin_theme_font_new(const gchar *face, GdkRGBA *color)
-{
- PidginThemeFont *font = g_new0(PidginThemeFont, 1);
- font->font = g_strdup(face);
- if (color)
- pidgin_theme_font_set_color(font, color);
- return font;
-}
-
-void
-pidgin_theme_font_free(PidginThemeFont *pair)
-{
- if (pair != NULL) {
- g_free(pair->font);
- if (pair->gdkcolor)
- gdk_rgba_free(pair->gdkcolor);
- g_free(pair);
- }
-}
-
-static PidginThemeFont *
-copy_font_and_color(const PidginThemeFont *pair)
-{
- PidginThemeFont *copy;
-
- if (pair == NULL)
- return NULL;
-
- copy = g_new0(PidginThemeFont, 1);
- copy->font = g_strdup(pair->font);
- strncpy(copy->color, pair->color, sizeof(copy->color) - 1);
- if (pair->gdkcolor) {
- copy->gdkcolor = gdk_rgba_copy(pair->gdkcolor);
- }
- return copy;
-}
-
-void
-pidgin_theme_font_set_font_face(PidginThemeFont *font, const gchar *face)
-{
- g_return_if_fail(font);
- g_return_if_fail(face);
-
- g_free(font->font);
- font->font = g_strdup(face);
-}
-
-void
-pidgin_theme_font_set_color(PidginThemeFont *font, const GdkRGBA *color)
-{
- g_return_if_fail(font);
-
- if (font->gdkcolor)
- gdk_rgba_free(font->gdkcolor);
-
- font->gdkcolor = color ? gdk_rgba_copy(color) : NULL;
- if (color)
- g_snprintf(font->color, sizeof(font->color),
- "#%02x%02x%02x",
- (unsigned int)(color->red * 255),
- (unsigned int)(color->green * 255),
- (unsigned int)(color->blue * 255));
- else
- font->color[0] = '\0';
-}
-
-const gchar *
-pidgin_theme_font_get_font_face(PidginThemeFont *font)
-{
- g_return_val_if_fail(font, NULL);
- return font->font;
-}
-
-const GdkRGBA *
-pidgin_theme_font_get_color(PidginThemeFont *font)
-{
- g_return_val_if_fail(font, NULL);
- return font->gdkcolor;
-}
-
-const gchar *
-pidgin_theme_font_get_color_describe(PidginThemeFont *font)
-{
- g_return_val_if_fail(font, NULL);
- return font->color[0] ? font->color : NULL;
-}
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-
-static void
-pidgin_blist_theme_get_property(GObject *obj, guint param_id, GValue *value,
- GParamSpec *psec)
-{
- PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
-
- switch (param_id) {
- case PROP_BACKGROUND_COLOR:
- g_value_set_boxed(value, pidgin_blist_theme_get_background_color(theme));
- break;
- case PROP_OPACITY:
- g_value_set_double(value, pidgin_blist_theme_get_opacity(theme));
- break;
- case PROP_LAYOUT:
- g_value_set_pointer(value, pidgin_blist_theme_get_layout(theme));
- break;
- case PROP_EXPANDED_COLOR:
- g_value_set_boxed(value, pidgin_blist_theme_get_expanded_background_color(theme));
- break;
- case PROP_EXPANDED_TEXT:
- g_value_set_pointer(value, pidgin_blist_theme_get_expanded_text_info(theme));
- break;
- case PROP_COLLAPSED_COLOR:
- g_value_set_boxed(value, pidgin_blist_theme_get_collapsed_background_color(theme));
- break;
- case PROP_COLLAPSED_TEXT:
- g_value_set_pointer(value, pidgin_blist_theme_get_collapsed_text_info(theme));
- break;
- case PROP_CONTACT_COLOR:
- g_value_set_boxed(value, pidgin_blist_theme_get_contact_color(theme));
- break;
- case PROP_CONTACT:
- g_value_set_pointer(value, pidgin_blist_theme_get_contact_text_info(theme));
- break;
- case PROP_ONLINE:
- g_value_set_pointer(value, pidgin_blist_theme_get_online_text_info(theme));
- break;
- case PROP_AWAY:
- g_value_set_pointer(value, pidgin_blist_theme_get_away_text_info(theme));
- break;
- case PROP_OFFLINE:
- g_value_set_pointer(value, pidgin_blist_theme_get_offline_text_info(theme));
- break;
- case PROP_IDLE:
- g_value_set_pointer(value, pidgin_blist_theme_get_idle_text_info(theme));
- break;
- case PROP_MESSAGE:
- g_value_set_pointer(value, pidgin_blist_theme_get_unread_message_text_info(theme));
- break;
- case PROP_MESSAGE_NICK_SAID:
- g_value_set_pointer(value, pidgin_blist_theme_get_unread_message_nick_said_text_info(theme));
- break;
- case PROP_STATUS:
- g_value_set_pointer(value, pidgin_blist_theme_get_status_text_info(theme));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static void
-pidgin_blist_theme_set_property(GObject *obj, guint param_id, const GValue *value,
- GParamSpec *psec)
-{
- PidginBlistTheme *theme = PIDGIN_BLIST_THEME(obj);
-
- switch (param_id) {
- case PROP_BACKGROUND_COLOR:
- pidgin_blist_theme_set_background_color(theme, g_value_get_boxed(value));
- break;
- case PROP_OPACITY:
- pidgin_blist_theme_set_opacity(theme, g_value_get_double(value));
- break;
- case PROP_LAYOUT:
- pidgin_blist_theme_set_layout(theme, g_value_get_pointer(value));
- break;
- case PROP_EXPANDED_COLOR:
- pidgin_blist_theme_set_expanded_background_color(theme, g_value_get_boxed(value));
- break;
- case PROP_EXPANDED_TEXT:
- pidgin_blist_theme_set_expanded_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_COLLAPSED_COLOR:
- pidgin_blist_theme_set_collapsed_background_color(theme, g_value_get_boxed(value));
- break;
- case PROP_COLLAPSED_TEXT:
- pidgin_blist_theme_set_collapsed_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_CONTACT_COLOR:
- pidgin_blist_theme_set_contact_color(theme, g_value_get_boxed(value));
- break;
- case PROP_CONTACT:
- pidgin_blist_theme_set_contact_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_ONLINE:
- pidgin_blist_theme_set_online_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_AWAY:
- pidgin_blist_theme_set_away_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_OFFLINE:
- pidgin_blist_theme_set_offline_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_IDLE:
- pidgin_blist_theme_set_idle_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_MESSAGE:
- pidgin_blist_theme_set_unread_message_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_MESSAGE_NICK_SAID:
- pidgin_blist_theme_set_unread_message_nick_said_text_info(theme, g_value_get_pointer(value));
- break;
- case PROP_STATUS:
- pidgin_blist_theme_set_status_text_info(theme, g_value_get_pointer(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static void
-pidgin_blist_theme_finalize(GObject *obj)
-{
- PidginBlistThemePrivate *priv;
-
- priv = pidgin_blist_theme_get_instance_private(
- PIDGIN_BLIST_THEME(obj));
-
- /* Buddy List */
- if (priv->bgcolor)
- gdk_rgba_free(priv->bgcolor);
- g_free(priv->layout);
-
- /* Group */
- if (priv->expanded_color)
- gdk_rgba_free(priv->expanded_color);
- pidgin_theme_font_free(priv->expanded);
- if (priv->collapsed_color)
- gdk_rgba_free(priv->collapsed_color);
- pidgin_theme_font_free(priv->collapsed);
-
- /* Buddy */
- if (priv->contact_color)
- gdk_rgba_free(priv->contact_color);
- pidgin_theme_font_free(priv->contact);
- pidgin_theme_font_free(priv->online);
- pidgin_theme_font_free(priv->away);
- pidgin_theme_font_free(priv->offline);
- pidgin_theme_font_free(priv->idle);
- pidgin_theme_font_free(priv->message);
- pidgin_theme_font_free(priv->message_nick_said);
- pidgin_theme_font_free(priv->status);
-
- G_OBJECT_CLASS(pidgin_blist_theme_parent_class)->finalize (obj);
-}
-
-static void
-pidgin_blist_theme_init(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv =
- pidgin_blist_theme_get_instance_private(theme);
-
- priv->opacity = 1.0;
-}
-
-static void
-pidgin_blist_theme_class_init(PidginBlistThemeClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- 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;
-
- /* Buddy List */
- properties[PROP_BACKGROUND_COLOR] = g_param_spec_boxed("background-color",
- "Background Color",
- "The background color for the buddy list",
- GDK_TYPE_RGBA, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_OPACITY] = g_param_spec_double("opacity", "Opacity",
- "The opacity of the buddy list",
- 0.0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_LAYOUT] = g_param_spec_pointer("layout", "Layout",
- "The layout of icons, name, and status of the buddy list",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- /* Group */
- properties[PROP_EXPANDED_COLOR] = g_param_spec_boxed("expanded-color",
- "Expanded Background Color",
- "The background color of an expanded group",
- GDK_TYPE_RGBA, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_EXPANDED_TEXT] = g_param_spec_pointer("expanded-text",
- "Expanded Text",
- "The text information for when a group is expanded",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_COLLAPSED_COLOR] = g_param_spec_boxed("collapsed-color",
- "Collapsed Background Color",
- "The background color of a collapsed group",
- GDK_TYPE_RGBA, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_COLLAPSED_TEXT] = g_param_spec_pointer("collapsed-text",
- "Collapsed Text",
- "The text information for when a group is collapsed",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- /* Buddy */
- properties[PROP_CONTACT_COLOR] = g_param_spec_boxed("contact-color",
- "Contact/Chat Background Color",
- "The background color of a contact or chat",
- GDK_TYPE_RGBA, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_CONTACT] = g_param_spec_pointer("contact",
- "Contact Text",
- "The text information for when a contact is expanded",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_ONLINE] = g_param_spec_pointer("online",
- "Online Text",
- "The text information for when a buddy is online",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_AWAY] = g_param_spec_pointer("away",
- "Away Text",
- "The text information for when a buddy is away",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_OFFLINE] = g_param_spec_pointer("offline",
- "Offline Text",
- "The text information for when a buddy is offline",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_IDLE] = g_param_spec_pointer("idle",
- "Idle Text",
- "The text information for when a buddy is idle",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_MESSAGE] = g_param_spec_pointer("message",
- "Message Text",
- "The text information for when a buddy has an unread message",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_MESSAGE_NICK_SAID] = g_param_spec_pointer("message-nick-said",
- "Message (Nick Said) Text",
- "The text information for when a chat has an unread message that mentions your nickname",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- properties[PROP_STATUS] = g_param_spec_pointer("status",
- "Status Text",
- "The text information for a buddy's status",
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-}
-
-/**************************************************************************
- * GBoxed Stuff
- **************************************************************************/
-
-static PidginThemeFont *
-pidgin_theme_font_copy(PidginThemeFont *font)
-{
- g_return_val_if_fail(font != NULL, NULL);
-
- return pidgin_theme_font_new(font->font, font->gdkcolor);
-}
-
-GType
-pidgin_theme_font_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- type = g_boxed_type_register_static("PidginThemeFont",
- (GBoxedCopyFunc)pidgin_theme_font_copy,
- (GBoxedFreeFunc)pidgin_theme_font_free);
- }
-
- return type;
-}
-
-static PidginBlistLayout *
-pidgin_blist_layout_copy(const PidginBlistLayout *layout)
-{
- g_return_val_if_fail(layout != NULL, NULL);
-
- return g_memdup2(layout, sizeof(PidginBlistLayout));
-}
-
-GType
-pidgin_blist_layout_get_type(void)
-{
- static GType type = 0;
-
- if (type == 0) {
- type = g_boxed_type_register_static("PidginBlistLayout",
- (GBoxedCopyFunc)pidgin_blist_layout_copy,
- (GBoxedFreeFunc)g_free);
- }
-
- return type;
-}
-
-
-/*****************************************************************************
- * Public API functions
- *****************************************************************************/
-
-/* get methods */
-
-GdkRGBA *
-pidgin_blist_theme_get_background_color(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->bgcolor;
-}
-
-gdouble
-pidgin_blist_theme_get_opacity(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), 1.0);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->opacity;
-}
-
-PidginBlistLayout *
-pidgin_blist_theme_get_layout(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->layout;
-}
-
-GdkRGBA *
-pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->expanded_color;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->expanded;
-}
-
-GdkRGBA *
-pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->collapsed_color;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->collapsed;
-}
-
-GdkRGBA *
-pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->contact_color;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->contact;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->online;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->away;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->offline;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->idle;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->message;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->message_nick_said;
-}
-
-PidginThemeFont *
-pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_val_if_fail(PIDGIN_IS_BLIST_THEME(theme), NULL);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- return priv->status;
-}
-
-/* Set Methods */
-void
-pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkRGBA *color)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- if (priv->bgcolor)
- gdk_rgba_free(priv->bgcolor);
- priv->bgcolor = color ? gdk_rgba_copy(color) : NULL;
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_BACKGROUND_COLOR]);
-}
-
-void
-pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme) || opacity < 0.0 || opacity > 1.0);
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- priv->opacity = opacity;
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_OPACITY]);
-}
-
-void
-pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout *layout)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- g_free(priv->layout);
- priv->layout = pidgin_blist_layout_copy(layout);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_LAYOUT]);
-}
-
-void
-pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const GdkRGBA *color)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- if (priv->expanded_color)
- gdk_rgba_free(priv->expanded_color);
- priv->expanded_color = color ? gdk_rgba_copy(color) : NULL;
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_EXPANDED_COLOR]);
-}
-
-void
-pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->expanded);
- priv->expanded = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_EXPANDED_TEXT]);
-}
-
-void
-pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const GdkRGBA *color)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- if (priv->collapsed_color)
- gdk_rgba_free(priv->collapsed_color);
- priv->collapsed_color = color ? gdk_rgba_copy(color) : NULL;
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_COLLAPSED_COLOR]);
-}
-
-void
-pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->collapsed);
- priv->collapsed = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_COLLAPSED_TEXT]);
-}
-
-void
-pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkRGBA *color)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- if (priv->contact_color)
- gdk_rgba_free(priv->contact_color);
- priv->contact_color = color ? gdk_rgba_copy(color) : NULL;
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_CONTACT_COLOR]);
-}
-
-void
-pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->contact);
- priv->contact = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_CONTACT]);
-}
-
-void
-pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->online);
- priv->online = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_ONLINE]);
-}
-
-void
-pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->away);
- priv->away = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_AWAY]);
-}
-
-void
-pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->offline);
- priv->offline = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_OFFLINE]);
-}
-
-void
-pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->idle);
- priv->idle = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_IDLE]);
-}
-
-void
-pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->message);
- priv->message = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_MESSAGE]);
-}
-
-void
-pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->message_nick_said);
- priv->message_nick_said = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_MESSAGE_NICK_SAID]);
-}
-
-void
-pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair)
-{
- PidginBlistThemePrivate *priv;
-
- g_return_if_fail(PIDGIN_IS_BLIST_THEME(theme));
-
- priv = pidgin_blist_theme_get_instance_private(theme);
-
- pidgin_theme_font_free(priv->status);
- priv->status = copy_font_and_color(pair);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_STATUS]);
-}
--- a/pidgin/gtkblist-theme.h Sun Feb 07 01:42:09 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,474 +0,0 @@
-/* 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
- */
-
-#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION)
-# error "only <pidgin.h> may be included directly"
-#endif
-
-#ifndef PIDGIN_BLIST_THEME_H
-#define PIDGIN_BLIST_THEME_H
-/**
- * SECTION:gtkblist-theme
- * @section_id: pidgin-gtkblist-theme
- * @short_description: <filename>gtkblist-theme.h</filename>
- * @title: Buddy List Theme API
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include <gtk/gtk.h>
-
-#include <purple.h>
-
-#define PIDGIN_TYPE_BLIST_THEME (pidgin_blist_theme_get_type ())
-
-#define PIDGIN_TYPE_THEME_FONT (pidgin_theme_font_get_type())
-
-#define PIDGIN_TYPE_BLIST_LAYOUT (pidgin_blist_layout_get_type())
-
-typedef struct _PidginThemeFont PidginThemeFont;
-
-typedef struct _PidginBlistLayout PidginBlistLayout;
-
-struct _PidginBlistLayout
-{
- gint status_icon;
- gint text;
- gint emblem;
- gint protocol_icon;
- gint buddy_icon;
- gboolean show_status;
-
-};
-
-G_BEGIN_DECLS
-
-/**************************************************************************/
-/* PidginThemeFont API */
-/**************************************************************************/
-
-/**
- * pidgin_theme_font_get_type:
- *
- * Returns: The #GType for the #PidginThemeFont boxed structure.
- */
-GType pidgin_theme_font_get_type(void);
-
-/**
- * pidgin_theme_font_new:
- * @face: The font face
- * @color: The color of the font
- *
- * Create a new PidginThemeFont.
- *
- * Returns: A newly created PidginThemeFont
- */
-PidginThemeFont *pidgin_theme_font_new(const gchar *face, GdkRGBA *color);
-
-/**
- * pidgin_theme_font_free:
- * @font: The theme font
- *
- * Frees a font and color pair
- */
-void pidgin_theme_font_free(PidginThemeFont *font);
-
-/**
- * pidgin_theme_font_set_font_face:
- * @font: The PidginThemeFont
- * @face: The font-face
- *
- * Set the font-face of a PidginThemeFont.
- */
-void pidgin_theme_font_set_font_face(PidginThemeFont *font, const gchar *face);
-
-/**
- * pidgin_theme_font_set_color:
- * @font: The PidginThemeFont
- * @color: The color
- *
- * Set the color of a PidginThemeFont.
- */
-void pidgin_theme_font_set_color(PidginThemeFont *font, const GdkRGBA *color);
-
-/**
- * pidgin_theme_font_get_font_face:
- * @font: The PidginThemeFont
- *
- * Get the font-face of a PidginThemeFont.
- *
- * Returns: The font-face, or NULL if none is set.
- */
-const gchar * pidgin_theme_font_get_font_face(PidginThemeFont *font);
-
-/**
- * pidgin_theme_font_get_color:
- * @font: The PidginThemeFont
- *
- * Get the color of a PidginThemeFont as a GdkRGBA object.
- *
- * Returns: The color, or NULL if none is set.
- */
-const GdkRGBA *pidgin_theme_font_get_color(PidginThemeFont *font);
-
-/**
- * pidgin_theme_font_get_color_describe:
- * @font: The PidginThemeFont
- *
- * Get the color of a PidginThemeFont.
- *
- * Returns: The color, or NULL if none is set.
- */
-const gchar * pidgin_theme_font_get_color_describe(PidginThemeFont *font);
-
-/**************************************************************************/
-/* Purple Buddy List Theme API */
-/**************************************************************************/
-
-/**
- * pidgin_blist_theme_get_type:
- *
- * Returns: The #GType for a blist theme.
- */
-G_DECLARE_FINAL_TYPE(PidginBlistTheme, pidgin_blist_theme, PIDGIN, BLIST_THEME,
- PurpleTheme)
-
-/**
- * pidgin_blist_layout_get_type:
- *
- * Returns: The #GType for the #PidginBlistLayout boxed structure.
- */
-GType pidgin_blist_layout_get_type(void);
-
-/* get methods */
-
-/**
- * pidgin_blist_theme_get_background_color:
- * @theme: The PidginBlist theme.
- *
- * Returns the background color of the buddy list.
- *
- * Returns: A gdk color.
- */
-GdkRGBA *pidgin_blist_theme_get_background_color(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_opacity:
- * @theme: The PidginBlist theme.
- *
- * Returns the opacity of the buddy list window
- * (0.0 or clear to 1.0 fully opaque).
- *
- * Returns: The opacity
- */
-gdouble pidgin_blist_theme_get_opacity(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_layout:
- * @theme: The PidginBlist theme.
- *
- * Returns the layout to be used with the buddy list.
- *
- * Returns: The buddy list layout.
- */
-PidginBlistLayout *pidgin_blist_theme_get_layout(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_expanded_background_color:
- * @theme: The PidginBlist theme.
- *
- * Returns the background color to be used with expanded groups.
- *
- * Returns: A gdk color.
- */
-GdkRGBA *pidgin_blist_theme_get_expanded_background_color(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_expanded_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used with expanded groups.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_expanded_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_collapsed_background_color:
- * @theme: The PidginBlist theme.
- *
- * Returns the background color to be used with collapsed groups.
- *
- * Returns: A gdk color.
- */
-GdkRGBA *pidgin_blist_theme_get_collapsed_background_color(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_collapsed_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used with collapsed groups.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_collapsed_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_contact_color:
- * @theme: The PidginBlist theme.
- *
- * Returns the colors to be used for contacts and chats.
- *
- * Returns: A gdkcolor for contacts and chats.
- */
-GdkRGBA *pidgin_blist_theme_get_contact_color(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_contact_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for expanded contacts.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_contact_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_online_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for online buddies.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_online_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_away_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for away and idle buddies.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_away_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_offline_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for offline buddies.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_offline_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_idle_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for idle buddies.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_idle_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_unread_message_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for buddies with unread messages.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_unread_message_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_unread_message_nick_said_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for chats with unread messages
- * that mention your nick.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_unread_message_nick_said_text_info(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_theme_get_status_text_info:
- * @theme: The PidginBlist theme.
- *
- * Returns the text font and color to be used for a buddy's status message.
- *
- * Returns: A font and color pair.
- */
-PidginThemeFont *pidgin_blist_theme_get_status_text_info(PidginBlistTheme *theme);
-
-/* Set Methods */
-
-/**
- * pidgin_blist_theme_set_background_color:
- * @theme: The PidginBlist theme.
- * @color: The new background color.
- *
- * Sets the background color to be used for this buddy list theme.
- */
-void pidgin_blist_theme_set_background_color(PidginBlistTheme *theme, const GdkRGBA *color);
-
-/**
- * pidgin_blist_theme_set_opacity:
- * @theme: The PidginBlist theme.
- * @opacity: The new opacity setting.
- *
- * Sets the opacity to be used for this buddy list theme.
- */
-void pidgin_blist_theme_set_opacity(PidginBlistTheme *theme, gdouble opacity);
-
-/**
- * pidgin_blist_theme_set_layout:
- * @theme: The PidginBlist theme.
- * @layout: The new layout.
- *
- * Sets the buddy list layout to be used for this buddy list theme.
- */
-void pidgin_blist_theme_set_layout(PidginBlistTheme *theme, const PidginBlistLayout *layout);
-
-/**
- * pidgin_blist_theme_set_expanded_background_color:
- * @theme: The PidginBlist theme.
- * @color: The new background color.
- *
- * Sets the background color to be used for expanded groups.
- */
-void pidgin_blist_theme_set_expanded_background_color(PidginBlistTheme *theme, const GdkRGBA *color);
-
-/**
- * pidgin_blist_theme_set_expanded_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for expanded groups.
- */
-void pidgin_blist_theme_set_expanded_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_collapsed_background_color:
- * @theme: The PidginBlist theme.
- * @color: The new background color.
- *
- * Sets the background color to be used for collapsed groups.
- */
-void pidgin_blist_theme_set_collapsed_background_color(PidginBlistTheme *theme, const GdkRGBA *color);
-
-/**
- * pidgin_blist_theme_set_collapsed_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for expanded groups.
- */
-void pidgin_blist_theme_set_collapsed_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_contact_color:
- * @theme: The PidginBlist theme.
- * @color: The color to use for contacts and chats.
- *
- * Sets the background color to be used for contacts and chats.
- */
-void pidgin_blist_theme_set_contact_color(PidginBlistTheme *theme, const GdkRGBA *color);
-
-/**
- * pidgin_blist_theme_set_contact_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for expanded contacts.
- */
-void pidgin_blist_theme_set_contact_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_online_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for online buddies.
- */
-void pidgin_blist_theme_set_online_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_away_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for away and idle buddies.
- */
-void pidgin_blist_theme_set_away_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_offline_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for offline buddies.
- */
-void pidgin_blist_theme_set_offline_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_idle_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for idle buddies.
- */
-void pidgin_blist_theme_set_idle_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_unread_message_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for buddies with unread messages.
- */
-void pidgin_blist_theme_set_unread_message_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_unread_message_nick_said_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for a chat with unread messages
- * that mention your nick.
- */
-void pidgin_blist_theme_set_unread_message_nick_said_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-/**
- * pidgin_blist_theme_set_status_text_info:
- * @theme: The PidginBlist theme.
- * @pair: The new text font and color pair.
- *
- * Sets the text color and font to be used for buddy status messages.
- */
-void pidgin_blist_theme_set_status_text_info(PidginBlistTheme *theme, const PidginThemeFont *pair);
-
-G_END_DECLS
-
-#endif /* PIDGIN_BLIST_THEME_H */
--- a/pidgin/gtkblist.c Sun Feb 07 01:42:09 2021 -0600
+++ b/pidgin/gtkblist.c Fri Feb 12 00:17:08 2021 -0600
@@ -36,8 +36,6 @@
#include "gtkroomlist.h"
#include "gtkstatusbox.h"
#include "gtkscrollbook.h"
-#include "gtkblist-theme.h"
-#include "gtkblist-theme-loader.h"
#include "gtkutils.h"
#include "pidgin/minidialog.h"
#include "pidgin/pidginaccountchooser.h"
@@ -116,8 +114,6 @@
*/
PidginMiniDialog *signed_on_elsewhere;
- PidginBlistTheme *current_theme;
-
guint select_notebook_page_timeout;
@@ -3788,28 +3784,10 @@
return ret;
}
-static const char *
-theme_font_get_color_default(PidginThemeFont *font, const char *def)
-{
- const char *ret;
- if (!font || !(ret = pidgin_theme_font_get_color_describe(font)))
- ret = def;
- return ret;
-}
-
-static const char *
-theme_font_get_face_default(PidginThemeFont *font, const char *def)
-{
- const char *ret;
- if (!font || !(ret = pidgin_theme_font_get_font_face(font)))
- ret = def;
- return ret;
-}
-
gchar *
pidgin_blist_get_name_markup(PurpleBuddy *b, gboolean selected, gboolean aliased)
{
- const char *name, *name_color, *name_font, *status_color, *status_font, *dim_grey;
+ const char *name, *status_color, *dim_grey;
char *text = NULL;
PurpleProtocol *protocol = NULL;
PurpleContact *contact;
@@ -3819,8 +3797,6 @@
PurpleConversation *conv = find_conversation_with_buddy(b);
gboolean hidden_conv = FALSE;
gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
- PidginThemeFont *statusfont = NULL, *namefont = NULL;
- PidginBlistTheme *theme;
gchar *contact_alias;
if (conv != NULL) {
@@ -3909,50 +3885,18 @@
}
}
- /* choose the colors of the text */
- theme = pidgin_blist_get_theme();
- name_color = NULL;
-
dim_grey = pidgin_style_context_is_dark() ? "light slate grey" : "dim grey";
- if (theme) {
- if (purple_presence_is_idle(presence)) {
- namefont = statusfont = pidgin_blist_theme_get_idle_text_info(theme);
- name_color = dim_grey;
- } else if (!purple_presence_is_online(presence)) {
- namefont = pidgin_blist_theme_get_offline_text_info(theme);
- name_color = dim_grey;
- statusfont = pidgin_blist_theme_get_status_text_info(theme);
- } else if (purple_presence_is_available(presence)) {
- namefont = pidgin_blist_theme_get_online_text_info(theme);
- statusfont = pidgin_blist_theme_get_status_text_info(theme);
- } else {
- namefont = pidgin_blist_theme_get_away_text_info(theme);
- statusfont = pidgin_blist_theme_get_status_text_info(theme);
+ if(!selected) {
+ if(purple_presence_is_idle(presence) ||
+ !purple_presence_is_online(presence))
+ {
+ status_color = dim_grey;
}
- } else {
- if (!selected
- && (purple_presence_is_idle(presence)
- || !purple_presence_is_online(presence)))
- {
- name_color = dim_grey;
- }
- }
-
- name_color = theme_font_get_color_default(namefont, name_color);
- name_font = theme_font_get_face_default(namefont, "");
-
- status_color = theme_font_get_color_default(statusfont, dim_grey);
- status_font = theme_font_get_face_default(statusfont, "");
-
- if (aliased && selected) {
- if (theme) {
- name_color = "black";
- status_color = "black";
- } else {
- name_color = NULL;
- status_color = NULL;
- }
+ }
+
+ if(aliased && selected) {
+ status_color = NULL;
}
if (hidden_conv) {
@@ -3964,36 +3908,22 @@
/* Put it all together */
if ((!aliased || biglist) && (statustext || idletime)) {
/* using <span size='smaller'> breaks the status, so it must be seperated into <small><span>*/
- if (name_color) {
- text = g_strdup_printf("<span font_desc='%s' foreground='%s'>%s</span>\n"
- "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
- name_font, name_color, nametext, status_font, status_color,
- idletime != NULL ? idletime : "",
- (idletime != NULL && statustext != NULL) ? " - " : "",
- statustext != NULL ? statustext : "");
- } else if (status_color) {
- text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
- "<small><span font_desc='%s' foreground='%s'>%s%s%s</span></small>",
- name_font, nametext, status_font, status_color,
+ if (status_color) {
+ text = g_strdup_printf("<span foreground='%s'>%s</span>\n"
+ "<small><span foreground='%s'>%s%s%s</span></small>",
+ status_color, nametext, status_color,
idletime != NULL ? idletime : "",
(idletime != NULL && statustext != NULL) ? " - " : "",
statustext != NULL ? statustext : "");
} else {
- text = g_strdup_printf("<span font_desc='%s'>%s</span>\n"
- "<small><span font_desc='%s'>%s%s%s</span></small>",
- name_font, nametext, status_font,
+ text = g_strdup_printf("%s\n<small>%s%s%s</small>",
+ nametext,
idletime != NULL ? idletime : "",
(idletime != NULL && statustext != NULL) ? " - " : "",
statustext != NULL ? statustext : "");
}
} else {
- if (name_color) {
- text = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
- name_font, name_color, nametext);
- } else {
- text = g_strdup_printf("<span font_desc='%s'>%s</span>", name_font,
- nametext);
- }
+ text = g_strdup_printf("%s", nametext);
}
g_free(nametext);
g_free(statustext);
@@ -5035,22 +4965,12 @@
pidgin_blist_build_layout(PurpleBuddyList *list)
{
GtkTreeViewColumn *column;
- PidginBlistLayout *layout;
- PidginBlistTheme *theme;
GtkCellRenderer *rend;
gint i, status_icon = 0, text = 1, emblem = 2, protocol_icon = 3, buddy_icon = 4;
column = gtkblist->text_column;
- if ((theme = pidgin_blist_get_theme()) != NULL && (layout = pidgin_blist_theme_get_layout(theme)) != NULL) {
- status_icon = layout->status_icon ;
- text = layout->text;
- emblem = layout->emblem;
- protocol_icon = layout->protocol_icon;
- buddy_icon = layout->buddy_icon;
- }
-
gtk_tree_view_column_clear(column);
/* group */
@@ -5204,7 +5124,6 @@
GtkWidget *label;
GtkWidget *close;
gchar *text;
- const char *theme_name;
GtkTreeSelection *selection;
GtkTargetEntry dte[] = {{"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, DRAG_ROW},
{"application/x-im-contact", 0, DRAG_BUDDY},
@@ -5222,15 +5141,6 @@
gtkblist = PIDGIN_BUDDY_LIST(list);
priv = pidgin_buddy_list_get_instance_private(gtkblist);
- if (priv->current_theme)
- g_object_unref(priv->current_theme);
-
- theme_name = purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme");
- if (theme_name && *theme_name)
- priv->current_theme = g_object_ref(PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(theme_name, "blist")));
- else
- priv->current_theme = NULL;
-
gtkblist->empty_avatar = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, 32, 32);
gdk_pixbuf_fill(gtkblist->empty_avatar, 0x00000000);
@@ -5757,18 +5667,10 @@
gboolean expanded;
GdkRGBA *bgcolor = NULL;
GdkPixbuf *avatar = NULL;
- PidginBlistTheme *theme = NULL;
if(!insert_node(list, gnode, &iter))
return;
- if ((theme = pidgin_blist_get_theme()) == NULL)
- bgcolor = NULL;
- else if (purple_blist_node_get_bool(gnode, "collapsed") || count <= 0)
- bgcolor = pidgin_blist_theme_get_collapsed_background_color(theme);
- else
- bgcolor = pidgin_blist_theme_get_expanded_background_color(theme);
-
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);
@@ -5803,14 +5705,10 @@
static char *pidgin_get_group_title(PurpleBlistNode *gnode, gboolean expanded)
{
PurpleGroup *group;
- gboolean selected;
char group_count[12] = "";
char *mark, *esc;
PurpleBlistNode *selected_node = NULL;
GtkTreeIter iter;
- PidginThemeFont *pair;
- gchar const *text_color, *text_font;
- PidginBlistTheme *theme;
group = (PurpleGroup*)gnode;
@@ -5818,7 +5716,6 @@
gtk_tree_model_get(GTK_TREE_MODEL(gtkblist->treemodel), &iter,
NODE_COLUMN, &selected_node, -1);
}
- selected = (gnode == selected_node);
if (!expanded) {
g_snprintf(group_count, sizeof(group_count), "%d/%d",
@@ -5826,33 +5723,13 @@
purple_counting_node_get_current_size(PURPLE_COUNTING_NODE(group)));
}
- theme = pidgin_blist_get_theme();
- if (theme == NULL)
- pair = NULL;
- else if (expanded)
- pair = pidgin_blist_theme_get_expanded_text_info(theme);
- else
- pair = pidgin_blist_theme_get_collapsed_text_info(theme);
-
-
- text_color = selected ? NULL : theme_font_get_color_default(pair, NULL);
- text_font = theme_font_get_face_default(pair, "");
-
esc = g_markup_escape_text(purple_group_get_name(group), -1);
- if (text_color) {
- mark = g_strdup_printf("<span foreground='%s' font_desc='%s'><b>%s</b>%s%s%s</span>",
- text_color, text_font,
- esc ? esc : "",
- !expanded ? " <span weight='light'>(</span>" : "",
- group_count,
- !expanded ? "<span weight='light'>)</span>" : "");
- } else {
- mark = g_strdup_printf("<span font_desc='%s'><b>%s</b>%s%s%s</span>",
- text_font, esc ? esc : "",
- !expanded ? " <span weight='light'>(</span>" : "",
- group_count,
- !expanded ? "<span weight='light'>)</span>" : "");
- }
+
+ mark = g_strdup_printf("<span><b>%s</b>%s%s%s</span>",
+ esc ? esc : "",
+ !expanded ? " <span weight='light'>(</span>" : "",
+ group_count,
+ !expanded ? "<span weight='light'>)</span>" : "");
g_free(esc);
return mark;
@@ -5868,7 +5745,6 @@
char *idle = NULL;
gboolean selected = (gtkblist->selected_node == node);
gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
- PidginBlistTheme *theme;
if(editing_blist) {
return;
@@ -5895,8 +5771,6 @@
emblem = pidgin_blist_get_emblem(PURPLE_BLIST_NODE(buddy));
mark = pidgin_blist_get_name_markup(buddy, selected, TRUE);
- theme = pidgin_blist_get_theme();
-
if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_idle_time") &&
purple_presence_is_idle(presence) && !biglist)
{
@@ -5904,7 +5778,6 @@
if (idle_secs > 0)
{
- PidginThemeFont *pair = NULL;
const gchar *textcolor;
time_t t;
int ihrs, imin;
@@ -5913,31 +5786,23 @@
ihrs = (t - idle_secs) / 3600;
imin = ((t - idle_secs) / 60) % 60;
- if (selected)
+ if(selected) {
textcolor = NULL;
- else if (theme != NULL && (pair = pidgin_blist_theme_get_idle_text_info(theme)) != NULL)
- textcolor = pidgin_theme_font_get_color_describe(pair);
- else
- /* If no theme them default to making idle buddy names grey */
+ } else {
textcolor = pidgin_style_context_is_dark() ? "light slate grey" : "dim grey";
-
- if (textcolor) {
- idle = g_strdup_printf("<span color='%s' font_desc='%s'>%d:%02d</span>",
- textcolor, theme_font_get_face_default(pair, ""),
- ihrs, imin);
+ }
+
+ if(textcolor) {
+ idle = g_strdup_printf("<span color='%s'>%d:%02d</span>",
+ textcolor, ihrs, imin);
} else {
- idle = g_strdup_printf("<span font_desc='%s'>%d:%02d</span>",
- theme_font_get_face_default(pair, ""),
- ihrs, imin);
+ idle = g_strdup_printf("<span>%d:%02d</span>", ihrs, imin);
}
}
}
protocol_icon = pidgin_create_protocol_icon(purple_buddy_get_account(buddy), PIDGIN_PROTOCOL_ICON_SMALL);
- if (theme != NULL)
- color = pidgin_blist_theme_get_contact_color(theme);
-
gtk_tree_store_set(gtkblist->treemodel, iter,
STATUS_ICON_COLUMN, status,
STATUS_ICON_VISIBLE_COLUMN, TRUE,
@@ -6009,32 +5874,10 @@
if(gtknode->contact_expanded) {
GdkPixbuf *status;
gchar *mark, *tmp;
- const gchar *fg_color, *font;
GdkRGBA *color = NULL;
- PidginBlistTheme *theme;
- PidginThemeFont *pair;
- gboolean selected = (gtkblist->selected_node == cnode);
mark = g_markup_escape_text(purple_contact_get_alias(contact), -1);
-
- theme = pidgin_blist_get_theme();
- if (theme == NULL)
- pair = NULL;
- else {
- pair = pidgin_blist_theme_get_contact_text_info(theme);
- color = pidgin_blist_theme_get_contact_color(theme);
- }
-
- font = theme_font_get_face_default(pair, "");
- fg_color = selected ? NULL : theme_font_get_color_default(pair, NULL);
-
- if (fg_color) {
- tmp = g_strdup_printf("<span font_desc='%s' color='%s'>%s</span>",
- font, fg_color, mark);
- } else {
- tmp = g_strdup_printf("<span font_desc='%s'>%s</span>", font,
- mark);
- }
+ tmp = g_strdup_printf("<span>%s</span>", mark);
g_free(mark);
mark = tmp;
@@ -6115,7 +5958,7 @@
if(purple_account_is_connected(purple_chat_get_account(chat))) {
GtkTreeIter iter;
GdkPixbuf *status, *avatar, *emblem, *protocol_icon;
- const gchar *color, *font;
+ const gchar *color = NULL;
gchar *mark, *tmp;
gboolean showicons = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
gboolean biglist = purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/show_buddy_icons");
@@ -6123,8 +5966,6 @@
PurpleConversation *conv;
gboolean hidden = FALSE;
GdkRGBA *bgcolor = NULL;
- PidginThemeFont *pair;
- PidginBlistTheme *theme;
gboolean selected = (gtkblist->selected_node == node);
gboolean nick_said = FALSE;
@@ -6150,37 +5991,23 @@
mark = g_markup_escape_text(purple_chat_get_name(chat), -1);
- theme = pidgin_blist_get_theme();
-
- if (theme == NULL)
- pair = NULL;
- else if (nick_said)
- pair = pidgin_blist_theme_get_unread_message_nick_said_text_info(theme);
- else if (hidden)
- pair = pidgin_blist_theme_get_unread_message_text_info(theme);
- else pair = pidgin_blist_theme_get_online_text_info(theme);
-
-
- font = theme_font_get_face_default(pair, "");
- if (selected || !(color = theme_font_get_color_default(pair, NULL)))
+ if(selected ) {
/* nick_said color is the same as gtkconv:tab-label-attention */
color = (nick_said ? "#006aff" : NULL);
-
- if (color) {
- tmp = g_strdup_printf("<span font_desc='%s' color='%s' weight='%s'>%s</span>",
- font, color, hidden ? "bold" : "normal", mark);
+ }
+
+ if(color) {
+ tmp = g_strdup_printf("<span color='%s' weight='%s'>%s</span>",
+ color, hidden ? "bold" : "normal", mark);
} else {
- tmp = g_strdup_printf("<span font_desc='%s' weight='%s'>%s</span>",
- font, hidden ? "bold" : "normal", mark);
+ tmp = g_strdup_printf("<span weight='%s'>%s</span>",
+ hidden ? "bold" : "normal", mark);
}
g_free(mark);
mark = tmp;
protocol_icon = pidgin_create_protocol_icon(purple_chat_get_account(chat), PIDGIN_PROTOCOL_ICON_SMALL);
- if (theme != NULL)
- bgcolor = pidgin_blist_theme_get_contact_color(theme);
-
gtk_tree_store_set(gtkblist->treemodel, &iter,
STATUS_ICON_COLUMN, status,
STATUS_ICON_VISIBLE_COLUMN, TRUE,
@@ -6799,39 +6626,6 @@
buddy, g_object_unref);
}
-void
-pidgin_blist_set_theme(PidginBlistTheme *theme)
-{
- PidginBuddyListPrivate *priv =
- pidgin_buddy_list_get_instance_private(gtkblist);
- PurpleBuddyList *list = purple_blist_get_default();
-
- if (theme != NULL)
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme",
- purple_theme_get_name(PURPLE_THEME(theme)));
- else
- purple_prefs_set_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
-
- if (priv->current_theme)
- g_object_unref(priv->current_theme);
-
- priv->current_theme = theme ? g_object_ref(theme) : NULL;
-
- pidgin_blist_build_layout(list);
-
- pidgin_blist_refresh(list);
-}
-
-
-PidginBlistTheme *
-pidgin_blist_get_theme()
-{
- PidginBuddyListPrivate *priv =
- pidgin_buddy_list_get_instance_private(gtkblist);
-
- return priv->current_theme;
-}
-
void pidgin_blist_init(void)
{
void *gtk_blist_handle = pidgin_blist_get_handle();
@@ -6852,8 +6646,6 @@
purple_prefs_add_int(PIDGIN_PREFS_ROOT "/blist/height", 405); /* Golden ratio, baby */
purple_prefs_add_string(PIDGIN_PREFS_ROOT "/blist/theme", "");
- purple_theme_manager_register_type(g_object_new(PIDGIN_TYPE_BLIST_THEME_LOADER, "type", "blist", NULL));
-
/* Register our signals */
purple_signal_register(gtk_blist_handle, "gtkblist-hiding",
purple_marshal_VOID__POINTER, G_TYPE_NONE, 1,
@@ -6937,7 +6729,6 @@
g_clear_object(&gtkblist->treemodel);
g_object_unref(G_OBJECT(gtkblist->empty_avatar));
- g_clear_object(&priv->current_theme);
if (priv->select_notebook_page_timeout) {
g_source_remove(priv->select_notebook_page_timeout);
}
--- a/pidgin/gtkblist.h Sun Feb 07 01:42:09 2021 -0600
+++ b/pidgin/gtkblist.h Fri Feb 12 00:17:08 2021 -0600
@@ -29,6 +29,10 @@
* @see_also: <link linkend="chapter-signals-gtkblist">Buddy List signals</link>
*/
+#include <gtk/gtk.h>
+
+#include <purple.h>
+
#define PIDGIN_TYPE_BUDDY_LIST (pidgin_buddy_list_get_type())
typedef struct _PidginBuddyList PidginBuddyList;
@@ -39,10 +43,6 @@
} PidginStatusIconSize;
-#include <purple.h>
-
-#include "gtkblist-theme.h"
-
/**************************************************************************
* Structures
**************************************************************************/
@@ -272,23 +272,6 @@
*/
void pidgin_blist_add_alert(GtkWidget *widget);
-/**
- * pidgin_blist_set_theme:
- * @theme: the new theme to use
- *
- * Sets the current theme for Pidgin to use
- */
-void pidgin_blist_set_theme(PidginBlistTheme *theme);
-
-/**
- * pidgin_blist_get_theme:
- *
- * Gets Pidgin's current buddy list theme
- *
- * Returns: (transfer none): the current theme
- */
-PidginBlistTheme *pidgin_blist_get_theme(void);
-
/**************************************************************************
* GTK+ Buddy List sorting functions
**************************************************************************/
--- a/pidgin/gtkprefs.c Sun Feb 07 01:42:09 2021 -0600
+++ b/pidgin/gtkprefs.c Fri Feb 12 00:17:08 2021 -0600
@@ -204,7 +204,6 @@
/* Themes page */
struct {
SoupSession *session;
- GtkWidget *blist;
GtkWidget *status;
GtkWidget *smiley;
} theme;
@@ -238,12 +237,10 @@
static PidginPrefsWindow *prefs = NULL;
/* Themes page */
-static GtkWidget *prefs_blist_themes_combo_box;
static GtkWidget *prefs_status_themes_combo_box;
static GtkWidget *prefs_smiley_themes_combo_box;
/* These exist outside the lifetime of the prefs dialog */
-static GtkListStore *prefs_blist_themes;
static GtkListStore *prefs_status_icon_themes;
static GtkListStore *prefs_smiley_themes;
@@ -852,7 +849,6 @@
purple_prefs_disconnect_by_handle(prefs);
/* NULL-ify globals */
- prefs_blist_themes_combo_box = NULL;
prefs_status_themes_combo_box = NULL;
prefs_smiley_themes_combo_box = NULL;
@@ -915,13 +911,10 @@
gchar *image_full = NULL, *markup;
const gchar *name, *author, *description;
- if (PIDGIN_IS_BLIST_THEME(theme) || PIDGIN_IS_STATUS_ICON_THEME(theme)){
+ if (PIDGIN_IS_STATUS_ICON_THEME(theme)){
GtkListStore *store;
- if (PIDGIN_IS_BLIST_THEME(theme))
- store = prefs_blist_themes;
- else
- store = prefs_status_icon_themes;
+ store = prefs_status_icon_themes;
image_full = purple_theme_get_image_full(theme);
if (image_full != NULL){
@@ -985,14 +978,6 @@
pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE);
g_free(tmp);
- /* blist themes */
- gtk_list_store_clear(prefs_blist_themes);
- gtk_list_store_append(prefs_blist_themes, &iter);
- tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"),
- _("The default Pidgin buddy list theme"));
- gtk_list_store_set(prefs_blist_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1);
- g_free(tmp);
-
/* status icon themes */
gtk_list_store_clear(prefs_status_icon_themes);
gtk_list_store_append(prefs_status_icon_themes, &iter);
@@ -1010,7 +995,6 @@
smileys_refresh_theme_list();
/* set active */
- prefs_set_active_theme_combo(prefs_blist_themes_combo_box, prefs_blist_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/blist/theme"));
prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme"));
prefs_set_active_theme_combo(prefs_smiley_themes_combo_box, prefs_smiley_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/smileys/theme"));
}
@@ -1019,8 +1003,6 @@
static void
prefs_themes_init(void)
{
- prefs_blist_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
-
prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
prefs_smiley_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING);
@@ -1431,27 +1413,6 @@
return ret;
}
-/* sets the current buddy list theme */
-static void
-prefs_set_blist_theme_cb(GtkComboBox *combo_box, gpointer user_data)
-{
- PidginBlistTheme *theme = NULL;
- GtkTreeIter iter;
- gchar *name = NULL;
-
- if(gtk_combo_box_get_active_iter(combo_box, &iter)) {
-
- gtk_tree_model_get(GTK_TREE_MODEL(prefs_blist_themes), &iter, 2, &name, -1);
-
- if(!name || *name)
- theme = PIDGIN_BLIST_THEME(purple_theme_manager_find_theme(name, "blist"));
-
- g_free(name);
-
- pidgin_blist_set_theme(theme);
- }
-}
-
/* sets the current icon theme */
static void
prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data)
@@ -1477,11 +1438,6 @@
static void
bind_theme_page(PidginPrefsWindow *win)
{
- /* Buddy List Themes */
- prefs_build_theme_combo_box(win->theme.blist, prefs_blist_themes,
- PIDGIN_PREFS_ROOT "/blist/theme", "blist");
- prefs_blist_themes_combo_box = win->theme.blist;
-
/* Status Icon Themes */
prefs_build_theme_combo_box(win->theme.status, prefs_status_icon_themes,
PIDGIN_PREFS_ROOT "/status/icon-theme",
@@ -2971,14 +2927,10 @@
/* Themes page */
gtk_widget_class_bind_template_child(
- widget_class, PidginPrefsWindow, theme.blist);
- gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, theme.status);
gtk_widget_class_bind_template_child(
widget_class, PidginPrefsWindow, theme.smiley);
gtk_widget_class_bind_template_callback(widget_class,
- prefs_set_blist_theme_cb);
- gtk_widget_class_bind_template_callback(widget_class,
prefs_set_status_icon_theme_cb);
gtk_widget_class_bind_template_callback(widget_class,
prefs_set_smiley_theme_cb);
--- a/pidgin/meson.build Sun Feb 07 01:42:09 2021 -0600
+++ b/pidgin/meson.build Fri Feb 12 00:17:08 2021 -0600
@@ -2,8 +2,6 @@
'pidginstock.c',
'gtkaccount.c',
'gtkblist.c',
- 'gtkblist-theme.c',
- 'gtkblist-theme-loader.c',
'gtkconn.c',
'gtkconv.c',
'gtkdialogs.c',
@@ -70,8 +68,6 @@
libpidgin_headers = [
'gtkaccount.h',
'gtkblist.h',
- 'gtkblist-theme.h',
- 'gtkblist-theme-loader.h',
'gtkconn.h',
'gtkconv.h',
'gtkconvwin.h',
--- a/pidgin/resources/Prefs/prefs.ui Sun Feb 07 01:42:09 2021 -0600
+++ b/pidgin/resources/Prefs/prefs.ui Fri Feb 12 00:17:08 2021 -0600
@@ -2455,60 +2455,6 @@
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
- <object class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Buddy List Theme:</property>
- <property name="xalign">0</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkComboBox" id="theme.blist">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <signal name="changed" handler="prefs_set_blist_theme_cb" swapped="no"/>
- <child>
- <object class="GtkCellRendererPixbuf">
- <property name="width">32</property>
- <property name="height">32</property>
- </object>
- <attributes>
- <attribute name="pixbuf">0</attribute>
- </attributes>
- </child>
- <child>
- <object class="GtkCellRendererText">
- <property name="ellipsize">end</property>
- </object>
- <attributes>
- <attribute name="markup">1</attribute>
- </attributes>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="spacing">6</property>
- <child>
<object class="GtkLabel" id="label20">
<property name="visible">True</property>
<property name="can_focus">False</property>
@@ -2705,14 +2651,12 @@
</object>
<object class="GtkSizeGroup" id="theme.combo_sg">
<widgets>
- <widget name="theme.blist"/>
<widget name="theme.status"/>
<widget name="theme.smiley"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="theme.label_sg">
<widgets>
- <widget name="label19"/>
<widget name="label20"/>
<widget name="label18"/>
</widgets>
--- a/po/POTFILES.in Sun Feb 07 01:42:09 2021 -0600
+++ b/po/POTFILES.in Fri Feb 12 00:17:08 2021 -0600
@@ -313,8 +313,6 @@
libpurple/xmlnode.c
pidgin/gtkaccount.c
pidgin/gtkblist.c
-pidgin/gtkblist-theme.c
-pidgin/gtkblist-theme-loader.c
pidgin/gtkconn.c
pidgin/gtkconv.c
pidgin/gtkdialogs.c