pidgin/pidgindebugplugininfo.c

Mon, 01 Apr 2019 21:57:01 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Mon, 01 Apr 2019 21:57:01 -0400
changeset 39555
1f7690fa7761
parent 39534
9448c3eb652a
child 39834
0345d198dbd6
permissions
-rw-r--r--

Fixup typo in sound theme title.

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(
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 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
65 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
66 );
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 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
70 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
71 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
72 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
73
46885fa0a1a8 Start of 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 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
75
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
76 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
77 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
78 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
79 );
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
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
81 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
82 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
83 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
84 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
85 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
86 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
87 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
88 const gchar *error_message = NULL;
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
89 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
90 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
91
46885fa0a1a8 Start of 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 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
93 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
94 "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
95 "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
96 "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
97 "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
98 "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
99 "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
100 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
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 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
104 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
105 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
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 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
108 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
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
46885fa0a1a8 Start of 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 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
112 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
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
46885fa0a1a8 Start of 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 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
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 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
118
46885fa0a1a8 Start of 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 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
120 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
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 /* 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
123 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
124 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
125 "<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
126 "<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
127 "<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
128 "<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
129 "<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
130 "<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
131 "<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
132 "<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
133 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
134 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
135 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
136 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
137 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
138 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
139 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
140 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
141 );
46885fa0a1a8 Start of 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
39472
24cfcda8dde9 Fix some use-after-free's that QuLogic found while reviewing
Gary Kramlich <grim@reaperworld.com>
parents: 39471
diff changeset
143 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
144 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
145 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
146 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
147 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
148 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
149
46885fa0a1a8 Start of 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_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
151 }
46885fa0a1a8 Start of 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_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
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 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
156
46885fa0a1a8 Start of 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 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
158 }
46885fa0a1a8 Start of 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 /******************************************************************************
46885fa0a1a8 Start of 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 * 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
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 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
164 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
165 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
166 }
46885fa0a1a8 Start of 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 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
169 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
170 GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
171
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
172 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
173 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
174 "/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
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
39474
f019fd276b1d Clean up a lot of compiler warnings
Gary Kramlich <grim@reaperworld.com>
parents: 39473
diff changeset
177 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
178 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
179 }
46885fa0a1a8 Start of 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 /******************************************************************************
46885fa0a1a8 Start of 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 * 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
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 /**
46885fa0a1a8 Start of 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 * 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
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 * 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
189 * 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
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 * 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
192 */
46885fa0a1a8 Start of 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 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
194 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
195 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
196 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
197 ));
46885fa0a1a8 Start of 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 }
46885fa0a1a8 Start of 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
46885fa0a1a8 Start of 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 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
201 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
202 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
203 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
204 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
205
46885fa0a1a8 Start of 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 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
207 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
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 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
210 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
211 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
212
46885fa0a1a8 Start of 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 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
214 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
215 }

mercurial