3 * Purple is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PURPLE_REQUEST_DATA_H_
23 #define _PURPLE_REQUEST_DATA_H_
25 * SECTION:request-datasheet
26 * @section_id: libpurple-request-datasheet
27 * @short_description: <filename>request-datasheet.h</filename>
28 * @title: Request Datasheet API
33 typedef struct _PurpleRequestDatasheet PurpleRequestDatasheet
;
34 typedef struct _PurpleRequestDatasheetRecord PurpleRequestDatasheetRecord
;
35 typedef struct _PurpleRequestDatasheetAction PurpleRequestDatasheetAction
;
37 typedef void (*PurpleRequestDatasheetActionCb
)(
38 PurpleRequestDatasheetRecord
*rec
, gpointer user_data
);
39 typedef gboolean (*PurpleRequestDatasheetActionCheckCb
)(
40 PurpleRequestDatasheetRecord
*rec
, gpointer user_data
);
44 PURPLE_REQUEST_DATASHEET_COLUMN_STRING
,
45 PURPLE_REQUEST_DATASHEET_COLUMN_IMAGE
46 } PurpleRequestDatasheetColumnType
;
50 /**************************************************************************/
52 /**************************************************************************/
55 * purple_request_datasheet_new:
57 * Creates new Datasheet.
59 * Returns: The new datasheet.
61 PurpleRequestDatasheet
*
62 purple_request_datasheet_new(void);
65 * purple_request_datasheet_free:
66 * @sheet: The datasheet.
68 * Destroys datasheet with all its contents.
71 purple_request_datasheet_free(PurpleRequestDatasheet
*sheet
);
74 * purple_request_datasheet_add_column:
75 * @sheet: The datasheet.
76 * @type: The column type.
77 * @title: The column title (may be %NULL).
79 * Adds a column to the datasheet.
81 * You cannot add a column if datasheet contains any data.
84 purple_request_datasheet_add_column(PurpleRequestDatasheet
*sheet
,
85 PurpleRequestDatasheetColumnType type
, const gchar
*title
);
88 * purple_request_datasheet_get_column_count:
89 * @sheet: The datasheet.
91 * Returns the column count of datasheet.
93 * Returns: The column count.
96 purple_request_datasheet_get_column_count(PurpleRequestDatasheet
*sheet
);
99 * purple_request_datasheet_get_column_type:
100 * @sheet: The datasheet.
101 * @col_no: The column number (0 is the first one).
103 * Returns the column type for a datasheet.
105 * Returns: The column type.
107 PurpleRequestDatasheetColumnType
108 purple_request_datasheet_get_column_type(PurpleRequestDatasheet
*sheet
,
112 * purple_request_datasheet_get_column_title:
113 * @sheet: The datasheet.
114 * @col_no: The column number (0 is the first one).
116 * Returns the column title for a datasheet.
118 * Returns: The column title.
121 purple_request_datasheet_get_column_title(PurpleRequestDatasheet
*sheet
,
125 * purple_request_datasheet_get_records:
126 * @sheet: The datasheet.
128 * Returns the list of records in a datasheet.
130 * You shouldn't modify datasheet's data while iterating through it.
132 * Returns: (transfer none): The list of records.
135 purple_request_datasheet_get_records(PurpleRequestDatasheet
*sheet
);
138 * purple_request_datasheet_add_action:
139 * @sheet: The datasheet.
140 * @action: The action.
142 * Adds an action to the datasheet.
144 * Action object is owned by the datasheet since this call.
147 purple_request_datasheet_add_action(PurpleRequestDatasheet
*sheet
,
148 PurpleRequestDatasheetAction
*action
);
151 * purple_request_datasheet_get_actions:
152 * @sheet: The datasheet.
154 * Returns the list of actions in a datasheet.
156 * Returns: (transfer none): The list of actions.
159 purple_request_datasheet_get_actions(PurpleRequestDatasheet
*sheet
);
162 /**************************************************************************/
163 /* Datasheet actions API */
164 /**************************************************************************/
167 * purple_request_datasheet_action_new:
169 * Creates new datasheet action.
171 * Returns: The new action.
173 PurpleRequestDatasheetAction
*
174 purple_request_datasheet_action_new(void);
177 * purple_request_datasheet_action_free:
180 * Destroys the datasheet action.
183 purple_request_datasheet_action_free(PurpleRequestDatasheetAction
*act
);
186 * purple_request_datasheet_action_set_label:
190 * Sets the localized label for the action.
193 purple_request_datasheet_action_set_label(PurpleRequestDatasheetAction
*act
,
197 * purple_request_datasheet_action_get_label:
200 * Gets the label of action.
202 * Returns: The localized label text.
205 purple_request_datasheet_action_get_label(PurpleRequestDatasheetAction
*act
);
208 * purple_request_datasheet_action_set_cb:
210 * @cb: The callback function.
211 * @user_data: The data to be passed to the callback function.
213 * Sets the callback for the action.
216 purple_request_datasheet_action_set_cb(PurpleRequestDatasheetAction
*act
,
217 PurpleRequestDatasheetActionCb cb
, gpointer user_data
);
220 * purple_request_datasheet_action_call:
222 * @rec: The user selected record.
224 * Calls the callback of the action.
227 purple_request_datasheet_action_call(PurpleRequestDatasheetAction
*act
,
228 PurpleRequestDatasheetRecord
*rec
);
231 * purple_request_datasheet_action_set_sens_cb:
233 * @cb: The callback function, may be %NULL.
234 * @user_data: The data to be passed to the callback function.
236 * Sets the sensitivity checker for the action.
238 * If there is no callback set, default is used: the action is enabled, if any
242 purple_request_datasheet_action_set_sens_cb(
243 PurpleRequestDatasheetAction
*act
,
244 PurpleRequestDatasheetActionCheckCb cb
, gpointer user_data
);
247 * purple_request_datasheet_action_is_sensitive:
251 * Checks, if the action is enabled for the active record.
253 * Returns: %TRUE, if the action is enabled, %FALSE otherwise.
256 purple_request_datasheet_action_is_sensitive(PurpleRequestDatasheetAction
*act
,
257 PurpleRequestDatasheetRecord
*rec
);
260 /**************************************************************************/
261 /* Datasheet record API */
262 /**************************************************************************/
265 * purple_request_datasheet_record_get_key:
268 * Returns the key of a record.
273 purple_request_datasheet_record_get_key(
274 const PurpleRequestDatasheetRecord
*rec
);
277 * purple_request_datasheet_record_get_datasheet:
280 * Returns the datasheet of a record.
282 * Returns: The datasheet.
284 PurpleRequestDatasheet
*
285 purple_request_datasheet_record_get_datasheet(
286 PurpleRequestDatasheetRecord
*rec
);
289 * purple_request_datasheet_record_find:
290 * @sheet: The datasheet.
293 * Looks up for a record in datasheet.
295 * Returns: The record if found, %NULL otherwise.
297 PurpleRequestDatasheetRecord
*
298 purple_request_datasheet_record_find(PurpleRequestDatasheet
*sheet
,
302 * purple_request_datasheet_record_add:
303 * @sheet: The datasheet.
306 * Adds a record to the datasheet.
308 * If the specified key already exists in datasheet, old record is returned.
310 * Returns: The record.
312 PurpleRequestDatasheetRecord
*
313 purple_request_datasheet_record_add(PurpleRequestDatasheet
*sheet
,
317 * purple_request_datasheet_record_remove:
318 * @sheet: The datasheet.
321 * Removes a record from a datasheet.
324 purple_request_datasheet_record_remove(PurpleRequestDatasheet
*sheet
,
328 * purple_request_datasheet_record_remove_all:
329 * @sheet: The datasheet.
331 * Removes all records from a datasheet.
334 purple_request_datasheet_record_remove_all(PurpleRequestDatasheet
*sheet
);
337 * purple_request_datasheet_record_mark_all_for_rem:
338 * @sheet: The datasheet.
340 * Marks all records for removal. Record will be unmarked, when touched with
341 * purple_request_datasheet_record_add.
343 * See purple_request_datasheet_record_add().
346 purple_request_datasheet_record_mark_all_for_rem(PurpleRequestDatasheet
*sheet
);
349 * purple_request_datasheet_record_remove_marked:
350 * @sheet: The datasheet.
352 * Removes all marked records.
354 * See purple_request_datasheet_record_mark_all_for_rem().
357 purple_request_datasheet_record_remove_marked(PurpleRequestDatasheet
*sheet
);
360 * purple_request_datasheet_record_set_string_data:
362 * @col_no: The column.
365 * Sets data for a string column of specified record.
368 purple_request_datasheet_record_set_string_data(
369 PurpleRequestDatasheetRecord
*rec
, guint col_no
, const gchar
*data
);
372 * purple_request_datasheet_record_set_image_data:
374 * @col_no: The column.
375 * @stock_id: The stock identifier of a image.
377 * Sets data for a image column of specified record.
380 purple_request_datasheet_record_set_image_data(
381 PurpleRequestDatasheetRecord
*rec
, guint col_no
, const gchar
*stock_id
);
384 * purple_request_datasheet_record_get_string_data:
386 * @col_no: The column.
388 * Returns data for a string column of specified record.
393 purple_request_datasheet_record_get_string_data(
394 const PurpleRequestDatasheetRecord
*rec
, guint col_no
);
397 * purple_request_datasheet_record_get_image_data:
399 * @col_no: The column.
401 * Returns data for an image column of specified record.
403 * Returns: The stock id of an image.
406 purple_request_datasheet_record_get_image_data(
407 const PurpleRequestDatasheetRecord
*rec
, guint col_no
);
411 #endif /* _PURPLE_REQUEST_DATA_H_ */