pidgin/pidgindebugplugininfo.c

Fri, 25 Oct 2019 05:18:58 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Fri, 25 Oct 2019 05:18:58 -0400
changeset 40078
3f61b0cd94de
parent 39834
0345d198dbd6
permissions
-rw-r--r--

Don't leak simple watcher structs.

39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* pidgin
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * Pidgin is the legal property of its developers, whose names are too numerous
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * to list here. Please refer to the COPYRIGHT file distributed with this
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * source distribution.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * it under the terms of the GNU General Public License as published by
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * (at your option) any later version.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * GNU General Public License for more details.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 */
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 #include <talkatu.h>
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include "internal.h"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 #include "plugins.h"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 #include "pidgindebugplugininfo.h"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28
39534
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
29 struct _PidginDebugPluginInfo {
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
30 GtkDialog parent;
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
31
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
32 gpointer reserved[4];
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
33 };
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
34
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
35 struct _PidginDebugPluginInfoClass {
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
36 GtkDialogClass parent;
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
37
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
38 gpointer reserved[4];
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
39 };
9448c3eb652a Use G_DECLARE* in pidgindebugplugininfo.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39475
diff changeset
40
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 /**
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 * SECTION:pidgindebugplugininfo
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 * @Title: Debug Plugin Info
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44 * @Short_description: A widget that lists verbose plugin info
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 * When helping users troubleshoot issues with Pidgin we often need to know
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47 * what plugins that have installed/running. This widget gives them an easy
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 * way to get that info to us.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
49 */
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51 typedef struct {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 GtkTextBuffer *buffer;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 GtkWidget *view;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 } PidginDebugPluginInfoPrivate;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 G_DEFINE_TYPE_WITH_PRIVATE(PidginDebugPluginInfo, pidgin_debug_plugin_info, GTK_TYPE_DIALOG)
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58 /******************************************************************************
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 * Helpers
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60 *****************************************************************************/
39473
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
61 static gint
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
62 purple_debug_plugin_compare_plugin_id(gconstpointer a, gconstpointer b) {
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
63 return g_strcmp0(
39834
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
64 gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
65 purple_plugin_get_info(PURPLE_PLUGIN((gpointer)a)))),
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
66 gplugin_plugin_info_get_id(GPLUGIN_PLUGIN_INFO(
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
67 purple_plugin_get_info(PURPLE_PLUGIN((gpointer)b)))));
39473
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
68 }
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
69
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 static gchar *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 pidgin_debug_plugin_info_build_html(void) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72 GString *str = g_string_new(NULL);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 GList *plugins = NULL, *l = NULL;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 g_string_append_printf(str, "<h2>%s</h2><dl>", _("Plugin Information"));
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
39473
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
77 plugins = g_list_sort(
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
78 purple_plugins_find_all(),
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
79 purple_debug_plugin_compare_plugin_id
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
80 );
734a8d202411 Sort the plugins in the plugin info window by id (so we can easily spot dupes)
Gary Kramlich <grim@reaperworld.com>
parents: 39472
diff changeset
81
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 for(l = plugins; l != NULL; l = l->next) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 PurplePlugin *plugin = PURPLE_PLUGIN(l->data);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 PurplePluginInfo *info = purple_plugin_get_info(plugin);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 PurplePluginExtraCb extra_cb;
39834
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
86 gchar *name = g_markup_escape_text(
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
87 gplugin_plugin_info_get_name(GPLUGIN_PLUGIN_INFO(info)),
0345d198dbd6 Remove redundant purple_plugin_info_get_* wrappers.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 39534
diff changeset
88 -1);
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 gchar *version, *license, *website, *id;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 gchar *authors = NULL, *extra = NULL;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 const gchar *error_message = NULL;
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
92 gchar **authorsv;
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 gboolean loaded;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 g_object_get(
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 G_OBJECT(info),
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 "authors", &authorsv,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98 "version", &version,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 "license-id", &license,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 "website", &website,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 "id", &id,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 "extra-cb", &extra_cb,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 NULL
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 );
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 if(authorsv != NULL) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 gchar *authorstmp = g_strjoinv(", ", (gchar **)authorsv);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 g_strfreev(authorsv);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 authors = g_markup_escape_text(authorstmp, -1);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 g_free(authorstmp);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
114 if(extra_cb != NULL) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 extra = extra_cb(plugin);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 error_message = purple_plugin_info_get_error(info);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 loaded = purple_plugin_is_loaded(plugin);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 g_string_append_printf(str, "<dt>%s</dt><dd>", name);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123 g_free(name);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 /* this is not translated as it's meant for debugging */
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126 g_string_append_printf(
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
127 str,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 "<b>Authors:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 "<b>Version:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
130 "<b>License:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
131 "<b>Website:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 "<b>ID:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 "<b>Extra:</b> %s<br/>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
134 "<b>Errors:</b> %s</br>"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 "<b>Loaded:</b> %s",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 authors ? authors : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 version ? version : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
138 license ? license : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
139 website ? website : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
140 id ? id : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
141 extra ? extra : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
142 error_message ? error_message : "",
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 loaded ? "Yes" : "No"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 );
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145
39472
24cfcda8dde9 Fix some use-after-free's that QuLogic found while reviewing
Gary Kramlich <grim@reaperworld.com>
parents: 39471
diff changeset
146 g_clear_pointer(&authors, g_free);
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
147 g_free(version);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 g_free(license);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
149 g_free(website);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_free(id);
39472
24cfcda8dde9 Fix some use-after-free's that QuLogic found while reviewing
Gary Kramlich <grim@reaperworld.com>
parents: 39471
diff changeset
151 g_clear_pointer(&extra, g_free);
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
152
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
153 g_string_append(str, "</dd>");
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 g_list_free(plugins);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
157
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
158 g_string_append(str, "</dl>");
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 return g_string_free(str, FALSE);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
162
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
163 /******************************************************************************
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 * GObject Stuff
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 *****************************************************************************/
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 static void
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
167 pidgin_debug_plugin_info_init(PidginDebugPluginInfo *debug_plugin_info) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 gtk_widget_init_template(GTK_WIDGET(debug_plugin_info));
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
170
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
171 static void
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 pidgin_debug_plugin_info_class_init(PidginDebugPluginInfoClass *klass) {
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
173 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
174
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
175 gtk_widget_class_set_template_from_resource(
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
176 widget_class,
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 "/im/pidgin/Pidgin/Debug/plugininfo.ui"
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
178 );
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
179
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
180 gtk_widget_class_bind_template_child_private(widget_class, PidginDebugPluginInfo, buffer);
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
181 gtk_widget_class_bind_template_child_private(widget_class, PidginDebugPluginInfo, view);
39471
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
184 /******************************************************************************
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 * Public API
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
186 *****************************************************************************/
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
187
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 /**
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 * pidgin_debug_plugin_info_new:
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
190 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 * Creates a new #PidginDebugPluginInfo that provides the user with an easy way
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 * to share information about their plugin state for debugging purposes.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
193 *
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
194 * Returns: (transfer full): The new #PidginDebugPluginInfo instance.
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 */
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 GtkWidget *pidgin_debug_plugin_info_new(void) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
197 return GTK_WIDGET(g_object_new(
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 PIDGIN_TYPE_DEBUG_PLUGIN_INFO,
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 NULL
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
200 ));
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 }
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
203 void
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 pidgin_debug_plugin_info_show(void) {
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 PidginDebugPluginInfoPrivate *priv = NULL;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 GtkWidget *win = NULL;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 gchar *text = NULL;
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 win = pidgin_debug_plugin_info_new();
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
210 priv = pidgin_debug_plugin_info_get_instance_private(PIDGIN_DEBUG_PLUGIN_INFO(win));
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
211
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 text = pidgin_debug_plugin_info_build_html();
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 talkatu_markup_set_html(TALKATU_BUFFER(priv->buffer), text, -1);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 g_free(text);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
215
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
216 gtk_widget_show_all(win);
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 gtk_window_present(GTK_WINDOW(win));
46885fa0a1a8 Start of moving the plugin info dialog to talkatu. Still need to handle error messages and their formatting
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 }

mercurial