libpurple/action.c

Wed, 03 Jul 2019 00:21:33 -0400

author
Elliott Sales de Andrade <qulogic@pidgin.im>
date
Wed, 03 Jul 2019 00:21:33 -0400
changeset 39659
e4dfb99b0cef
parent 39514
9c7715998bbc
child 39742
bed2cb40d222
permissions
-rw-r--r--

Fix libpurple header guards using reserved names.

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
39487
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
52 purple_action_menu_set_children(act, NULL);
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
53
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
54 g_free(act->stock_icon);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
55 g_free(act->label);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
56 g_free(act);
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
58
39487
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
59 const gchar *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
60 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
61 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
62
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
63 return act->label;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
64 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
65
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
66 GCallback
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
67 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
68 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
69
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 return act->callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
72
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 gpointer
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
74 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
75 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
76
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 return act->data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 GList *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
81 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
82 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
83
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 return act->children;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
87 void
39487
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
88 purple_action_menu_set_label(PurpleActionMenu *act, const gchar *label) {
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
89 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
90
39487
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
91 g_free(act->label);
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
92
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
93 act->label = g_strdup(label);
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94 }
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 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
97 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
98 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
99
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 act->callback = callback;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
101 }
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 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
104 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
105 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
106
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
107 act->data = data;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
108 }
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 void
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
111 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
112 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
113
39514
9c7715998bbc Cleanup account.[ch] and status.[ch] to remove g_type_class_add_private and other cleans including remove const from accessors
Gary Kramlich <grim@reaperworld.com>
parents: 39487
diff changeset
114 g_list_free_full(act->children, (GDestroyNotify)purple_action_menu_free);
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
115
39487
f0e629b4c500 Address a number of issues with ownership and leaking
Gary Kramlich <grim@reaperworld.com>
parents: 39484
diff changeset
116 act->children = children;
39479
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
117 }
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 const gchar *
39483
ab4728087d87 Rename purple_menu_action_* to purple_action_menu_*
Gary Kramlich <grim@reaperworld.com>
parents: 39481
diff changeset
120 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
121 return act->stock_icon;
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
122 }
4da996236e9b Move the MenuAction stuff to the new action.[ch] files
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
123
39480
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
124 /******************************************************************************
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
125 * Protocol Action API
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
126 *****************************************************************************/
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
127 PurpleProtocolAction *
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
128 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
129 PurpleProtocolAction *action;
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
130
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
131 g_return_val_if_fail(label != NULL, NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
132 g_return_val_if_fail(callback != NULL, NULL);
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 action = g_new0(PurpleProtocolAction, 1);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
135
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
136 action->label = g_strdup(label);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
137 action->callback = callback;
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 return action;
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
140 }
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 void
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
143 purple_protocol_action_free(PurpleProtocolAction *action) {
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
144 g_return_if_fail(action != NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
145
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
146 g_free(action->label);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
147 g_free(action);
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
39484
0ece2412a0b0 Add some basic unit tests
Gary Kramlich <grim@reaperworld.com>
parents: 39483
diff changeset
150 PurpleProtocolAction *
39480
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
151 purple_protocol_action_copy(PurpleProtocolAction *action) {
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
152 g_return_val_if_fail(action != NULL, NULL);
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
153
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
154 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
155 }
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 G_DEFINE_BOXED_TYPE(
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
158 PurpleProtocolAction,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
159 purple_protocol_action,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
160 purple_protocol_action_copy,
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
161 purple_protocol_action_free
5e089a52b01b Move the ProtocolActionInterface to action.[ch]
Gary Kramlich <grim@reaperworld.com>
parents: 39479
diff changeset
162 );

mercurial