1 /* Purple is the legal property of its developers, whose names are too numerous
2 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (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
22 struct _PurpleActionMenu
{
29 /******************************************************************************
31 *****************************************************************************/
33 purple_action_menu_new(const gchar
*label
, GCallback callback
, gpointer data
,
36 PurpleActionMenu
*act
= g_new(PurpleActionMenu
, 1);
38 act
->label
= g_strdup(label
);
39 act
->callback
= callback
;
41 act
->children
= children
;
47 purple_action_menu_free(PurpleActionMenu
*act
) {
48 g_return_if_fail(act
!= NULL
);
50 purple_action_menu_set_children(act
, NULL
);
57 purple_action_menu_get_label(const PurpleActionMenu
*act
) {
58 g_return_val_if_fail(act
!= NULL
, NULL
);
64 purple_action_menu_get_callback(const PurpleActionMenu
*act
) {
65 g_return_val_if_fail(act
!= NULL
, NULL
);
71 purple_action_menu_get_data(const PurpleActionMenu
*act
) {
72 g_return_val_if_fail(act
!= NULL
, NULL
);
78 purple_action_menu_get_children(const PurpleActionMenu
*act
) {
79 g_return_val_if_fail(act
!= NULL
, NULL
);
85 purple_action_menu_set_label(PurpleActionMenu
*act
, const gchar
*label
) {
86 g_return_if_fail(act
!= NULL
);
90 act
->label
= g_strdup(label
);
94 purple_action_menu_set_callback(PurpleActionMenu
*act
, GCallback callback
) {
95 g_return_if_fail(act
!= NULL
);
97 act
->callback
= callback
;
101 purple_action_menu_set_data(PurpleActionMenu
*act
, gpointer data
) {
102 g_return_if_fail(act
!= NULL
);
108 purple_action_menu_set_children(PurpleActionMenu
*act
, GList
*children
) {
109 g_return_if_fail(act
!= NULL
);
111 g_list_free_full(act
->children
, (GDestroyNotify
)purple_action_menu_free
);
113 act
->children
= children
;
116 /******************************************************************************
117 * Protocol Action API
118 *****************************************************************************/
119 PurpleProtocolAction
*
120 purple_protocol_action_new(const gchar
* label
, PurpleProtocolActionCallback callback
) {
121 PurpleProtocolAction
*action
;
123 g_return_val_if_fail(label
!= NULL
, NULL
);
124 g_return_val_if_fail(callback
!= NULL
, NULL
);
126 action
= g_new0(PurpleProtocolAction
, 1);
128 action
->label
= g_strdup(label
);
129 action
->callback
= callback
;
135 purple_protocol_action_free(PurpleProtocolAction
*action
) {
136 g_return_if_fail(action
!= NULL
);
138 g_free(action
->label
);
142 PurpleProtocolAction
*
143 purple_protocol_action_copy(PurpleProtocolAction
*action
) {
144 g_return_val_if_fail(action
!= NULL
, NULL
);
146 return purple_protocol_action_new(action
->label
, action
->callback
);
150 PurpleProtocolAction
,
151 purple_protocol_action
,
152 purple_protocol_action_copy
,
153 purple_protocol_action_free