* 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
* 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 "pidgindebugplugininfo.h"
struct _PidginDebugPluginInfo {
struct _PidginDebugPluginInfoClass {
* SECTION:pidgindebugplugininfo
* @Title: Debug Plugin Info
* @Short_description: A widget that lists verbose plugin info
* When helping users troubleshoot issues with Pidgin we often need to know
* what plugins that have installed/running. This widget gives them an easy
* way to get that info to us.
} PidginDebugPluginInfoPrivate;
G_DEFINE_TYPE_WITH_PRIVATE(PidginDebugPluginInfo, pidgin_debug_plugin_info, GTK_TYPE_DIALOG)
/******************************************************************************
*****************************************************************************/
purple_debug_plugin_compare_plugin_id(gconstpointer a, gconstpointer b) {
gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(
purple_plugin_get_info(PURPLE_PLUGIN((gpointer)a)))),
gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(
purple_plugin_get_info(PURPLE_PLUGIN((gpointer)b)))));
pidgin_debug_plugin_info_build_html(void) {
GString *str = g_string_new(NULL);
GList *plugins = NULL, *l = NULL;
g_string_append_printf(str, "<h2>%s</h2><dl>", _("Plugin Information"));
purple_plugins_find_all(),
purple_debug_plugin_compare_plugin_id
for(l = plugins; l != NULL; l = l->next) {
PurplePlugin *plugin = PURPLE_PLUGIN(l->data);
PurplePluginInfo *info = purple_plugin_get_info(plugin);
PurplePluginExtraCb extra_cb;
gchar *name = g_markup_escape_text(
gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(info)),
gchar *version, *license, *website, *id;
gchar *authors = NULL, *extra = NULL;
const gchar *error_message = NULL;
gchar *authorstmp = g_strjoinv(", ", (gchar **)authorsv);
authors = g_markup_escape_text(authorstmp, -1);
extra = extra_cb(plugin);
error_message = purple_plugin_info_get_error(info);
loaded = purple_plugin_is_loaded(plugin);
g_string_append_printf(str, "<dt>%s</dt><dd>", name);
/* this is not translated as it's meant for debugging */
"<b>Authors:</b> %s<br/>"
"<b>Version:</b> %s<br/>"
"<b>License:</b> %s<br/>"
"<b>Website:</b> %s<br/>"
error_message ? error_message : "",
g_clear_pointer(&authors, g_free);
g_clear_pointer(&extra, g_free);
g_string_append(str, "</dd>");
g_string_append(str, "</dl>");
return g_string_free(str, FALSE);
/******************************************************************************
*****************************************************************************/
pidgin_debug_plugin_info_init(PidginDebugPluginInfo *debug_plugin_info) {
gtk_widget_init_template(GTK_WIDGET(debug_plugin_info));
pidgin_debug_plugin_info_class_init(PidginDebugPluginInfoClass *klass) {
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
gtk_widget_class_set_template_from_resource(
"/im/pidgin/Pidgin/Debug/plugininfo.ui"
gtk_widget_class_bind_template_child_private(widget_class, PidginDebugPluginInfo, buffer);
gtk_widget_class_bind_template_child_private(widget_class, PidginDebugPluginInfo, view);
/******************************************************************************
*****************************************************************************/
* pidgin_debug_plugin_info_new:
* Creates a new #PidginDebugPluginInfo that provides the user with an easy way
* to share information about their plugin state for debugging purposes.
* Returns: (transfer full): The new #PidginDebugPluginInfo instance.
GtkWidget *pidgin_debug_plugin_info_new(void) {
return GTK_WIDGET(g_object_new(
PIDGIN_TYPE_DEBUG_PLUGIN_INFO,
pidgin_debug_plugin_info_show(void) {
PidginDebugPluginInfoPrivate *priv = NULL;
win = pidgin_debug_plugin_info_new();
priv = pidgin_debug_plugin_info_get_instance_private(PIDGIN_DEBUG_PLUGIN_INFO(win));
text = pidgin_debug_plugin_info_build_html();
talkatu_markup_set_html(TALKATU_BUFFER(priv->buffer), text, -1);
gtk_widget_show_all(win);
gtk_window_present(GTK_WINDOW(win));