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
);
43 * PurpleRequestDatasheetColumnType:
44 * @PURPLE_REQUEST_DATASHEET_COLUMN_STRING: The column displays strings.
45 * @PURPLE_REQUEST_DATASHEET_COLUMN_IMAGE: The column displays images.
47 * The type of data to be shown in a column.
52 PURPLE_REQUEST_DATASHEET_COLUMN_STRING
,
53 PURPLE_REQUEST_DATASHEET_COLUMN_IMAGE
54 } PurpleRequestDatasheetColumnType
;
58 /**************************************************************************/
60 /**************************************************************************/
63 * purple_request_datasheet_new:
65 * Creates new Datasheet.
67 * Returns: The new datasheet.
69 PurpleRequestDatasheet
*
70 purple_request_datasheet_new(void);
73 * purple_request_datasheet_free:
74 * @sheet: The datasheet.
76 * Destroys datasheet with all its contents.
79 purple_request_datasheet_free(PurpleRequestDatasheet
*sheet
);
82 * purple_request_datasheet_add_column:
83 * @sheet: The datasheet.
84 * @type: The column type.
85 * @title: The column title (may be %NULL).
87 * Adds a column to the datasheet.
89 * You cannot add a column if datasheet contains any data.
92 purple_request_datasheet_add_column(PurpleRequestDatasheet
*sheet
,
93 PurpleRequestDatasheetColumnType type
, const gchar
*title
);
96 * purple_request_datasheet_get_column_count:
97 * @sheet: The datasheet.
99 * Returns the column count of datasheet.
101 * Returns: The column count.
104 purple_request_datasheet_get_column_count(PurpleRequestDatasheet
*sheet
);
107 * purple_request_datasheet_get_column_type:
108 * @sheet: The datasheet.
109 * @col_no: The column number (0 is the first one).
111 * Returns the column type for a datasheet.
113 * Returns: The column type.
115 PurpleRequestDatasheetColumnType
116 purple_request_datasheet_get_column_type(PurpleRequestDatasheet
*sheet
,
120 * purple_request_datasheet_get_column_title:
121 * @sheet: The datasheet.
122 * @col_no: The column number (0 is the first one).
124 * Returns the column title for a datasheet.
126 * Returns: The column title.
129 purple_request_datasheet_get_column_title(PurpleRequestDatasheet
*sheet
,
133 * purple_request_datasheet_get_records:
134 * @sheet: The datasheet.
136 * Returns the list of records in a datasheet.
138 * You shouldn't modify datasheet's data while iterating through it.
140 * Returns: (element-type PurpleRequestDatasheetRecord) (transfer none): The list of records.
143 purple_request_datasheet_get_records(PurpleRequestDatasheet
*sheet
);
146 * purple_request_datasheet_add_action:
147 * @sheet: The datasheet.
148 * @action: The action.
150 * Adds an action to the datasheet.
152 * Action object is owned by the datasheet since this call.
155 purple_request_datasheet_add_action(PurpleRequestDatasheet
*sheet
,
156 PurpleRequestDatasheetAction
*action
);
159 * purple_request_datasheet_get_actions:
160 * @sheet: The datasheet.
162 * Returns the list of actions in a datasheet.
164 * Returns: (element-type PurpleRequestDatasheetAction) (transfer none): The list of actions.
167 purple_request_datasheet_get_actions(PurpleRequestDatasheet
*sheet
);
170 /**************************************************************************/
171 /* Datasheet actions API */
172 /**************************************************************************/
175 * purple_request_datasheet_action_new:
177 * Creates new datasheet action.
179 * Returns: The new action.
181 PurpleRequestDatasheetAction
*
182 purple_request_datasheet_action_new(void);
185 * purple_request_datasheet_action_free:
188 * Destroys the datasheet action.
191 purple_request_datasheet_action_free(PurpleRequestDatasheetAction
*act
);
194 * purple_request_datasheet_action_set_label:
198 * Sets the localized label for the action.
201 purple_request_datasheet_action_set_label(PurpleRequestDatasheetAction
*act
,
205 * purple_request_datasheet_action_get_label:
208 * Gets the label of action.
210 * Returns: The localized label text.
213 purple_request_datasheet_action_get_label(PurpleRequestDatasheetAction
*act
);
216 * purple_request_datasheet_action_set_cb:
218 * @cb: The callback function.
219 * @user_data: The data to be passed to the callback function.
221 * Sets the callback for the action.
224 purple_request_datasheet_action_set_cb(PurpleRequestDatasheetAction
*act
,
225 PurpleRequestDatasheetActionCb cb
, gpointer user_data
);
228 * purple_request_datasheet_action_call:
230 * @rec: The user selected record.
232 * Calls the callback of the action.
235 purple_request_datasheet_action_call(PurpleRequestDatasheetAction
*act
,
236 PurpleRequestDatasheetRecord
*rec
);
239 * purple_request_datasheet_action_set_sens_cb:
241 * @cb: The callback function, may be %NULL.
242 * @user_data: The data to be passed to the callback function.
244 * Sets the sensitivity checker for the action.
246 * If there is no callback set, default is used: the action is enabled, if any
250 purple_request_datasheet_action_set_sens_cb(
251 PurpleRequestDatasheetAction
*act
,
252 PurpleRequestDatasheetActionCheckCb cb
, gpointer user_data
);
255 * purple_request_datasheet_action_is_sensitive:
259 * Checks, if the action is enabled for the active record.
261 * Returns: %TRUE, if the action is enabled, %FALSE otherwise.
264 purple_request_datasheet_action_is_sensitive(PurpleRequestDatasheetAction
*act
,
265 PurpleRequestDatasheetRecord
*rec
);
268 /**************************************************************************/
269 /* Datasheet record API */
270 /**************************************************************************/
273 * purple_request_datasheet_record_get_key:
276 * Returns the key of a record.
281 purple_request_datasheet_record_get_key(
282 const PurpleRequestDatasheetRecord
*rec
);
285 * purple_request_datasheet_record_get_datasheet:
288 * Returns the datasheet of a record.
290 * Returns: The datasheet.
292 PurpleRequestDatasheet
*
293 purple_request_datasheet_record_get_datasheet(
294 PurpleRequestDatasheetRecord
*rec
);
297 * purple_request_datasheet_record_find:
298 * @sheet: The datasheet.
301 * Looks up for a record in datasheet.
303 * Returns: The record if found, %NULL otherwise.
305 PurpleRequestDatasheetRecord
*
306 purple_request_datasheet_record_find(PurpleRequestDatasheet
*sheet
,
310 * purple_request_datasheet_record_add:
311 * @sheet: The datasheet.
314 * Adds a record to the datasheet.
316 * If the specified key already exists in datasheet, old record is returned.
318 * Returns: The record.
320 PurpleRequestDatasheetRecord
*
321 purple_request_datasheet_record_add(PurpleRequestDatasheet
*sheet
,
325 * purple_request_datasheet_record_remove:
326 * @sheet: The datasheet.
329 * Removes a record from a datasheet.
332 purple_request_datasheet_record_remove(PurpleRequestDatasheet
*sheet
,
336 * purple_request_datasheet_record_remove_all:
337 * @sheet: The datasheet.
339 * Removes all records from a datasheet.
342 purple_request_datasheet_record_remove_all(PurpleRequestDatasheet
*sheet
);
345 * purple_request_datasheet_record_mark_all_for_rem:
346 * @sheet: The datasheet.
348 * Marks all records for removal. Record will be unmarked, when touched with
349 * purple_request_datasheet_record_add.
351 * See purple_request_datasheet_record_add().
354 purple_request_datasheet_record_mark_all_for_rem(PurpleRequestDatasheet
*sheet
);
357 * purple_request_datasheet_record_remove_marked:
358 * @sheet: The datasheet.
360 * Removes all marked records.
362 * See purple_request_datasheet_record_mark_all_for_rem().
365 purple_request_datasheet_record_remove_marked(PurpleRequestDatasheet
*sheet
);
368 * purple_request_datasheet_record_set_string_data:
370 * @col_no: The column.
373 * Sets data for a string column of specified record.
376 purple_request_datasheet_record_set_string_data(
377 PurpleRequestDatasheetRecord
*rec
, guint col_no
, const gchar
*data
);
380 * purple_request_datasheet_record_set_image_data:
382 * @col_no: The column.
383 * @stock_id: The stock identifier of a image.
385 * Sets data for a image column of specified record.
388 purple_request_datasheet_record_set_image_data(
389 PurpleRequestDatasheetRecord
*rec
, guint col_no
, const gchar
*stock_id
);
392 * purple_request_datasheet_record_get_string_data:
394 * @col_no: The column.
396 * Returns data for a string column of specified record.
401 purple_request_datasheet_record_get_string_data(
402 const PurpleRequestDatasheetRecord
*rec
, guint col_no
);
405 * purple_request_datasheet_record_get_image_data:
407 * @col_no: The column.
409 * Returns data for an image column of specified record.
411 * Returns: The stock id of an image.
414 purple_request_datasheet_record_get_image_data(
415 const PurpleRequestDatasheetRecord
*rec
, guint col_no
);
419 #endif /* PURPLE_REQUEST_DATA_H */