libpurple/action.c

Thu, 15 Feb 2018 22:53:57 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Thu, 15 Feb 2018 22:53:57 -0600
changeset 39483
ab4728087d87
parent 39481
4db28449567d
child 39484
0ece2412a0b0
permissions
-rw-r--r--

Rename purple_menu_action_* to purple_action_menu_*

39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /* Purple is the legal property of its developers, whose names are too numerous
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * to list here. Please refer to the COPYRIGHT file distributed with this
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 * source distribution.
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 *
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * This program is free software; you can redistribute it and/or modify
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 * the Free Software Foundation; either version 2 of the License, or
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * (at your option) any later version.
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 *
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * GNU General Public License for more details.
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 *
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 */
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 #include "action.h"
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21
39481
4db28449567d Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents: 39480
diff changeset
22 struct _PurpleActionMenu {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23 gchar *label;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 GCallback callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25 gpointer data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 GList *children;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27 gchar *stock_icon;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 };
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
30 /******************************************************************************
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
31 * ActionMenu API
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
32 *****************************************************************************/
39481
4db28449567d Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents: 39480
diff changeset
33 PurpleActionMenu *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
34 purple_action_menu_new(const gchar *label, GCallback callback, gpointer data,
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
35 GList *children)
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
36 {
39481
4db28449567d Rename PurpleMenuAction to PurpleActionMenu
Gary Kramlich <grim@reaperworld.com>
parents: 39480
diff changeset
37 PurpleActionMenu *act = g_new(PurpleActionMenu, 1);
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
38
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
39 act->label = g_strdup(label);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
40 act->callback = callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
41 act->data = data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
42 act->children = children;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
43 act->stock_icon = NULL;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
44
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
45 return act;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
47
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
48 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
49 purple_action_menu_free(PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
50 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
51
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
52 g_free(act->stock_icon);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
53 g_free(act->label);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_free(act);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 gchar *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
58 purple_action_menu_get_label(const PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
59 g_return_val_if_fail(act != NULL, NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
60
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
61 return act->label;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
62 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 GCallback
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
65 purple_action_menu_get_callback(const PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 g_return_val_if_fail(act != NULL, NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
67
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
68 return act->callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 gpointer
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
72 purple_action_menu_get_data(const PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 g_return_val_if_fail(act != NULL, NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
74
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 return act->data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 GList *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
79 purple_action_menu_get_children(const PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 g_return_val_if_fail(act != NULL, NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 return act->children;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
86 purple_action_menu_set_label(PurpleActionMenu *act, gchar *label) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
88
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 act-> label = label;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
93 purple_action_menu_set_callback(PurpleActionMenu *act, GCallback callback) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 act->callback = callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
98
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
100 purple_action_menu_set_data(PurpleActionMenu *act, gpointer data) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 act->data = data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
106 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
107 purple_action_menu_set_children(PurpleActionMenu *act, GList *children) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
109
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
110 act->children = children;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
111 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
112
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
113 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
114 purple_action_menu_set_stock_icon(PurpleActionMenu *act, const gchar *stock) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115 g_return_if_fail(act != NULL);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
116
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 g_free(act->stock_icon);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 act->stock_icon = g_strdup(stock);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
120 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 const gchar *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
123 purple_action_menu_get_stock_icon(PurpleActionMenu *act) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 return act->stock_icon;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
125 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
126
39480
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
127 /******************************************************************************
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
128 * Protocol Action API
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
129 *****************************************************************************/
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
130 PurpleProtocolAction *
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
131 purple_protocol_action_new(const gchar* label, PurpleProtocolActionCallback callback) {
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
132 PurpleProtocolAction *action;
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
133
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
134 g_return_val_if_fail(label != NULL, NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
135 g_return_val_if_fail(callback != NULL, NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
136
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
137 action = g_new0(PurpleProtocolAction, 1);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
138
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
139 action->label = g_strdup(label);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
140 action->callback = callback;
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
141
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
142 return action;
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
143 }
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
144
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
145 void
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
146 purple_protocol_action_free(PurpleProtocolAction *action) {
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
147 g_return_if_fail(action != NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
148
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
149 g_free(action->label);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
150 g_free(action);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
151 }
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
152
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
153 static PurpleProtocolAction *
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
154 purple_protocol_action_copy(PurpleProtocolAction *action) {
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
155 g_return_val_if_fail(action != NULL, NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
156
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
157 return purple_protocol_action_new(action->label, action->callback);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
158 }
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
159
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
160 G_DEFINE_BOXED_TYPE(
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
161 PurpleProtocolAction,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
162 purple_protocol_action,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
163 purple_protocol_action_copy,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
164 purple_protocol_action_free
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
165 );

mercurial