Thu, 28 Oct 2021 23:43:20 -0500
Remove the Pidgin icon themes which are covered by XDG icon themes now and remove the stock api as that's all that was using it yet.
Testing Done:
* Built everything, including the docs and pidgin-pot
* Verified that the preferences window still functions properly
* Verified that the user list in the conversation window had properly sized icons
* Verified all of the status icons were not affected.
Reviewed at https://reviews.imfreedom.org/r/1088/
--- a/ChangeLog.API Thu Oct 28 23:26:57 2021 -0500 +++ b/ChangeLog.API Thu Oct 28 23:43:20 2021 -0500 @@ -822,6 +822,27 @@ * pidgin_dialog_get_vbox_with_properties * pidgin_dialogs_alias_contact * pidgin_dialogs_log + * PIDGIN_ICON_SIZE_* + * PIDGIN_ICON_THEME + * PIDGIN_ICON_THEME_CLASS + * PIDGIN_ICON_THEME_LOADER + * PIDGIN_ICON_THEME_LOADER_CLASS + * PIDGIN_ICON_THEME_GET_CLASS + * PIDGIN_ICON_THEME_LOADER_GET_CLASS + * pidgin_icon_theme_get_icon + * pidgin_icon_theme_set_icon + * pidgin_icon_theme_get_type + * pidgin_icon_theme_loader_get_type + * PIDGIN_IS_ICON_THEME + * PIDGIN_IS_ICON_THEME_CLASS + * PIDGIN_IS_ICON_THEME_LOADER + * PIDGIN_IS_ICON_THEME_LOADER_CLASS + * PIDGIN_TYPE_ICON_THEME + * PIDGIN_TYPE_ICON_THEME_LOADER + * PidginIconTheme + * PidginIconThemeClass + * PidginIconThemeLoader + * PidginIconThemeLoaderClass * pidgin_idle_get_ui_ops * pidgin_make_mini_dialog_with_custom_icon; use pidgin_mini_dialog_new_with_custom_icon instead. @@ -857,6 +878,15 @@ * pidgin_sound_get_handle * pidgin_sound_get_ui_ops * pidgin_sound_is_customized + * PIDGIN_IS_STATUS_ICON_THEME + * PIDGIN_IS_STATUS_ICON_THEME_CLASS + * PIDGIN_STATUS_ICON_THEME + * PIDGIN_STATUS_ICON_THEME_CLASS + * PIDGIN_STATUS_ICON_THEME_GET_CLASS + * pidgin_status_icon_theme_get_type + * PIDGIN_TYPE_STATUS_ICON_THEME + * PidginStatusIconTheme + * PidginStatusIconThemeClass * PidginStatusBoxItemType * pidgin_status_box_add * pidgin_status_box_add_separator @@ -864,8 +894,20 @@ * pidgin_status_box_set_buddy_icon * pidgin_status_box_set_network_available * All PIDGIN_STOCK_* macros + * PIDGIN_IS_STOCK_ICON_THEME + * PIDGIN_IS_STOCK_ICON_THEME_CLASS + * PIDGIN_STOCK_ICON_THEME + * PIDGIN_STOCK_ICON_THEME_CLASS + * PIDGIN_STOCK_ICON_THEME_GET_CLASS + * pidgin_stock_icon_theme_get_type * pidgin_stock_id_from_presence * pidgin_stock_id_from_status_primitive + * pidgin_stock_init + * pidgin_stock_load_status_icon_theme + * pidgin_stock_load_stock_icon_theme + * PIDGIN_TYPE_STOCK_ICON_THEME + * PidginStockIconTheme + * PidginStockIconThemeClass * pidgin_text_combo_box_entry_set_text * pidgin_theme_font_free * pidgin_theme_font_get_color
--- a/pidgin/gtkconv.c Thu Oct 28 23:26:57 2021 -0500 +++ b/pidgin/gtkconv.c Thu Oct 28 23:43:20 2021 -0500 @@ -60,7 +60,6 @@ #include "pidginmenutray.h" #include "pidginmessage.h" #include "pidginpresenceicon.h" -#include "pidginstock.h" #include "pidginstylecontext.h" #define ADD_MESSAGE_HISTORY_AT_ONCE 100 @@ -2279,9 +2278,6 @@ gtk_widget_set_name(list, "pidgin_conv_userlist"); rend = gtk_cell_renderer_pixbuf_new(); - g_object_set(G_OBJECT(rend), - "stock-size", gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL), - NULL); col = gtk_tree_view_column_new_with_attributes(NULL, rend, "icon-name", CHAT_USERS_ICON_NAME_COLUMN, NULL); gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
--- a/pidgin/gtkicon-theme-loader.c Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * PidginIconThemeLoader for Pidgin - * - * Pidgin is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#include "gtkicon-theme-loader.h" -#include "gtkstatus-icon-theme.h" - -#include <purple.h> - -/** - * PidginIconThemeLoader: - * - * A pidgin icon theme loader. Extends PurpleThemeLoader (theme-loader.h) - * This is a class designed to build icon themes - */ -struct _PidginIconThemeLoader -{ - PurpleThemeLoader parent; -}; - -/***************************************************************************** - * Icon Theme Builder - *****************************************************************************/ - -static PurpleTheme * -pidgin_icon_loader_build(const gchar *theme_dir) -{ - PurpleXmlNode *root_node = NULL, *sub_node; - gchar *dir, *filename_full, *data = NULL; - PidginIconTheme *theme = NULL; - const gchar *name; - - /* Find the theme file */ - g_return_val_if_fail(theme_dir != NULL, NULL); - dir = g_build_filename(theme_dir, "purple", "status-icon", 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", "icon themes", "icon-theme-loader"); - - g_free(filename_full); - if (root_node == NULL) { - g_free(dir); - return NULL; - } - - name = purple_xmlnode_get_attrib(root_node, "name"); - - if (name) { - /* Parse the tree */ - sub_node = purple_xmlnode_get_child(root_node, "description"); - data = purple_xmlnode_get_data(sub_node); - - if (purple_xmlnode_get_attrib(root_node, "name") != NULL) { - theme = g_object_new(PIDGIN_TYPE_STATUS_ICON_THEME, - "type", "status-icon", - "name", name, - "author", purple_xmlnode_get_attrib(root_node, "author"), - "image", purple_xmlnode_get_attrib(root_node, "image"), - "directory", dir, - "description", data, NULL); - - sub_node = purple_xmlnode_get_child(root_node, "icon"); - - while (sub_node) { - pidgin_icon_theme_set_icon(theme, - purple_xmlnode_get_attrib(sub_node, "id"), - purple_xmlnode_get_attrib(sub_node, "file")); - sub_node = purple_xmlnode_get_next_twin(sub_node); - } - } - } - - purple_xmlnode_free(root_node); - g_free(data); - g_free(dir); - return PURPLE_THEME(theme); -} - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_icon_theme_loader_class_init (PidginIconThemeLoaderClass *klass) -{ - PurpleThemeLoaderClass *loader_klass = PURPLE_THEME_LOADER_CLASS(klass); - - loader_klass->purple_theme_loader_build = pidgin_icon_loader_build; -} - - -GType -pidgin_icon_theme_loader_get_type (void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof(PidginIconThemeLoaderClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_icon_theme_loader_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PidginIconThemeLoader), - 0, /* n_preallocs */ - NULL, /* instance_init */ - NULL, /* value table */ - }; - type = g_type_register_static (PURPLE_TYPE_THEME_LOADER, - "PidginIconThemeLoader", &info, 0); - } - return type; -}
--- a/pidgin/gtkicon-theme-loader.h Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,46 +0,0 @@ -/* purple - * - * Purple is the legal property of its developers, whose names are too numerous - * to list here. Please refer to the COPYRIGHT file distributed with this - * source distribution. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA - */ - -#if !defined(PIDGIN_GLOBAL_HEADER_INSIDE) && !defined(PIDGIN_COMPILATION) -# error "only <pidgin.h> may be included directly" -#endif - -#ifndef PIDGIN_ICON_THEME_LOADER_H -#define PIDGIN_ICON_THEME_LOADER_H - -#include <glib.h> -#include <glib-object.h> - -#include <purple.h> - -#define PIDGIN_TYPE_ICON_THEME_LOADER pidgin_icon_theme_loader_get_type() - -/**************************************************************************/ -/* Pidgin Icon Theme-Loader API */ -/**************************************************************************/ -G_BEGIN_DECLS - -G_DECLARE_FINAL_TYPE(PidginIconThemeLoader, pidgin_icon_theme_loader, PIDGIN, - ICON_THEME_LOADER, PurpleThemeLoader) - -G_END_DECLS - -#endif /* PIDGIN_ICON_THEME_LOADER_H */
--- a/pidgin/gtkicon-theme.c Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* - * Icon 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 "gtkicon-theme.h" - -#include <gtk/gtk.h> - -/****************************************************************************** - * Structs - *****************************************************************************/ - -typedef struct { - /* used to store filenames of different icons */ - GHashTable *icon_files; -} PidginIconThemePrivate; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE(PidginIconTheme, pidgin_icon_theme, - PURPLE_TYPE_THEME); - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_icon_theme_init(PidginIconTheme *theme) -{ - PidginIconThemePrivate *priv; - - priv = pidgin_icon_theme_get_instance_private(theme); - - priv->icon_files = g_hash_table_new_full(g_str_hash, - g_str_equal, g_free, g_free); -} - -static void -pidgin_icon_theme_finalize(GObject *obj) -{ - PidginIconThemePrivate *priv; - - priv = pidgin_icon_theme_get_instance_private(PIDGIN_ICON_THEME(obj)); - - g_hash_table_destroy(priv->icon_files); - - G_OBJECT_CLASS(pidgin_icon_theme_parent_class)->finalize(obj); -} - -static void -pidgin_icon_theme_class_init(PidginIconThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - - obj_class->finalize = pidgin_icon_theme_finalize; -} - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -const gchar * -pidgin_icon_theme_get_icon(PidginIconTheme *theme, - const gchar *id) -{ - PidginIconThemePrivate *priv; - - g_return_val_if_fail(PIDGIN_IS_ICON_THEME(theme), NULL); - - priv = pidgin_icon_theme_get_instance_private(theme); - - return g_hash_table_lookup(priv->icon_files, id); -} - -void -pidgin_icon_theme_set_icon(PidginIconTheme *theme, - const gchar *id, - const gchar *filename) -{ - PidginIconThemePrivate *priv; - g_return_if_fail(PIDGIN_IS_ICON_THEME(theme)); - - priv = pidgin_icon_theme_get_instance_private(theme); - - if (filename != NULL) - g_hash_table_replace(priv->icon_files, - g_strdup(id), g_strdup(filename)); - else - g_hash_table_remove(priv->icon_files, id); -}
--- a/pidgin/gtkicon-theme.h Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +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_ICON_THEME_H -#define PIDGIN_ICON_THEME_H - -#include <glib.h> -#include <glib-object.h> - -#include <purple.h> - -#define PIDGIN_TYPE_ICON_THEME pidgin_icon_theme_get_type() - -struct _PidginIconThemeClass -{ - PurpleThemeClass parent_class; -}; - -/**************************************************************************/ -/* Pidgin Icon Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -G_DECLARE_DERIVABLE_TYPE(PidginIconTheme, pidgin_icon_theme, PIDGIN, - ICON_THEME, PurpleTheme) - -/** - * pidgin_icon_theme_get_icon: - * @theme: the theme - * @event: the pidgin icon event to look up - * - * Returns a copy of the filename for the icon event or NULL if it is not set - * - * Returns: the filename of the icon event - */ -const gchar *pidgin_icon_theme_get_icon(PidginIconTheme *theme, - const gchar *event); - -/** - * pidgin_icon_theme_set_icon: - * @theme: the theme - * @icon_id: a string representing what the icon is to be used for - * @filename: the name of the file to be used for the given id - * - * Sets the filename for a given icon id, setting the icon to NULL will remove the icon from the theme - */ -void pidgin_icon_theme_set_icon(PidginIconTheme *theme, - const gchar *icon_id, - const gchar *filename); - -G_END_DECLS - -#endif /* PIDGIN_ICON_THEME_H */
--- a/pidgin/gtkstatus-icon-theme.c Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* - * Status Icon 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 "gtkstatus-icon-theme.h" - -/** - * PidginStatusIconTheme: - * - * extends PidginIconTheme (gtkicon-theme.h) - * A pidgin status icon theme. - * This object represents a Pidgin status icon theme. - * - * PidginStatusIconTheme is a PidginIconTheme Object. - */ -struct _PidginStatusIconTheme -{ - PidginIconTheme parent; -}; - -/****************************************************************************** - * Globals - *****************************************************************************/ - -static GObjectClass *parent_class = NULL; - -/****************************************************************************** - * GObject Stuff - *****************************************************************************/ - -static void -pidgin_status_icon_theme_finalize(GObject *obj) -{ - parent_class->finalize(obj); -} - -static void -pidgin_status_icon_theme_class_init(PidginStatusIconThemeClass *klass) -{ - GObjectClass *obj_class = G_OBJECT_CLASS(klass); - - parent_class = g_type_class_peek_parent(klass); - - obj_class->finalize = pidgin_status_icon_theme_finalize; -} - -GType -pidgin_status_icon_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (PidginStatusIconThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_status_icon_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PidginStatusIconTheme), - 0, /* n_preallocs */ - NULL, - NULL, /* value table */ - }; - type = g_type_register_static(PIDGIN_TYPE_ICON_THEME, - "PidginStatusIconTheme", &info, 0); - } - return type; -}
--- a/pidgin/gtkstatus-icon-theme.h Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +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_STATUS_ICON_THEME_H -#define PIDGIN_STATUS_ICON_THEME_H - -#include <glib-object.h> -#include "gtkicon-theme.h" - -#define PIDGIN_TYPE_STATUS_ICON_THEME pidgin_status_icon_theme_get_type() - -/**************************************************************************/ -/* Pidgin Status Icon Theme API */ -/**************************************************************************/ -G_BEGIN_DECLS - -G_DECLARE_FINAL_TYPE(PidginStatusIconTheme, pidgin_status_icon_theme, PIDGIN, - STATUS_ICON_THEME, PidginIconTheme) - -G_END_DECLS - -#endif /* PIDGIN_STATUS_ICON_THEME_H */
--- a/pidgin/libpidgin.c Thu Oct 28 23:26:57 2021 -0500 +++ b/pidgin/libpidgin.c Thu Oct 28 23:43:20 2021 -0500 @@ -53,7 +53,6 @@ #include "pidginplugininfo.h" #include "pidginprefs.h" #include "pidginprivate.h" -#include "pidginstock.h" #ifndef _WIN32 #include <signal.h> @@ -252,8 +251,6 @@ g_clear_error(&error); } - pidgin_stock_init(); - /* Set the UI operation structures. */ purple_accounts_set_ui_ops(pidgin_accounts_get_ui_ops()); purple_xfers_set_ui_ops(pidgin_xfers_get_ui_ops());
--- a/pidgin/meson.build Thu Oct 28 23:26:57 2021 -0500 +++ b/pidgin/meson.build Thu Oct 28 23:43:20 2021 -0500 @@ -1,12 +1,9 @@ libpidgin_SOURCES = [ - 'pidginstock.c', 'gtkaccount.c', 'gtkblist.c', 'gtkconn.c', 'gtkconv.c', 'gtkdialogs.c', - 'gtkicon-theme.c', - 'gtkicon-theme-loader.c', 'gtkidle.c', 'gtkmedia.c', 'gtknotify.c', @@ -15,7 +12,6 @@ 'gtkrequest.c', 'gtkroomlist.c', 'gtksavedstatuses.c', - 'gtkstatus-icon-theme.c', 'gtkstatusbox.c', 'gtkutils.c', 'gtkwhiteboard.c', @@ -70,8 +66,6 @@ 'gtkconv.h', 'gtkconvwin.h', 'gtkdialogs.h', - 'gtkicon-theme.h', - 'gtkicon-theme-loader.h', 'gtkidle.h', 'gtkmedia.h', 'gtknotify.h', @@ -80,9 +74,7 @@ 'gtkrequest.h', 'gtkroomlist.h', 'gtksavedstatuses.h', - 'gtkstatus-icon-theme.h', 'gtkstatusbox.h', - 'pidginstock.h', 'gtkutils.h', 'gtkwhiteboard.h', 'gtkxfer.h',
--- a/pidgin/pidginstock.c Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +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 - * - */ -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif - -#include <glib/gi18n-lib.h> - -#include <purple.h> - -#include "pidginstock.h" - -#include "gtkicon-theme-loader.h" -#include "pidgincore.h" - -#warning GtkStock is deprecated. Port usage of PidginStock to GtkIconTheme \ - and friends. - -/************************************************************************** - * Globals - **************************************************************************/ - -static gboolean stock_initted = FALSE; -static GtkIconSize microscopic, extra_small, small, medium, large, huge; - -/************************************************************************** - * Structures - **************************************************************************/ - -/***************************************************************************** - * Public API functions - *****************************************************************************/ - -void -pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme) -{ - if (theme != NULL) { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", - purple_theme_get_name(PURPLE_THEME(theme))); - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", - purple_theme_get_dir(PURPLE_THEME(theme))); - } - else { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/status/icon-theme", ""); - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", ""); - } -} - -void -pidgin_stock_load_stock_icon_theme(PidginStockIconTheme *theme) -{ - if (theme != NULL) { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/stock/icon-theme", - purple_theme_get_name(PURPLE_THEME(theme))); - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir", - purple_theme_get_dir(PURPLE_THEME(theme))); - } - else { - purple_prefs_set_string(PIDGIN_PREFS_ROOT "/stock/icon-theme", ""); - purple_prefs_set_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir", ""); - } -} - -void -pidgin_stock_init(void) -{ - PidginIconThemeLoader *loader, *stockloader; - const gchar *path = NULL; - - if (stock_initted) - return; - - stock_initted = TRUE; - - /* Setup the status icon theme */ - loader = g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "status-icon", NULL); - purple_theme_manager_register_type(PURPLE_THEME_LOADER(loader)); - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/status"); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/status/icon-theme", ""); - purple_prefs_add_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir", ""); - - stockloader = g_object_new(PIDGIN_TYPE_ICON_THEME_LOADER, "type", "stock-icon", NULL); - purple_theme_manager_register_type(PURPLE_THEME_LOADER(stockloader)); - purple_prefs_add_none(PIDGIN_PREFS_ROOT "/stock"); - purple_prefs_add_string(PIDGIN_PREFS_ROOT "/stock/icon-theme", ""); - purple_prefs_add_path(PIDGIN_PREFS_ROOT "/stock/icon-theme-dir", ""); - - /* register custom icon sizes */ -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - microscopic = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC, 11, 11); - extra_small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL, 16, 16); - small = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_SMALL, 22, 22); - medium = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_MEDIUM, 32, 32); - large = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_LARGE, 48, 48); - huge = gtk_icon_size_register(PIDGIN_ICON_SIZE_TANGO_HUGE, 64, 64); -G_GNUC_END_IGNORE_DEPRECATIONS - - pidgin_stock_load_stock_icon_theme(NULL); - - /* Pre-load Status icon theme - this avoids a bug with displaying the correct icon in the tray, theme is destroyed after*/ - if (purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme") && - (path = purple_prefs_get_path(PIDGIN_PREFS_ROOT "/status/icon-theme-dir"))) { - - PidginStatusIconTheme *theme = PIDGIN_STATUS_ICON_THEME(purple_theme_loader_build(PURPLE_THEME_LOADER(loader), path)); - pidgin_stock_load_status_icon_theme(theme); - if (theme) - g_object_unref(G_OBJECT(theme)); - - } - else - pidgin_stock_load_status_icon_theme(NULL); -} - -static void -pidgin_stock_icon_theme_class_init(PidginStockIconThemeClass *klass) -{ -} - -GType -pidgin_stock_icon_theme_get_type(void) -{ - static GType type = 0; - if (type == 0) { - static const GTypeInfo info = { - sizeof (PidginStockIconThemeClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc)pidgin_stock_icon_theme_class_init, /* class_init */ - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (PidginStockIconTheme), - 0, /* n_preallocs */ - NULL, - NULL, /* value table */ - }; - type = g_type_register_static(PIDGIN_TYPE_ICON_THEME, - "PidginStockIconTheme", &info, 0); - } - return type; -}
--- a/pidgin/pidginstock.h Thu Oct 28 23:26:57 2021 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +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_STOCK_H_ -#define _PIDGIN_STOCK_H_ - -#include <gtk/gtk.h> -#include "gtkstatus-icon-theme.h" - -/* - * For using icons that aren't one of the default GTK_ICON_SIZEs - */ -#define PIDGIN_ICON_SIZE_TANGO_MICROSCOPIC "pidgin-icon-size-tango-microscopic" -#define PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL "pidgin-icon-size-tango-extra-small" -#define PIDGIN_ICON_SIZE_TANGO_SMALL "pidgin-icon-size-tango-small" -#define PIDGIN_ICON_SIZE_TANGO_MEDIUM "pidgin-icon-size-tango-medium" -#define PIDGIN_ICON_SIZE_TANGO_LARGE "pidgin-icon-size-tango-large" -#define PIDGIN_ICON_SIZE_TANGO_HUGE "pidgin-icon-size-tango-huge" - -typedef struct _PidginStockIconTheme PidginStockIconTheme; -typedef struct _PidginStockIconThemeClass PidginStockIconThemeClass; - -#define PIDGIN_TYPE_STOCK_ICON_THEME (pidgin_stock_icon_theme_get_type ()) -#define PIDGIN_STOCK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIDGIN_TYPE_STOCK_ICON_THEME, PidginStockIconTheme)) -#define PIDGIN_STOCK_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PIDGIN_TYPE_STOCK_ICON_THEME, PidginStockIconThemeClass)) -#define PIDGIN_IS_STOCK_ICON_THEME(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIDGIN_TYPE_STOCK_ICON_THEME)) -#define PIDGIN_IS_STOCK_ICON_THEME_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIDGIN_TYPE_STOCK_ICON_THEME)) -#define PIDGIN_STOCK_ICON_THEME_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PIDGIN_TYPE_STOCK_ICON_THEME, PidginStockIconThemeClass)) - -/** - * PidginStockIconTheme: - * - * extends PidginIconTheme (gtkicon-theme.h) - * A pidgin stock icon theme. - * This object represents a Pidgin stock icon theme. - * - * PidginStockIconTheme is a PidginIconTheme Object. - */ -struct _PidginStockIconTheme -{ - PidginIconTheme parent; -}; - -struct _PidginStockIconThemeClass -{ - PidginIconThemeClass parent_class; -}; - -G_BEGIN_DECLS - -/** - * pidgin_stock_icon_theme_get_type: - * - * Returns: The #GType for a stock icon theme. - */ -GType pidgin_stock_icon_theme_get_type(void); - -/** - * pidgin_stock_load_status_icon_theme: - * @theme: the theme to load, or null to load all the default icons - * - * Loades all of the icons from the status icon theme into Pidgin stock - */ -void pidgin_stock_load_status_icon_theme(PidginStatusIconTheme *theme); - - -void pidgin_stock_load_stock_icon_theme(PidginStockIconTheme *theme); - -/** - * pidgin_stock_init: - * - * Sets up the purple stock repository. - */ -void pidgin_stock_init(void); - -G_END_DECLS - -#endif /* _PIDGIN_STOCK_H_ */
--- a/pidgin/prefs/pidginprefs.c Thu Oct 28 23:26:57 2021 -0500 +++ b/pidgin/prefs/pidginprefs.c Thu Oct 28 23:43:20 2021 -0500 @@ -38,13 +38,11 @@ #include "gtkconv.h" #include "gtkdialogs.h" #include "gtksavedstatuses.h" -#include "gtkstatus-icon-theme.h" #include "gtkutils.h" #include "pidgincore.h" #include "pidgindebug.h" #include "pidgingdkpixbuf.h" #include "pidginprefs.h" -#include "pidginstock.h" #ifdef USE_VV #include <gst/video/videooverlay.h> #ifdef GDK_WINDOWING_WIN32 @@ -64,12 +62,6 @@ /* 25MB */ #define PREFS_MAX_DOWNLOADED_THEME_SIZE 26214400 -struct theme_info { - gchar *type; - gchar *extension; - gchar *original_name; -}; - typedef struct _PidginPrefCombo PidginPrefCombo; typedef void (*PidginPrefsBindDropdownCallback)(GtkComboBox *combo_box, @@ -176,12 +168,6 @@ GtkWidget *startup_label; } away; - /* Themes page */ - struct { - SoupSession *session; - GtkWidget *status; - } theme; - #ifdef USE_VV /* Voice/Video page */ struct { @@ -210,12 +196,6 @@ /* Main dialog */ static PidginPrefsWindow *prefs = NULL; -/* Themes page */ -static GtkWidget *prefs_status_themes_combo_box; - -/* These exist outside the lifetime of the prefs dialog */ -static GtkListStore *prefs_status_icon_themes; - /* * PROTOTYPES */ @@ -797,505 +777,13 @@ purple_notify_close_with_handle(prefs); - g_clear_object(&prefs->theme.session); - /* Unregister callbacks. */ purple_prefs_disconnect_by_handle(prefs); - /* NULL-ify globals */ - prefs_status_themes_combo_box = NULL; - g_free(prefs->proxy.gnome_program_path); prefs = NULL; } -static gchar * -get_theme_markup(const char *name, gboolean custom, const char *author, - const char *description) -{ - - return g_strdup_printf("<b>%s</b>%s%s%s%s\n<span foreground='dim grey'>%s</span>", - name, custom ? " " : "", custom ? _("(Custom)") : "", - author != NULL ? " - " : "", author != NULL ? author : "", - description != NULL ? description : ""); -} - -/* adds the themes to the theme list from the manager so they can be displayed in prefs */ -static void -prefs_themes_sort(PurpleTheme *theme) -{ - GdkPixbuf *pixbuf = NULL; - GtkTreeIter iter; - gchar *image_full = NULL, *markup; - const gchar *name, *author, *description; - - if (PIDGIN_IS_STATUS_ICON_THEME(theme)){ - GtkListStore *store; - - store = prefs_status_icon_themes; - - image_full = purple_theme_get_image_full(theme); - if (image_full != NULL){ - pixbuf = pidgin_pixbuf_new_from_file_at_scale(image_full, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); - g_free(image_full); - } else - pixbuf = NULL; - - name = purple_theme_get_name(theme); - author = purple_theme_get_author(theme); - description = purple_theme_get_description(theme); - - markup = get_theme_markup(name, FALSE, author, description); - - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, pixbuf, 1, markup, 2, name, -1); - - g_free(markup); - if (pixbuf != NULL) - g_object_unref(G_OBJECT(pixbuf)); - - } -} - -static void -prefs_set_active_theme_combo(GtkWidget *combo_box, GtkListStore *store, const gchar *current_theme) -{ - GtkTreeIter iter; - gchar *theme = NULL; - gboolean unset = TRUE; - - if (current_theme && *current_theme && gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) { - do { - gtk_tree_model_get(GTK_TREE_MODEL(store), &iter, 2, &theme, -1); - - if (purple_strequal(current_theme, theme)) { - gtk_combo_box_set_active_iter(GTK_COMBO_BOX(combo_box), &iter); - unset = FALSE; - } - - g_free(theme); - } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)); - } - - if (unset) - gtk_combo_box_set_active(GTK_COMBO_BOX(combo_box), 0); -} - -static void -prefs_themes_refresh(void) -{ - GdkPixbuf *pixbuf = NULL; - gchar *tmp; - GtkTreeIter iter; - - /* refresh the list of themes in the manager */ - purple_theme_manager_refresh(); - - tmp = g_build_filename(PURPLE_DATADIR, "icons", "hicolor", "32x32", - "apps", "im.pidgin.Pidgin3.png", NULL); - pixbuf = pidgin_pixbuf_new_from_file_at_scale(tmp, PREFS_OPTIMAL_ICON_SIZE, PREFS_OPTIMAL_ICON_SIZE, TRUE); - g_free(tmp); - - /* status icon themes */ - gtk_list_store_clear(prefs_status_icon_themes); - gtk_list_store_append(prefs_status_icon_themes, &iter); - tmp = get_theme_markup(_("Default"), FALSE, _("Penguin Pimps"), - _("The default Pidgin status icon theme")); - gtk_list_store_set(prefs_status_icon_themes, &iter, 0, pixbuf, 1, tmp, 2, "", -1); - g_free(tmp); - if (pixbuf) - g_object_unref(G_OBJECT(pixbuf)); - - purple_theme_manager_for_each_theme(prefs_themes_sort); - - /* set active */ - prefs_set_active_theme_combo(prefs_status_themes_combo_box, prefs_status_icon_themes, purple_prefs_get_string(PIDGIN_PREFS_ROOT "/status/icon-theme")); -} - -/* init all the theme variables so that the themes can be sorted later and used by pref pages */ -static void -prefs_themes_init(void) -{ - prefs_status_icon_themes = gtk_list_store_new(3, GDK_TYPE_PIXBUF, G_TYPE_STRING, G_TYPE_STRING); -} - -/* - * prefs_theme_find_theme: - * @path: A directory containing a theme. The theme could be at the - * top level of this directory or in any subdirectory thereof. - * @type: The type of theme to load. The loader for this theme type - * will be used and this loader will determine what constitutes a - * "theme." - * - * Attempt to load the given directory as a theme. If we are unable to - * open the path as a theme then we recurse into path and attempt to - * load each subdirectory that we encounter. - * - * Returns: A new reference to a #PurpleTheme. - */ -static PurpleTheme * -prefs_theme_find_theme(const gchar *path, const gchar *type) -{ - PurpleTheme *theme = purple_theme_manager_load_theme(path, type); - GDir *dir = g_dir_open(path, 0, NULL); - const gchar *next; - - while (!PURPLE_IS_THEME(theme) && (next = g_dir_read_name(dir))) { - gchar *next_path = g_build_filename(path, next, NULL); - - if (g_file_test(next_path, G_FILE_TEST_IS_DIR)) - theme = prefs_theme_find_theme(next_path, type); - - g_free(next_path); - } - - g_dir_close(dir); - - return theme; -} - -/* Eww. Seriously ewww. But thanks, grim! This is taken from guifications2 */ -static gboolean -purple_theme_file_copy(const gchar *source, const gchar *destination) -{ - FILE *src, *dest; - gint chr = EOF; - - if(!(src = g_fopen(source, "rb"))) - return FALSE; - if(!(dest = g_fopen(destination, "wb"))) { - fclose(src); - return FALSE; - } - - while((chr = fgetc(src)) != EOF) { - fputc(chr, dest); - } - - fclose(dest); - fclose(src); - - return TRUE; -} - -static void -free_theme_info(struct theme_info *info) -{ - if (info != NULL) { - g_free(info->type); - g_free(info->extension); - g_free(info->original_name); - g_free(info); - } -} - -/* installs a theme, info is freed by function */ -static void -theme_install_theme(char *path, struct theme_info *info) -{ - gchar *destdir; - const char *tail; - gboolean is_archive; - PurpleTheme *theme = NULL; - - if (info == NULL) - return; - - /* check the extension */ - tail = info->extension ? info->extension : strrchr(path, '.'); - - if (!tail) { - free_theme_info(info); - return; - } - - is_archive = !g_ascii_strcasecmp(tail, ".gz") || !g_ascii_strcasecmp(tail, ".tgz"); - - /* Just to be safe */ - g_strchomp(path); - - destdir = g_build_filename(purple_data_dir(), "themes", "temp", NULL); - - /* We'll check this just to make sure. This also lets us do something different on - * other platforms, if need be */ - if (is_archive) { -#ifndef _WIN32 - gchar *path_escaped = g_shell_quote(path); - gchar *destdir_escaped = g_shell_quote(destdir); - gchar *command; - - if (!g_file_test(destdir, G_FILE_TEST_IS_DIR)) { - g_mkdir_with_parents(destdir, S_IRUSR | S_IWUSR | S_IXUSR); - } - - command = g_strdup_printf("tar > /dev/null xzf %s -C %s", path_escaped, destdir_escaped); - g_free(path_escaped); - g_free(destdir_escaped); - - /* Fire! */ - if (system(command)) { - purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL, NULL); - g_free(command); - g_free(destdir); - free_theme_info(info); - return; - } - g_free(command); -#else - if (!winpidgin_gz_untar(path, destdir)) { - purple_notify_error(NULL, NULL, _("Theme failed to unpack."), NULL, NULL); - g_free(destdir); - free_theme_info(info); - return; - } -#endif - } - - if (is_archive) { - theme = prefs_theme_find_theme(destdir, info->type); - - if (PURPLE_IS_THEME(theme)) { - /* create the location for the theme */ - gchar *theme_dest = g_build_filename(purple_data_dir(), "themes", - purple_theme_get_name(theme), - "purple", info->type, NULL); - - if (!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) { - g_mkdir_with_parents(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); - } - - g_free(theme_dest); - theme_dest = g_build_filename(purple_data_dir(), "themes", - purple_theme_get_name(theme), - "purple", info->type, NULL); - - /* move the entire directory to new location */ - if (g_rename(purple_theme_get_dir(theme), theme_dest)) { - purple_debug_error("gtkprefs", "Error renaming %s to %s: " - "%s\n", purple_theme_get_dir(theme), theme_dest, - g_strerror(errno)); - } - - g_free(theme_dest); - if (g_remove(destdir) != 0) { - purple_debug_error("gtkprefs", - "couldn't remove temp (dest) path\n"); - } - g_object_unref(theme); - - prefs_themes_refresh(); - - } else { - /* something was wrong with the theme archive */ - g_unlink(destdir); - purple_notify_error(NULL, NULL, _("Theme failed to load."), NULL, NULL); - } - - } else { /* just a single file so copy it to a new temp directory and attempt to load it*/ - gchar *temp_path, *temp_file; - - temp_path = g_build_filename(purple_data_dir(), "themes", "temp", - "sub_folder", NULL); - - if (info->original_name != NULL) { - /* name was changed from the original (probably a dnd) change it back before loading */ - temp_file = g_build_filename(temp_path, info->original_name, NULL); - - } else { - gchar *source_name = g_path_get_basename(path); - temp_file = g_build_filename(temp_path, source_name, NULL); - g_free(source_name); - } - - if (!g_file_test(temp_path, G_FILE_TEST_IS_DIR)) { - g_mkdir_with_parents(temp_path, S_IRUSR | S_IWUSR | S_IXUSR); - } - - if (purple_theme_file_copy(path, temp_file)) { - /* find the theme, could be in subfolder */ - theme = prefs_theme_find_theme(temp_path, info->type); - - if (PURPLE_IS_THEME(theme)) { - gchar *theme_dest = - g_build_filename(purple_data_dir(), "themes", - purple_theme_get_name(theme), "purple", - info->type, NULL); - - if(!g_file_test(theme_dest, G_FILE_TEST_IS_DIR)) { - g_mkdir_with_parents(theme_dest, S_IRUSR | S_IWUSR | S_IXUSR); - } - - if (g_rename(purple_theme_get_dir(theme), theme_dest)) { - purple_debug_error("gtkprefs", "Error renaming %s to %s: " - "%s\n", purple_theme_get_dir(theme), theme_dest, - g_strerror(errno)); - } - - g_free(theme_dest); - g_object_unref(theme); - - prefs_themes_refresh(); - } else { - if (g_remove(temp_path) != 0) { - purple_debug_error("gtkprefs", - "couldn't remove temp path"); - } - purple_notify_error(NULL, NULL, _("Theme failed to load."), NULL, NULL); - } - } else { - purple_notify_error(NULL, NULL, _("Theme failed to copy."), NULL, NULL); - } - - g_free(temp_file); - g_free(temp_path); - } - - g_free(destdir); - free_theme_info(info); -} - -static void -theme_got_url(G_GNUC_UNUSED SoupSession *session, SoupMessage *msg, - gpointer _info) -{ - struct theme_info *info = _info; - FILE *f; - gchar *path; - size_t wc; - - if (!SOUP_STATUS_IS_SUCCESSFUL(msg->status_code)) { - free_theme_info(info); - return; - } - - f = purple_mkstemp(&path, TRUE); - wc = fwrite(msg->response_body->data, msg->response_body->length, 1, f); - if (wc != 1) { - purple_debug_warning("theme_got_url", "Unable to write theme data.\n"); - fclose(f); - g_unlink(path); - g_free(path); - free_theme_info(info); - return; - } - fclose(f); - - theme_install_theme(path, info); - - g_unlink(path); - g_free(path); -} - -static void -theme_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, - GtkSelectionData *sd, guint info, guint t, gpointer user_data) -{ - gchar *name = g_strchomp((gchar *)gtk_selection_data_get_data(sd)); - - if ((gtk_selection_data_get_length(sd) >= 0) - && (gtk_selection_data_get_format(sd) == 8)) { - /* Well, it looks like the drag event was cool. - * Let's do something with it */ - gchar *temp; - struct theme_info *info = g_new0(struct theme_info, 1); - info->type = g_strdup((gchar *)user_data); - info->extension = g_strdup(g_strrstr(name,".")); - temp = g_strrstr(name, "/"); - info->original_name = temp ? g_strdup(++temp) : NULL; - - if (!g_ascii_strncasecmp(name, "file://", 7)) { - GError *converr = NULL; - gchar *tmp; - /* It looks like we're dealing with a local file. Let's - * just untar it in the right place */ - if(!(tmp = g_filename_from_uri(name, NULL, &converr))) { - purple_debug_error("theme dnd", "%s", - converr ? converr->message : - "g_filename_from_uri error"); - free_theme_info(info); - return; - } - theme_install_theme(tmp, info); - g_free(tmp); - } else if (!g_ascii_strncasecmp(name, "http://", 7) || - !g_ascii_strncasecmp(name, "https://", 8)) { - /* Oo, a web drag and drop. This is where things - * will start to get interesting */ - SoupMessage *msg; - - if (prefs->theme.session == NULL) { - prefs->theme.session = soup_session_new(); - } - - soup_session_abort(prefs->theme.session); - - msg = soup_message_new("GET", name); - // purple_http_request_set_max_len(msg, PREFS_MAX_DOWNLOADED_THEME_SIZE); - soup_session_queue_message(prefs->theme.session, msg, theme_got_url, - info); - } else - free_theme_info(info); - - gtk_drag_finish(dc, TRUE, FALSE, t); - } - - gtk_drag_finish(dc, FALSE, FALSE, t); -} - -/* builds a theme combo box from a list store with columns: icon preview, markup, theme name */ -static void -prefs_build_theme_combo_box(GtkWidget *combo_box, GtkListStore *store, - const char *current_theme, const char *type) -{ - GtkTargetEntry te[3] = { - {"text/plain", 0, 0}, - {"text/uri-list", 0, 1}, - {"STRING", 0, 2} - }; - - g_return_if_fail(store != NULL && current_theme != NULL); - - gtk_combo_box_set_model(GTK_COMBO_BOX(combo_box), - GTK_TREE_MODEL(store)); - - gtk_drag_dest_set(combo_box, GTK_DEST_DEFAULT_MOTION | GTK_DEST_DEFAULT_HIGHLIGHT | GTK_DEST_DEFAULT_DROP, te, - sizeof(te) / sizeof(GtkTargetEntry) , GDK_ACTION_COPY | GDK_ACTION_MOVE); - - g_signal_connect(G_OBJECT(combo_box), "drag_data_received", G_CALLBACK(theme_dnd_recv), (gpointer) type); -} - -/* sets the current icon theme */ -static void -prefs_set_status_icon_theme_cb(GtkComboBox *combo_box, gpointer user_data) -{ - PidginStatusIconTheme *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_status_icon_themes), &iter, 2, &name, -1); - - if(!name || *name) - theme = PIDGIN_STATUS_ICON_THEME(purple_theme_manager_find_theme(name, "status-icon")); - - g_free(name); - - pidgin_stock_load_status_icon_theme(theme); - pidgin_blist_refresh(purple_blist_get_default()); - } -} - -static void -bind_theme_page(PidginPrefsWindow *win) -{ - /* Status Icon Themes */ - prefs_build_theme_combo_box(win->theme.status, prefs_status_icon_themes, - PIDGIN_PREFS_ROOT "/status/icon-theme", - "icon"); - prefs_status_themes_combo_box = win->theme.status; -} - static void formatting_toggle_cb(TalkatuActionGroup *ag, GAction *action, const gchar *name, gpointer data) { @@ -2270,7 +1758,6 @@ bind_network_page(win); bind_proxy_page(win); bind_away_page(win); - bind_theme_page(win); #ifdef USE_VV vv = vv_page(win); gtk_container_add_with_properties(GTK_CONTAINER(stack), vv, "name", @@ -2452,12 +1939,6 @@ widget_class, PidginPrefsWindow, away.startup_hbox); gtk_widget_class_bind_template_child( widget_class, PidginPrefsWindow, away.startup_label); - - /* Themes page */ - gtk_widget_class_bind_template_child( - widget_class, PidginPrefsWindow, theme.status); - gtk_widget_class_bind_template_callback(widget_class, - prefs_set_status_icon_theme_cb); } static void @@ -2473,9 +1954,6 @@ gtk_widget_init_template(GTK_WIDGET(win)); prefs_stack_init(win); - - /* Refresh the list of themes before showing the preferences window */ - prefs_themes_refresh(); } void @@ -2505,9 +1983,6 @@ purple_prefs_add_path(PIDGIN_PREFS_ROOT "/filelocations/last_open_folder", ""); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/filelocations/last_icon_folder", ""); - /* Themes */ - prefs_themes_init(); - #ifdef USE_VV /* Voice/Video */ purple_prefs_add_none(PIDGIN_PREFS_ROOT "/vvconfig");
--- a/pidgin/resources/Prefs/prefs.ui Thu Oct 28 23:26:57 2021 -0500 +++ b/pidgin/resources/Prefs/prefs.ui Thu Oct 28 23:43:20 2021 -0500 @@ -2032,127 +2032,6 @@ </packing> </child> <child> - <object class="GtkBox" id="theme.page"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="border-width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">18</property> - <child> - <object class="GtkFrame"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label-xalign">0</property> - <property name="shadow-type">none</property> - <child> - <object class="GtkAlignment"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="left-padding">12</property> - <child> - <object class="GtkBox"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="label" translatable="yes">Select a theme that you would like to use from the lists below. -New themes can be installed by dragging and dropping them onto the theme list.</property> - <property name="xalign">0</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</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> - <property name="label" translatable="yes">Status Icon 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.status"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <signal name="changed" handler="prefs_set_status_icon_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">2</property> - </packing> - </child> - </object> - </child> - </object> - </child> - <child type="label"> - <object class="GtkLabel"> - <property name="visible">True</property> - <property name="can-focus">False</property> - <property name="margin-bottom">6</property> - <property name="label" translatable="yes">Theme Selections</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="name">theme</property> - <property name="title" translatable="yes">Themes</property> - <property name="position">6</property> - </packing> - </child> - <child> <object class="PidginCredentialsPage"> <property name="visible">True</property> <property name="can-focus">False</property> @@ -2206,14 +2085,4 @@ <widget name="label11"/> </widgets> </object> - <object class="GtkSizeGroup" id="theme.combo_sg"> - <widgets> - <widget name="theme.status"/> - </widgets> - </object> - <object class="GtkSizeGroup" id="theme.label_sg"> - <widgets> - <widget name="label20"/> - </widgets> - </object> </interface>
--- a/po/POTFILES.in Thu Oct 28 23:26:57 2021 -0500 +++ b/po/POTFILES.in Thu Oct 28 23:43:20 2021 -0500 @@ -311,8 +311,6 @@ pidgin/gtkconn.c pidgin/gtkconv.c pidgin/gtkdialogs.c -pidgin/gtkicon-theme.c -pidgin/gtkicon-theme-loader.c pidgin/gtkidle.c pidgin/gtkmedia.c pidgin/gtknotify.c @@ -322,7 +320,6 @@ pidgin/gtkroomlist.c pidgin/gtksavedstatuses.c pidgin/gtkstatusbox.c -pidgin/gtkstatus-icon-theme.c pidgin/gtkutils.c pidgin/gtkwhiteboard.c pidgin/gtkxfer.c @@ -363,7 +360,6 @@ pidgin/pidginprotocolchooser.c pidgin/pidginprotocolstore.c pidgin/pidginscrollbook.c -pidgin/pidginstock.c pidgin/pidginstylecontext.c pidgin/pidgintalkatu.c pidgin/plugins/disco/gtkdisco.c