pidgin/pidgindebugplugininfo.c

Fri, 22 Mar 2019 01:54:47 +0000

author
Gary Kramlich <grim@reaperworld.com>
date
Fri, 22 Mar 2019 01:54:47 +0000
changeset 39493
72d1afcb0a8c
parent 39475
bdfad14e7003
child 39534
9448c3eb652a
permissions
-rw-r--r--

Merged in default (pull request #480)

Replace some g_snprintf

Approved-by: Gary Kramlich
Approved-by: Eion Robb

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
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
29 /**
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
30 * 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
31 * @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
32 * @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
33 *
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
34 * 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
35 * 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
36 * 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
37 */
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
38
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
39 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
40 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
41 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
42 } 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
43
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 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
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 /******************************************************************************
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 * 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
48 *****************************************************************************/
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
49 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
50 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
51 return g_strcmp0(
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
52 purple_plugin_info_get_id(purple_plugin_get_info(PURPLE_PLUGIN(a))),
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
53 purple_plugin_info_get_id(purple_plugin_get_info(PURPLE_PLUGIN(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
54 );
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
55 }
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
56
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
57 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
58 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
59 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
60 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
61
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
62 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
63
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
64 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
65 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
66 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
67 );
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
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
69 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
70 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
71 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
72 PurplePluginExtraCb 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
73 gchar *name = g_markup_escape_text(purple_plugin_info_get_name(info), -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
74 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
75 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
76 const gchar *error_message = NULL;
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
77 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
78 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
79
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
80 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
81 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
82 "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
83 "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
84 "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
85 "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
86 "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
87 "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
88 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
89 );
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
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 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
92 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
93 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
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 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
96 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
97 }
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
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 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
100 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
101 }
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
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 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
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 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
106
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 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
108 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
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 /* 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
111 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
112 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
113 "<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
114 "<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
115 "<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
116 "<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
117 "<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
118 "<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
119 "<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
120 "<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
121 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
122 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
123 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
124 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
125 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
126 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
127 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
128 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
129 );
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
39472
24cfcda8dde9 Fix some use-after-free's that QuLogic found while reviewing
Gary Kramlich <grim@reaperworld.com>
parents: 39471
diff changeset
131 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
132 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
133 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
134 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
135 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
136 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
137
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 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
139 }
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
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 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
142
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 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
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 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
146 }
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
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 /******************************************************************************
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 * 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
150 *****************************************************************************/
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
151 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
152 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
153 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
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 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
157 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
158 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
159
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
160 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
161 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
162 "/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
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
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
165 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
166 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
167 }
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
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 * 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
171 *****************************************************************************/
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
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
173 /**
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
174 * 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
175 *
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
176 * 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
177 * 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
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 * 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
180 */
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
181 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
182 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
183 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
184 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
185 ));
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 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
189 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
190 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
191 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
192 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
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 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
195 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
196
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 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
198 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
199 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
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 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
202 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
203 }

mercurial