Thu, 15 Feb 2018 22:53:57 -0600
Rename purple_menu_action_* to purple_action_menu_*
| 15230 | 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 | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17708
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301, USA. |
| 15230 | 18 | */ |
| 19 | #include "internal.h" | |
| 20 | ||
|
39479
4da996236e9b
Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
36742
diff
changeset
|
21 | #include <action.h> |
| 15230 | 22 | #include <debug.h> |
| 23 | #include <notify.h> | |
| 24 | #include <request.h> | |
| 25 | #include <signals.h> | |
| 26 | #include <version.h> | |
| 27 | ||
| 28 | static void | |
| 15884 | 29 | dont_do_it_cb(PurpleBlistNode *node, const char *note) |
| 15230 | 30 | { |
| 31 | } | |
| 32 | ||
| 33 | static void | |
| 15884 | 34 | do_it_cb(PurpleBlistNode *node, const char *note) |
| 15230 | 35 | { |
| 15884 | 36 | purple_blist_node_set_string(node, "notes", note); |
| 15230 | 37 | } |
| 38 | ||
| 39 | static void | |
| 15884 | 40 | buddynote_edit_cb(PurpleBlistNode *node, gpointer data) |
| 15230 | 41 | { |
| 42 | const char *note; | |
| 43 | ||
| 15884 | 44 | note = purple_blist_node_get_string(node, "notes"); |
| 15230 | 45 | |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
46 | purple_request_input(node, _("Notes"), |
| 15230 | 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), | |
|
34329
ddbc1337332c
Request API refactoring: introduce PurpleRequestCommonParameters and switch purple_request_input to it
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
21630
diff
changeset
|
52 | NULL, node); |
| 15230 | 53 | } |
| 54 | ||
| 55 | static void | |
| 15884 | 56 | buddynote_extended_menu_cb(PurpleBlistNode *node, GList **m) |
| 15230 | 57 | { |
|
39481
4db28449567d
Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents:
39479
diff
changeset
|
58 | PurpleActionMenu *bna = NULL; |
| 15230 | 59 | |
|
34865
764a33b41ac7
Renamed blist node's dont_save to transient.
Ankit Vani <a@nevitus.org>
parents:
34864
diff
changeset
|
60 | if (purple_blist_node_is_transient(node)) |
|
17708
0f23250ae460
Prevent the Buddy Notes plugin from offering to edit notes on a buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16745
diff
changeset
|
61 | return; |
|
0f23250ae460
Prevent the Buddy Notes plugin from offering to edit notes on a buddy list
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
16745
diff
changeset
|
62 | |
| 15230 | 63 | *m = g_list_append(*m, bna); |
|
39483
ab4728087d87
Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents:
39481
diff
changeset
|
64 | bna = purple_action_menu_new(_("Edit Notes..."), PURPLE_CALLBACK(buddynote_edit_cb), NULL, NULL); |
| 15230 | 65 | *m = g_list_append(*m, bna); |
| 66 | } | |
| 67 | ||
| 36742 | 68 | static PurplePluginInfo * |
| 69 | plugin_query(GError **error) | |
| 70 | { | |
| 71 | const gchar * const authors[] = { | |
| 72 | "Stu Tomlinson <stu@nosnilmot.com>", | |
| 73 | NULL | |
| 74 | }; | |
| 75 | ||
| 76 | return purple_plugin_info_new( | |
| 77 | "id", "core-plugin_pack-buddynote", | |
| 78 | "name", N_("Buddy Notes"), | |
| 79 | "version", DISPLAY_VERSION, | |
| 80 | "category", N_("Utility"), | |
| 81 | "summary", N_("Store notes on particular buddies."), | |
| 82 | "description", N_("Adds the option to store notes for buddies on your " | |
| 83 | "buddy list."), | |
| 84 | "authors", authors, | |
| 85 | "website", PURPLE_WEBSITE, | |
| 86 | "abi-version", PURPLE_ABI_VERSION, | |
| 87 | NULL | |
| 88 | ); | |
| 89 | } | |
| 90 | ||
| 15230 | 91 | static gboolean |
| 36742 | 92 | plugin_load(PurplePlugin *plugin, GError **error) |
| 15230 | 93 | { |
| 94 | ||
| 15884 | 95 | purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", |
| 96 | plugin, PURPLE_CALLBACK(buddynote_extended_menu_cb), NULL); | |
| 15230 | 97 | |
| 98 | return TRUE; | |
| 99 | } | |
| 100 | ||
| 36742 | 101 | static gboolean |
| 102 | plugin_unload(PurplePlugin *plugin, GError **error) | |
| 15230 | 103 | { |
| 36742 | 104 | return TRUE; |
| 15230 | 105 | } |
| 106 | ||
| 36742 | 107 | PURPLE_PLUGIN_INIT(buddynote, plugin_query, plugin_load, plugin_unload); |