grim/pidgin

Parents 4103b3869912
Children 679186b6eb95
Remove the libpurple support for themes now that all of the ui support has been removed

Testing Done:
Compiled and ran pidgin3

Reviewed at https://reviews.imfreedom.org/r/1117/
--- a/libpurple/core.c Thu Nov 11 23:19:07 2021 -0600
+++ b/libpurple/core.c Mon Nov 15 02:21:18 2021 -0600
@@ -44,7 +44,6 @@
#include "signals.h"
#include "status.h"
#include "stun.h"
-#include "theme-manager.h"
#include "util.h"
struct PurpleCore
@@ -152,8 +151,6 @@
*/
purple_plugins_init();
- purple_theme_manager_init();
-
/* The buddy icon code uses the image store, so init it early. */
_purple_image_store_init();
@@ -187,9 +184,6 @@
if (ops != NULL && ops->ui_init != NULL)
ops->ui_init();
- /* The UI may have registered some theme types, so refresh them */
- purple_theme_manager_refresh();
-
/* Load the buddy list after UI init */
purple_blist_boot();
@@ -234,7 +228,6 @@
purple_savedstatuses_uninit();
purple_statuses_uninit();
purple_accounts_uninit();
- purple_theme_manager_uninit();
purple_xfers_uninit();
purple_proxy_uninit();
_purple_image_store_uninit();
--- a/libpurple/meson.build Thu Nov 11 23:19:07 2021 -0600
+++ b/libpurple/meson.build Mon Nov 15 02:21:18 2021 -0600
@@ -87,9 +87,6 @@
'signals.c',
'status.c',
'stun.c',
- 'theme.c',
- 'theme-loader.c',
- 'theme-manager.c',
'trie.c',
'upnp.c',
'util.c',
@@ -184,9 +181,6 @@
'status.h',
'stun.h',
'tests.h',
- 'theme.h',
- 'theme-loader.h',
- 'theme-manager.h',
'trie.h',
'upnp.h',
'util.h',
--- a/libpurple/theme-loader.c Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-/*
- * ThemeLoaders for libpurple
- *
- * 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 "internal.h"
-#include "theme-loader.h"
-
-void purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type);
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-typedef struct {
- gchar *type;
-} PurpleThemeLoaderPrivate;
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-
-enum {
- PROP_ZERO = 0,
- PROP_TYPE,
- PROP_LAST
-};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-static GParamSpec *properties[PROP_LAST];
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleThemeLoader, purple_theme_loader,
- G_TYPE_OBJECT);
-
-/******************************************************************************
- * GObject Stuff *
- *****************************************************************************/
-
-static void
-purple_theme_loader_get_property(GObject *obj, guint param_id, GValue *value,
- GParamSpec *psec)
-{
- PurpleThemeLoader *theme_loader = PURPLE_THEME_LOADER(obj);
-
- switch (param_id) {
- case PROP_TYPE:
- g_value_set_string(value, purple_theme_loader_get_type_string(theme_loader));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static void
-purple_theme_loader_set_property(GObject *obj, guint param_id, const GValue *value,
- GParamSpec *psec)
-{
- PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
-
- switch (param_id) {
- case PROP_TYPE:
- purple_theme_loader_set_type_string(loader, g_value_get_string(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static gboolean
-purple_theme_loader_probe_directory(PurpleThemeLoader *loader, const gchar *dir)
-{
- const gchar *type = purple_theme_loader_get_type_string(loader);
- char *themedir;
- gboolean result;
-
- /* Checks for directory as $root/purple/$type */
- themedir = g_build_filename(dir, "purple", type, NULL);
- result = g_file_test(themedir, G_FILE_TEST_IS_DIR);
- g_free(themedir);
-
- return result;
-}
-
-static void
-purple_theme_loader_init(PurpleThemeLoader *loader)
-{
-}
-
-static void
-purple_theme_loader_finalize(GObject *obj)
-{
- PurpleThemeLoader *loader = PURPLE_THEME_LOADER(obj);
- PurpleThemeLoaderPrivate *priv =
- purple_theme_loader_get_instance_private(loader);
-
- g_free(priv->type);
-
- G_OBJECT_CLASS(purple_theme_loader_parent_class)->finalize(obj);
-}
-
-static void
-purple_theme_loader_class_init(PurpleThemeLoaderClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- obj_class->get_property = purple_theme_loader_get_property;
- obj_class->set_property = purple_theme_loader_set_property;
- obj_class->finalize = purple_theme_loader_finalize;
-
- /* TYPE STRING (read only) */
- properties[PROP_TYPE] = g_param_spec_string("type", "Type",
- "The string representing the type of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-}
-
-/*****************************************************************************
- * Public API functions
- *****************************************************************************/
-
-const gchar *
-purple_theme_loader_get_type_string(PurpleThemeLoader *theme_loader)
-{
- PurpleThemeLoaderPrivate *priv = NULL;
-
- g_return_val_if_fail(PURPLE_IS_THEME_LOADER(theme_loader), NULL);
-
- priv = purple_theme_loader_get_instance_private(theme_loader);
- return priv->type;
-}
-
-/* < private > */
-void
-purple_theme_loader_set_type_string(PurpleThemeLoader *loader, const gchar *type)
-{
- PurpleThemeLoaderPrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
-
- priv = purple_theme_loader_get_instance_private(loader);
-
- g_free(priv->type);
- priv->type = g_strdup(type);
-
- g_object_notify_by_pspec(G_OBJECT(loader), properties[PROP_TYPE]);
-}
-
-PurpleTheme *
-purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir)
-{
- return PURPLE_THEME_LOADER_GET_CLASS(loader)->purple_theme_loader_build(dir);
-}
-
-gboolean
-purple_theme_loader_probe(PurpleThemeLoader *loader, const gchar *dir)
-{
- if (PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory != NULL)
- return PURPLE_THEME_LOADER_GET_CLASS(loader)->probe_directory(dir);
- else
- return purple_theme_loader_probe_directory(loader, dir);
-}
-
--- a/libpurple/theme-loader.h Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * 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, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_THEME_LOADER_H
-#define PURPLE_THEME_LOADER_H
-
-/**
- * SECTION:theme-loader
- * @section_id: libpurple-theme-loader
- * @short_description: <filename>theme-loader.h</filename>
- * @title: Theme Loader Abstract Class
- *
- * The base class for all theme loaders.
- */
-
-#include <glib.h>
-#include <glib-object.h>
-#include "theme.h"
-
-/**
- * PURPLE_TYPE_THEME_LOADER:
- *
- * The standard _get_type macro for #PurpleThemeLoader.
- */
-#define PURPLE_TYPE_THEME_LOADER purple_theme_loader_get_type()
-
-struct _PurpleThemeLoaderClass
-{
- GObjectClass parent_class;
-
- PurpleTheme *(*purple_theme_loader_build)(const gchar *dir);
- gboolean (*probe_directory)(const gchar *dir);
-
- /*< private >*/
- void (*purple_reserved1)(void);
- void (*purple_reserved2)(void);
- void (*purple_reserved3)(void);
- void (*purple_reserved4)(void);
-};
-
-/**************************************************************************/
-/* Purple Theme-Loader API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * purple_theme_loader_get_type:
- *
- * The standard _get_type function for #GType's.
- *
- * Returns: The #GType for theme loader.
- */
-G_DECLARE_DERIVABLE_TYPE(PurpleThemeLoader, purple_theme_loader, PURPLE,
- THEME_LOADER, GObject)
-
-/**
- * purple_theme_loader_get_type_string:
- * @self: The theme loader
- *
- * Returns the string representing the type of the theme loader
- *
- * Returns: The string representing this type
- */
-const gchar *purple_theme_loader_get_type_string(PurpleThemeLoader *self);
-
-/**
- * purple_theme_loader_build:
- * @loader: The theme loader
- * @dir: The directory containing the theme
- *
- * Creates a new PurpleTheme
- *
- * Returns: (transfer full): A PurpleTheme containing the information from the directory
- */
-PurpleTheme *purple_theme_loader_build(PurpleThemeLoader *loader, const gchar *dir);
-
-/**
- * purple_theme_loader_probe:
- * @loader: The theme loader
- * @dir: The directory that may contain the theme
- *
- * Probes a directory to see if it might possibly contain a theme
- *
- * This function might only check for obvious files or directory structure.
- * Loading of a theme may fail for other reasons.
- * The default prober checks for $dir/purple/$type.
- *
- * Returns: TRUE if the directory appears to contain a theme, FALSE otherwise.
- */
-gboolean purple_theme_loader_probe(PurpleThemeLoader *loader, const gchar *dir);
-
-G_END_DECLS
-
-#endif /* PURPLE_THEME_LOADER_H */
--- a/libpurple/theme-manager.c Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,298 +0,0 @@
-/*
- * Themes for libpurple
- *
- * 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 "internal.h"
-#include "theme-manager.h"
-#include "util.h"
-
-struct _PurpleThemeManager {
- GObject parent;
-};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-static GHashTable *theme_table = NULL;
-
-/*****************************************************************************
- * GObject Stuff
- ****************************************************************************/
-
-GType
-purple_theme_manager_get_type(void)
-{
- static GType type = 0;
- if (type == 0) {
- static const GTypeInfo info = {
- sizeof(PurpleThemeManagerClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- NULL, /* class_init */
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof(PurpleThemeManager),
- 0, /* n_preallocs */
- NULL, /* instance_init */
- NULL, /* Value Table */
- };
- type = g_type_register_static(G_TYPE_OBJECT,
- "PurpleThemeManager", &info, 0);
- }
- return type;
-}
-
-/******************************************************************************
- * Helpers
- *****************************************************************************/
-
-/* makes a key of <type> + '/' + <name> */
-static gchar *
-purple_theme_manager_make_key(const gchar *name, const gchar *type)
-{
- g_return_val_if_fail(name && *name, NULL);
- g_return_val_if_fail(type && *type, NULL);
- return g_strconcat(type, "/", name, NULL);
-}
-
-/* returns TRUE if theme is of type "user_data" */
-static gboolean
-purple_theme_manager_is_theme_type(gchar *key,
- gpointer value,
- gchar *user_data)
-{
- return g_str_has_prefix(key, g_strconcat(user_data, "/", NULL));
-}
-
-static gboolean
-check_if_theme_or_loader(gchar *key, gpointer value, GSList **loaders)
-{
- if (PURPLE_IS_THEME(value))
- return TRUE;
- else if (PURPLE_IS_THEME_LOADER(value))
- *loaders = g_slist_prepend(*loaders, value);
-
- return FALSE;
-}
-
-static void
-purple_theme_manager_function_wrapper(gchar *key,
- gpointer value,
- PurpleThemeFunc user_data)
-{
- if (PURPLE_IS_THEME(value))
- (* user_data)(value);
-}
-
-static void
-purple_theme_manager_build_dir(GSList *loaders, const gchar *root)
-{
- gchar *theme_dir;
- const gchar *name;
- GDir *rdir;
- GSList *tmp;
- PurpleThemeLoader *loader;
-
- rdir = g_dir_open(root, 0, NULL);
-
- if (!rdir)
- return;
-
- while ((name = g_dir_read_name(rdir))) {
- theme_dir = g_build_filename(root, name, NULL);
-
- for (tmp = loaders; tmp; tmp = g_slist_next(tmp)) {
- loader = PURPLE_THEME_LOADER(tmp->data);
-
- if (purple_theme_loader_probe(loader, theme_dir)) {
- PurpleTheme *theme = purple_theme_loader_build(loader, theme_dir);
- if (PURPLE_IS_THEME(theme))
- purple_theme_manager_add_theme(theme);
- }
- }
-
- g_free(theme_dir);
- }
-
- g_dir_close(rdir);
-}
-
-/*****************************************************************************
- * Public API functions
- *****************************************************************************/
-
-void
-purple_theme_manager_init(void)
-{
- theme_table = g_hash_table_new_full(g_str_hash,
- g_str_equal, g_free, g_object_unref);
-}
-
-void
-purple_theme_manager_refresh(void)
-{
- gchar *path;
- const gchar *const *xdg_dirs;
- gint i;
- GSList *loaders = NULL;
-
- g_hash_table_foreach_remove(theme_table, (GHRFunc)check_if_theme_or_loader,
- &loaders);
-
- /* Add themes from ~/.purple */
- G_GNUC_BEGIN_IGNORE_DEPRECATIONS
- path = g_build_filename(purple_user_dir(), "themes", NULL);
- G_GNUC_END_IGNORE_DEPRECATIONS
- purple_theme_manager_build_dir(loaders, path);
- g_free(path);
-
- /* look for XDG_DATA_HOME */
- /* NOTE: will work on Windows, see g_get_user_data_dir() documentation */
- path = g_build_filename(g_get_user_data_dir(), "themes", NULL);
- purple_theme_manager_build_dir(loaders, path);
- g_free(path);
-
- /* now dig through XDG_DATA_DIRS and add those too */
- /* NOTE: will work on Windows, see g_get_system_data_dirs() documentation */
- xdg_dirs = g_get_system_data_dirs();
- for (i = 0; xdg_dirs[i] != NULL; i++) {
- path = g_build_filename(xdg_dirs[i], "themes", NULL);
- purple_theme_manager_build_dir(loaders, path);
- g_free(path);
- }
-
- g_slist_free(loaders);
-}
-
-void
-purple_theme_manager_uninit(void)
-{
- g_hash_table_destroy(theme_table);
-}
-
-void
-purple_theme_manager_register_type(PurpleThemeLoader *loader)
-{
- gchar *type;
-
- g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
-
- type = g_strdup(purple_theme_loader_get_type_string(loader));
- g_return_if_fail(type);
-
- /* if something is already there do nothing */
- if (!g_hash_table_lookup(theme_table, type))
- g_hash_table_insert(theme_table, type, loader);
-}
-
-void
-purple_theme_manager_unregister_type(PurpleThemeLoader *loader)
-{
- const gchar *type;
-
- g_return_if_fail(PURPLE_IS_THEME_LOADER(loader));
-
- type = purple_theme_loader_get_type_string(loader);
- g_return_if_fail(type);
-
- if (g_hash_table_lookup(theme_table, type) == loader)
- {
- g_hash_table_remove(theme_table, type);
-
- g_hash_table_foreach_remove(theme_table,
- (GHRFunc)purple_theme_manager_is_theme_type, (gpointer)type);
- } /* only free if given registered loader */
-}
-
-PurpleTheme *
-purple_theme_manager_find_theme(const gchar *name,
- const gchar *type)
-{
- gchar *key;
- PurpleTheme *theme;
-
- key = purple_theme_manager_make_key(name, type);
-
- g_return_val_if_fail(key, NULL);
-
- theme = g_hash_table_lookup(theme_table, key);
-
- g_free(key);
-
- return theme;
-}
-
-void
-purple_theme_manager_add_theme(PurpleTheme *theme)
-{
- gchar *key;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- key = purple_theme_manager_make_key(purple_theme_get_name(theme),
- purple_theme_get_type_string(theme));
-
- g_return_if_fail(key);
-
- /* if something is already there do nothing */
- if (g_hash_table_lookup(theme_table, key) == NULL)
- g_hash_table_insert(theme_table, key, theme);
-}
-
-void
-purple_theme_manager_remove_theme(PurpleTheme *theme)
-{
- gchar *key;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- key = purple_theme_manager_make_key(purple_theme_get_name(theme),
- purple_theme_get_type_string(theme));
-
- g_return_if_fail(key);
-
- g_hash_table_remove(theme_table, key);
-
- g_free(key);
-}
-
-void
-purple_theme_manager_for_each_theme(PurpleThemeFunc func)
-{
- g_return_if_fail(func);
-
- g_hash_table_foreach(theme_table,
- (GHFunc) purple_theme_manager_function_wrapper, func);
-}
-
-PurpleTheme *
-purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type)
-{
- PurpleThemeLoader *loader;
-
- g_return_val_if_fail(theme_dir != NULL && type != NULL, NULL);
-
- loader = g_hash_table_lookup(theme_table, type);
- g_return_val_if_fail(PURPLE_IS_THEME_LOADER(loader), NULL);
-
- return purple_theme_loader_build(loader, theme_dir);
-}
--- a/libpurple/theme-manager.h Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,157 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * 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, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_THEME_MANAGER_H
-#define PURPLE_THEME_MANAGER_H
-
-/**
- * SECTION:theme-manager
- * @section_id: libpurple-theme-manager
- * @short_description: <filename>theme-manager.h</filename>
- * @title: Theme Manager API
- *
- * The theme manager manages of all the available themes and allows you to load
- * them.
- */
-
-#include <glib-object.h>
-#include <glib.h>
-#include "theme.h"
-#include "theme-loader.h"
-
-typedef void (*PurpleThemeFunc) (PurpleTheme *theme);
-
-/**
- * PURPLE_TYPE_THEME_MANAGER:
- *
- * The standard _get_type macro for #PurpleThemeManager.
- */
-#define PURPLE_TYPE_THEME_MANAGER purple_theme_manager_get_type()
-
-/**************************************************************************/
-/* Purple Theme Manager API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * purple_theme_manager_get_type:
- *
- * The standard _get_type function for #GType's.
- *
- * Returns: The #GType for theme manager.
- */
-G_DECLARE_FINAL_TYPE(PurpleThemeManager, purple_theme_manager, PURPLE,
- THEME_MANAGER, GObject)
-
-/**
- * purple_theme_manager_init:
- *
- * Initializes the theme manager.
- */
-void purple_theme_manager_init(void);
-
-/**
- * purple_theme_manager_uninit:
- *
- * Uninitializes the manager then frees all the themes and loaders it is
- * responsible for.
- */
-void purple_theme_manager_uninit(void);
-
-/**
- * purple_theme_manager_refresh:
- *
- * Rebuilds all the themes in the theme manager.
- * (Removes all current themes but keeps the added loaders.)
- */
-void purple_theme_manager_refresh(void);
-
-/**
- * purple_theme_manager_find_theme:
- * @name: The name of the PurpleTheme.
- * @type: The type of the PurpleTheme.
- *
- * Finds the PurpleTheme object stored by the theme manager.
- *
- * Returns: (transfer none): The PurpleTheme, or NULL if it wasn't found.
- */
-PurpleTheme *purple_theme_manager_find_theme(const gchar *name, const gchar *type);
-
-/**
- * purple_theme_manager_add_theme:
- * @theme: The PurpleTheme to add to the manager.
- *
- * Adds a PurpleTheme to the theme manager. If the theme already exists
- * then this function does nothing.
- */
-void purple_theme_manager_add_theme(PurpleTheme *theme);
-
-/**
- * purple_theme_manager_remove_theme:
- * @theme: The PurpleTheme to remove from the manager.
- *
- * Removes a PurpleTheme from the theme manager and frees the theme.
- */
-void purple_theme_manager_remove_theme(PurpleTheme *theme);
-
-/**
- * purple_theme_manager_register_type:
- * @loader: The PurpleThemeLoader to add.
- *
- * Adds a loader to the theme manager so it knows how to build themes.
- */
-void purple_theme_manager_register_type(PurpleThemeLoader *loader);
-
-/**
- * purple_theme_manager_unregister_type:
- * @loader: The PurpleThemeLoader to be removed.
- *
- * Removes the loader and all themes of the same type from the loader.
- */
-void purple_theme_manager_unregister_type(PurpleThemeLoader *loader);
-
-/**
- * purple_theme_manager_for_each_theme:
- * @func: (scope call): The PurpleThemeFunc to be applied to each theme.
- *
- * Calls the given function on each purple theme.
- */
-void purple_theme_manager_for_each_theme(PurpleThemeFunc func);
-
-/**
- * purple_theme_manager_load_theme:
- * @theme_dir: the directory of the theme to load
- * @type: the type of theme to load
- *
- * Loads a theme of the given type without adding it to the manager
- *
- * Returns: (transfer full): The newly loaded theme.
- */
-PurpleTheme *purple_theme_manager_load_theme(const gchar *theme_dir, const gchar *type);
-
-G_END_DECLS
-
-#endif /* PURPLE_THEME_MANAGER_H */
--- a/libpurple/theme.c Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,389 +0,0 @@
-/*
- * Themes for libpurple
- *
- * 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 "internal.h"
-#include "theme.h"
-#include "util.h"
-
-void purple_theme_set_type_string(PurpleTheme *theme, const gchar *type);
-
-/******************************************************************************
- * Structs
- *****************************************************************************/
-
-typedef struct {
- gchar *name;
- gchar *description;
- gchar *author;
- gchar *type;
- gchar *dir;
- gchar *img;
-} PurpleThemePrivate;
-
-/******************************************************************************
- * Enums
- *****************************************************************************/
-
-enum {
- PROP_ZERO = 0,
- PROP_NAME,
- PROP_DESCRIPTION,
- PROP_AUTHOR,
- PROP_TYPE,
- PROP_DIR,
- PROP_IMAGE,
- PROP_LAST
-};
-
-/******************************************************************************
- * Globals
- *****************************************************************************/
-
-static GParamSpec *properties[PROP_LAST];
-
-G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PurpleTheme, purple_theme, G_TYPE_OBJECT);
-
-/******************************************************************************
- * GObject Stuff
- *****************************************************************************/
-
-static void
-purple_theme_get_property(GObject *obj, guint param_id, GValue *value,
- GParamSpec *psec)
-{
- PurpleTheme *theme = PURPLE_THEME(obj);
-
- switch (param_id) {
- case PROP_NAME:
- g_value_set_string(value, purple_theme_get_name(theme));
- break;
- case PROP_DESCRIPTION:
- g_value_set_string(value, purple_theme_get_description(theme));
- break;
- case PROP_AUTHOR:
- g_value_set_string(value, purple_theme_get_author(theme));
- break;
- case PROP_TYPE:
- g_value_set_string(value, purple_theme_get_type_string(theme));
- break;
- case PROP_DIR:
- g_value_set_string(value, purple_theme_get_dir(theme));
- break;
- case PROP_IMAGE:
- g_value_set_string(value, purple_theme_get_image(theme));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static void
-purple_theme_set_property(GObject *obj, guint param_id, const GValue *value,
- GParamSpec *psec)
-{
- PurpleTheme *theme = PURPLE_THEME(obj);
-
- switch (param_id) {
- case PROP_NAME:
- purple_theme_set_name(theme, g_value_get_string(value));
- break;
- case PROP_DESCRIPTION:
- purple_theme_set_description(theme, g_value_get_string(value));
- break;
- case PROP_AUTHOR:
- purple_theme_set_author(theme, g_value_get_string(value));
- break;
- case PROP_TYPE:
- purple_theme_set_type_string(theme, g_value_get_string(value));
- break;
- case PROP_DIR:
- purple_theme_set_dir(theme, g_value_get_string(value));
- break;
- case PROP_IMAGE:
- purple_theme_set_image(theme, g_value_get_string(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, param_id, psec);
- break;
- }
-}
-
-static void
-purple_theme_init(PurpleTheme *theme)
-{
-}
-
-static void
-purple_theme_finalize(GObject *obj)
-{
- PurpleTheme *theme = PURPLE_THEME(obj);
- PurpleThemePrivate *priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->name);
- g_free(priv->description);
- g_free(priv->author);
- g_free(priv->type);
- g_free(priv->dir);
- g_free(priv->img);
-
- G_OBJECT_CLASS(purple_theme_parent_class)->finalize(obj);
-}
-
-static void
-purple_theme_class_init(PurpleThemeClass *klass)
-{
- GObjectClass *obj_class = G_OBJECT_CLASS(klass);
-
- obj_class->get_property = purple_theme_get_property;
- obj_class->set_property = purple_theme_set_property;
- obj_class->finalize = purple_theme_finalize;
-
- /* NAME */
- properties[PROP_NAME] = g_param_spec_string("name", "Name",
- "The name of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-
- /* DESCRIPTION */
- properties[PROP_DESCRIPTION] = g_param_spec_string("description",
- "Description",
- "The description of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-
- /* AUTHOR */
- properties[PROP_AUTHOR] = g_param_spec_string("author", "Author",
- "The author of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-
- /* TYPE STRING (read only) */
- properties[PROP_TYPE] = g_param_spec_string("type", "Type",
- "The string representing the type of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
- G_PARAM_STATIC_STRINGS);
-
- /* DIRECTORY */
- properties[PROP_DIR] = g_param_spec_string("directory", "Directory",
- "The directory that contains the theme and all its files",
- NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS);
-
- /* PREVIEW IMAGE */
- properties[PROP_IMAGE] = g_param_spec_string("image", "Image",
- "A preview image of the theme",
- NULL,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);
-
- g_object_class_install_properties(obj_class, PROP_LAST, properties);
-}
-
-/******************************************************************************
- * Helper Functions
- *****************************************************************************/
-
-static gchar *
-theme_clean_text(const gchar *text)
-{
- gchar *clean_text = NULL;
- if (text != NULL) {
- clean_text = g_markup_escape_text(text, -1);
- g_strdelimit(clean_text, "\n", ' ');
- purple_str_strip_char(clean_text, '\r');
- }
- return clean_text;
-}
-
-/*****************************************************************************
- * Public API function
- *****************************************************************************/
-
-const gchar *
-purple_theme_get_name(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
- return priv->name;
-}
-
-void
-purple_theme_set_name(PurpleTheme *theme, const gchar *name)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->name);
- priv->name = theme_clean_text(name);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_NAME]);
-}
-
-const gchar *
-purple_theme_get_description(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
- return priv->description;
-}
-
-void
-purple_theme_set_description(PurpleTheme *theme, const gchar *description)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->description);
- priv->description = theme_clean_text(description);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DESCRIPTION]);
-}
-
-const gchar *
-purple_theme_get_author(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
- return priv->author;
-}
-
-void
-purple_theme_set_author(PurpleTheme *theme, const gchar *author)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->author);
- priv->author = theme_clean_text(author);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_AUTHOR]);
-}
-
-const gchar *
-purple_theme_get_type_string(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
- return priv->type;
-}
-
-/* < private > */
-void
-purple_theme_set_type_string(PurpleTheme *theme, const gchar *type)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->type);
- priv->type = g_strdup(type);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_TYPE]);
-}
-
-const gchar *
-purple_theme_get_dir(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
- return priv->dir;
-}
-
-void
-purple_theme_set_dir(PurpleTheme *theme, const gchar *dir)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->dir);
- priv->dir = g_strdup(dir);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_DIR]);
-}
-
-const gchar *
-purple_theme_get_image(PurpleTheme *theme)
-{
- PurpleThemePrivate *priv;
-
- g_return_val_if_fail(PURPLE_IS_THEME(theme), NULL);
-
- priv = purple_theme_get_instance_private(theme);
-
- return priv->img;
-}
-
-gchar *
-purple_theme_get_image_full(PurpleTheme *theme)
-{
- const gchar *filename = purple_theme_get_image(theme);
-
- if (filename)
- return g_build_filename(purple_theme_get_dir(PURPLE_THEME(theme)), filename, NULL);
- else
- return NULL;
-}
-
-void
-purple_theme_set_image(PurpleTheme *theme, const gchar *img)
-{
- PurpleThemePrivate *priv;
-
- g_return_if_fail(PURPLE_IS_THEME(theme));
-
- priv = purple_theme_get_instance_private(theme);
-
- g_free(priv->img);
- priv->img = g_strdup(img);
-
- g_object_notify_by_pspec(G_OBJECT(theme), properties[PROP_IMAGE]);
-}
--- a/libpurple/theme.h Thu Nov 11 23:19:07 2021 -0600
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
- * Purple - Internet Messaging Library
- * Copyright (C) Pidgin Developers <devel@pidgin.im>
- *
- * 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, see <https://www.gnu.org/licenses/>.
- */
-
-#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
-# error "only <purple.h> may be included directly"
-#endif
-
-#ifndef PURPLE_THEME_H
-#define PURPLE_THEME_H
-/**
- * SECTION:theme
- * @section_id: libpurple-theme
- * @short_description: <filename>theme.h</filename>
- * @title: Theme Abstract Class
- *
- * The theme API represents the common abilities for all of our supported
- * themes.
- */
-
-#include <glib.h>
-#include <glib-object.h>
-
-/**
- * PURPLE_TYPE_THEME:
- *
- * The standard _get_type macro for #PurpleTheme.
- */
-#define PURPLE_TYPE_THEME purple_theme_get_type()
-
-struct _PurpleThemeClass
-{
- GObjectClass parent_class;
-
- /*< private >*/
- void (*purple_reserved1)(void);
- void (*purple_reserved2)(void);
- void (*purple_reserved3)(void);
- void (*purple_reserved4)(void);
-};
-
-/**************************************************************************/
-/* Purple Theme API */
-/**************************************************************************/
-G_BEGIN_DECLS
-
-/**
- * purple_theme_get_type:
- *
- * The standard _get_type function for #GType's.
- *
- * Returns: The #GType for a theme.
- */
-G_DECLARE_DERIVABLE_TYPE(PurpleTheme, purple_theme, PURPLE, THEME, GObject)
-
-/**
- * purple_theme_get_name:
- * @theme: The purple theme.
- *
- * Returns the name of the PurpleTheme object.
- *
- * Returns: The string representing the name of the theme.
- */
-const gchar *purple_theme_get_name(PurpleTheme *theme);
-
-/**
- * purple_theme_set_name:
- * @theme: The purple theme.
- * @name: The name of the PurpleTheme object.
- *
- * Sets the name of the PurpleTheme object.
- */
-void purple_theme_set_name(PurpleTheme *theme, const gchar *name);
-
-/**
- * purple_theme_get_description:
- * @theme: The purple theme.
- *
- * Returns the description of the PurpleTheme object.
- *
- * Returns: A short description of the theme.
- */
-const gchar *purple_theme_get_description(PurpleTheme *theme);
-
-/**
- * purple_theme_set_description:
- * @theme: The purple theme.
- * @description: The description of the PurpleTheme object.
- *
- * Sets the description of the PurpleTheme object.
- */
-void purple_theme_set_description(PurpleTheme *theme, const gchar *description);
-
-/**
- * purple_theme_get_author:
- * @theme: The purple theme.
- *
- * Returns the author of the PurpleTheme object.
- *
- * Returns: The author of the theme.
- */
-const gchar *purple_theme_get_author(PurpleTheme *theme);
-
-/**
- * purple_theme_set_author:
- * @theme: The purple theme.
- * @author: The author of the PurpleTheme object.
- *
- * Sets the author of the PurpleTheme object.
- */
-void purple_theme_set_author(PurpleTheme *theme, const gchar *author);
-
-/**
- * purple_theme_get_type_string:
- * @theme: The purple theme.
- *
- * Returns the type (string) of the PurpleTheme object.
- *
- * Returns: The string representing the type.
- */
-const gchar *purple_theme_get_type_string(PurpleTheme *theme);
-
-/**
- * purple_theme_get_dir:
- * @theme: The purple theme.
- *
- * Returns the directory of the PurpleTheme object.
- *
- * Returns: The string representing the theme directory.
- */
-const gchar *purple_theme_get_dir(PurpleTheme *theme);
-
-/**
- * purple_theme_set_dir:
- * @theme: The purple theme.
- * @dir: The directory of the PurpleTheme object.
- *
- * Sets the directory of the PurpleTheme object.
- */
-void purple_theme_set_dir(PurpleTheme *theme, const gchar *dir);
-
-/**
- * purple_theme_get_image:
- * @theme: The purple theme.
- *
- * Returns the image preview of the PurpleTheme object.
- *
- * Returns: The image preview of the PurpleTheme object.
- */
-const gchar *purple_theme_get_image(PurpleTheme *theme);
-
-/**
- * purple_theme_get_image_full:
- * @theme: The purple theme.
- *
- * Returns the image preview and directory of the PurpleTheme object.
- *
- * Returns: The image preview of the PurpleTheme object.
- */
-gchar *purple_theme_get_image_full(PurpleTheme *theme);
-
-/**
- * purple_theme_set_image:
- * @theme: The purple theme.
- * @img: The image preview of the PurpleTheme object.
- *
- * Sets the directory of the PurpleTheme object.
- */
-void purple_theme_set_image(PurpleTheme *theme, const gchar *img);
-
-G_END_DECLS
-
-#endif /* PURPLE_THEME_H */
--- a/po/POTFILES.in Thu Nov 11 23:19:07 2021 -0600
+++ b/po/POTFILES.in Mon Nov 15 02:21:18 2021 -0600
@@ -295,9 +295,6 @@
libpurple/tests/test_ui.c
libpurple/tests/test_util.c
libpurple/tests/test_xmlnode.c
-libpurple/theme.c
-libpurple/theme-loader.c
-libpurple/theme-manager.c
libpurple/trie.c
libpurple/upnp.c
libpurple/util.c