summaryrefslogtreecommitdiff
path: root/libpurple/action.h
blob: 58a2a8444f2c0320da71b1b765a9cd7465a8d4d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
/* purple
 *
 * Purple is the legal property of its developers, whose names are too numerous
 * to list here.  Please refer to the COPYRIGHT file distributed with this
 * source distribution.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
 */

#ifndef PURPLE_ACTION
#define PURPLE_ACTION

#include <glib.h>
#include <glib-object.h>

/**
 * PurpleMenuAction:
 *
 * A generic structure that contains information about an "action."  One
 * place this is is used is by protocols to tell the core the list of available
 * right-click actions for a buddy list row.
 */
typedef struct _PurpleMenuAction PurpleMenuAction;

G_BEGIN_DECLS

/**
 * purple_menu_action_new:
 * @label:    The text label to display for this action.
 * @callback: The function to be called when the action is used on
 *                 the selected item.
 * @data:     Additional data to be passed to the callback.
 * @children: (element-type PurpleMenuAction) (transfer full): Menu actions to
 *            be added as a submenu of this action.
 *
 * Creates a new PurpleMenuAction.
 *
 * Returns: The PurpleMenuAction.
 */
PurpleMenuAction *purple_menu_action_new(const gchar *label, GCallback callback, gpointer data, GList *children);

/**
 * purple_menu_action_free:
 * @act: The PurpleMenuAction to free.
 *
 * Frees a PurpleMenuAction
 */
void purple_menu_action_free(PurpleMenuAction *act);

/**
 * purple_menu_action_get_label:
 * @act:	The PurpleMenuAction.
 *
 * Returns the label of the PurpleMenuAction.
 *
 * Returns: The label string.
 */
gchar *purple_menu_action_get_label(const PurpleMenuAction *act);

/**
 * purple_menu_action_get_callback:
 * @act:	The PurpleMenuAction.
 *
 * Returns the callback of the PurpleMenuAction.
 *
 * Returns: The callback function.
 */
GCallback purple_menu_action_get_callback(const PurpleMenuAction *act);

/**
 * purple_menu_action_get_data:
 * @act:	The PurpleMenuAction.
 *
 * Returns the data stored in the PurpleMenuAction.
 *
 * Returns: The data.
 */
gpointer purple_menu_action_get_data(const PurpleMenuAction *act);

/**
 * purple_menu_action_get_children:
 * @act:	The PurpleMenuAction.
 *
 * Returns the children of the PurpleMenuAction.
 *
 * Returns: (element-type PurpleMenuAction) (transfer none): The menu children.
 */
GList* purple_menu_action_get_children(const PurpleMenuAction *act);

/**
 * purple_menu_action_set_label:
 * @act:   The menu action.
 * @label: The label for the menu action.
 *
 * Set the label to the PurpleMenuAction.
 */
void purple_menu_action_set_label(PurpleMenuAction *act, gchar *label);

/**
 * purple_menu_action_set_callback:
 * @act:        The menu action.
 * @callback:   The callback.
 *
 * Set the callback that will be used by the PurpleMenuAction.
 */
void purple_menu_action_set_callback(PurpleMenuAction *act, GCallback callback);

/**
 * purple_menu_action_set_data:
 * @act:   The menu action.
 * @data:  The data used by this PurpleMenuAction
 *
 * Set the label to the PurpleMenuAction.
 */
void purple_menu_action_set_data(PurpleMenuAction *act, gpointer data);

/**
 * purple_menu_action_set_children:
 * @act:       The menu action.
 * @children: (element-type PurpleMenuAction) (transfer full): The menu children
 *
 * Set the children of the PurpleMenuAction.
 */
void purple_menu_action_set_children(PurpleMenuAction *act, GList *children);

/**
 * purple_menu_action_set_stock_icon:
 * @act:   The menu action.
 * @stock: The stock icon identifier.
 *
 * Sets the icon for the PurpleMenuAction.
 */
void purple_menu_action_set_stock_icon(PurpleMenuAction *act, const gchar *stock);

/**
 * purple_menu_action_get_stock_icon:
 * @act: The menu action.
 *
 * Gets the stock icon of the PurpleMenuAction.
 *
 * Returns: The stock icon identifier.
 */
const gchar *purple_menu_action_get_stock_icon(PurpleMenuAction *act);

G_END_DECLS

#endif /* PURPLE_ACTION */