Replace functions which called once with their bodies
[pidgin-git.git] / pidgin / plugins / gtkbuddynote.c
blobc73bc9bf2198a0074df61caa939941023a8ebdbe
1 /*
2 * GtkBuddyNote - Store notes on particular buddies
3 * Copyright (C) 2007 Etan Reisner <deryni@pidgin.im>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA.
19 #include "internal.h"
21 #include <gtkblist.h>
22 #include <gtkplugin.h>
24 #include <debug.h>
25 #include <version.h>
27 static void
28 append_to_tooltip(PurpleBlistNode *node, GString *text, gboolean full)
30 if (full) {
31 const gchar *note = purple_blist_node_get_string(node, "notes");
33 if ((note != NULL) && (*note != '\0')) {
34 char *tmp, *esc;
35 purple_markup_html_to_xhtml(note, NULL, &tmp);
36 esc = g_markup_escape_text(tmp, -1);
37 g_free(tmp);
38 g_string_append_printf(text, _("\n<b>Buddy Note</b>: %s"),
39 esc);
40 g_free(esc);
45 static PidginPluginInfo *
46 plugin_query(GError **error)
48 const gchar * const authors[] = {
49 "Etan Reisner <deryni@pidgin.im>",
50 NULL
53 const gchar * const dependencies[] = {
54 "core-plugin_pack-buddynote",
55 NULL
58 return pidgin_plugin_info_new(
59 "id", "gtkbuddynote",
60 "name", N_("Buddy Note Tooltips"),
61 "version", DISPLAY_VERSION,
62 "category", N_("User interface"),
63 "summary", N_("Shows stored buddy notes on the buddy's tooltip."),
64 "description", N_("Shows stored buddy notes on the buddy's tooltip."),
65 "authors", authors,
66 "website", PURPLE_WEBSITE,
67 "abi-version", PURPLE_ABI_VERSION,
68 "dependencies", dependencies,
69 NULL
73 static gboolean
74 plugin_load(PurplePlugin *plugin, GError **error)
76 purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip",
77 plugin, PURPLE_CALLBACK(append_to_tooltip), NULL);
78 return TRUE;
81 static gboolean
82 plugin_unload(PurplePlugin *plugin, GError **error)
84 return TRUE;
87 PURPLE_PLUGIN_INIT(gtkbuddynote, plugin_query, plugin_load, plugin_unload);