comparison libpurple/plugins/buddynote.c @ 15374:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15373:f79e0f4df793 15374:5fe8042783c1
1 /*
2 * BuddyNote - Store notes on particular buddies
3 * Copyright (C) 2004 Stu Tomlinson <stu@nosnilmot.com>
4 *
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.
9 *
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.
14 *
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 */
19 #include "internal.h"
20
21 #include <debug.h>
22 #include <notify.h>
23 #include <request.h>
24 #include <signals.h>
25 #include <util.h>
26 #include <version.h>
27
28 static void
29 dont_do_it_cb(GaimBlistNode *node, const char *note)
30 {
31 }
32
33 static void
34 do_it_cb(GaimBlistNode *node, const char *note)
35 {
36 gaim_blist_node_set_string(node, "notes", note);
37 }
38
39 static void
40 buddynote_edit_cb(GaimBlistNode *node, gpointer data)
41 {
42 const char *note;
43
44 note = gaim_blist_node_get_string(node, "notes");
45
46 gaim_request_input(node, _("Notes"),
47 _("Enter your notes below..."),
48 NULL,
49 note, TRUE, FALSE, "html",
50 _("Save"), G_CALLBACK(do_it_cb),
51 _("Cancel"), G_CALLBACK(dont_do_it_cb),
52 node);
53 }
54
55 static void
56 buddynote_extended_menu_cb(GaimBlistNode *node, GList **m)
57 {
58 GaimMenuAction *bna = NULL;
59
60 *m = g_list_append(*m, bna);
61 bna = gaim_menu_action_new(_("Edit Notes..."), GAIM_CALLBACK(buddynote_edit_cb), NULL, NULL);
62 *m = g_list_append(*m, bna);
63 }
64
65 static gboolean
66 plugin_load(GaimPlugin *plugin)
67 {
68
69 gaim_signal_connect(gaim_blist_get_handle(), "blist-node-extended-menu",
70 plugin, GAIM_CALLBACK(buddynote_extended_menu_cb), NULL);
71
72 return TRUE;
73 }
74
75 static GaimPluginInfo info =
76 {
77 GAIM_PLUGIN_MAGIC,
78 GAIM_MAJOR_VERSION, /**< major version */
79 GAIM_MINOR_VERSION,
80 GAIM_PLUGIN_STANDARD, /**< type */
81 NULL, /**< ui_requirement */
82 0, /**< flags */
83 NULL, /**< dependencies */
84 GAIM_PRIORITY_DEFAULT, /**< priority */
85
86 "core-plugin_pack-buddynote", /**< id */
87 N_("Buddy Notes"), /**< name */
88 VERSION, /**< version */
89 N_("Store notes on particular buddies."), /** summary */
90 N_("Adds the option to store notes for buddies "
91 "on your buddy list."), /** description */
92 "Stu Tomlinson <stu@nosnilmot.com>", /**< author */
93 GAIM_WEBSITE, /**< homepage */
94
95 plugin_load, /**< load */
96 NULL, /**< unload */
97 NULL, /**< destroy */
98
99 NULL, /**< ui_info */
100 NULL, /**< extra_info */
101 NULL, /**< prefs_info */
102 NULL /**< actions */
103 };
104
105
106 static void
107 init_plugin(GaimPlugin *plugin) {
108 }
109
110 GAIM_INIT_PLUGIN(buddynote, init_plugin, info)