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_H_
23 #define _PURPLE_REQUEST_H_
26 * @section_id: libpurple-request
27 * @short_description: <filename>request.h</filename>
33 #include <glib-object.h>
36 #include "conversation.h"
37 #include "request-datasheet.h"
39 #define PURPLE_TYPE_REQUEST_UI_OPS (purple_request_ui_ops_get_type())
46 typedef struct _PurpleRequestField PurpleRequestField
;
49 * PurpleRequestFields:
51 * Multiple fields request data.
53 typedef struct _PurpleRequestFields PurpleRequestFields
;
56 * PurpleRequestFieldGroup:
58 * A group of fields with a title.
60 typedef struct _PurpleRequestFieldGroup PurpleRequestFieldGroup
;
63 * PurpleRequestCommonParameters:
65 * Common parameters for UI operations.
67 typedef struct _PurpleRequestCommonParameters PurpleRequestCommonParameters
;
69 typedef struct _PurpleRequestUiOps PurpleRequestUiOps
;
73 #define PURPLE_DEFAULT_ACTION_NONE -1
77 * @PURPLE_REQUEST_INPUT: Text input request.
78 * @PURPLE_REQUEST_CHOICE: Multiple-choice request.
79 * @PURPLE_REQUEST_ACTION: Action request.
80 * @PURPLE_REQUEST_WAIT: Please wait dialog.
81 * @PURPLE_REQUEST_FIELDS: Multiple fields request.
82 * @PURPLE_REQUEST_FILE: File open or save request.
83 * @PURPLE_REQUEST_FOLDER: Folder selection request.
89 PURPLE_REQUEST_INPUT
= 0,
90 PURPLE_REQUEST_CHOICE
,
91 PURPLE_REQUEST_ACTION
,
93 PURPLE_REQUEST_FIELDS
,
100 * PurpleRequestFieldType:
106 PURPLE_REQUEST_FIELD_NONE
,
107 PURPLE_REQUEST_FIELD_STRING
,
108 PURPLE_REQUEST_FIELD_INTEGER
,
109 PURPLE_REQUEST_FIELD_BOOLEAN
,
110 PURPLE_REQUEST_FIELD_CHOICE
,
111 PURPLE_REQUEST_FIELD_LIST
,
112 PURPLE_REQUEST_FIELD_LABEL
,
113 PURPLE_REQUEST_FIELD_IMAGE
,
114 PURPLE_REQUEST_FIELD_ACCOUNT
,
115 PURPLE_REQUEST_FIELD_CERTIFICATE
,
116 PURPLE_REQUEST_FIELD_DATASHEET
118 } PurpleRequestFieldType
;
122 PURPLE_REQUEST_FEATURE_HTML
= 0x00000001
123 } PurpleRequestFeature
;
127 PURPLE_REQUEST_ICON_DEFAULT
= 0,
128 PURPLE_REQUEST_ICON_REQUEST
,
129 PURPLE_REQUEST_ICON_DIALOG
,
130 PURPLE_REQUEST_ICON_WAIT
,
131 PURPLE_REQUEST_ICON_INFO
,
132 PURPLE_REQUEST_ICON_WARNING
,
133 PURPLE_REQUEST_ICON_ERROR
134 } PurpleRequestIconType
;
136 typedef void (*PurpleRequestCancelCb
)(gpointer
);
139 * PurpleRequestUiOps:
140 * @request_input: See purple_request_input().
141 * @request_choice: See purple_request_choice_varg().
142 * @request_action: See purple_request_action_varg().
143 * @request_wait: See purple_request_wait().
144 * @request_wait_update: See purple_request_wait_pulse(),
145 * purple_request_wait_progress().
146 * @request_fields: See purple_request_fields().
147 * @request_file: See purple_request_file().
148 * @request_folder: See purple_request_folder().
150 * Request UI operations.
152 struct _PurpleRequestUiOps
154 PurpleRequestFeature features
;
156 void *(*request_input
)(const char *title
, const char *primary
,
157 const char *secondary
, const char *default_value
,
158 gboolean multiline
, gboolean masked
, gchar
*hint
,
159 const char *ok_text
, GCallback ok_cb
,
160 const char *cancel_text
, GCallback cancel_cb
,
161 PurpleRequestCommonParameters
*cpar
, void *user_data
);
163 void *(*request_choice
)(const char *title
, const char *primary
,
164 const char *secondary
, gpointer default_value
,
165 const char *ok_text
, GCallback ok_cb
, const char *cancel_text
,
166 GCallback cancel_cb
, PurpleRequestCommonParameters
*cpar
,
167 void *user_data
, va_list choices
);
169 void *(*request_action
)(const char *title
, const char *primary
,
170 const char *secondary
, int default_action
,
171 PurpleRequestCommonParameters
*cpar
, void *user_data
,
172 size_t action_count
, va_list actions
);
174 void *(*request_wait
)(const char *title
, const char *primary
,
175 const char *secondary
, gboolean with_progress
,
176 PurpleRequestCancelCb cancel_cb
,
177 PurpleRequestCommonParameters
*cpar
, void *user_data
);
179 void (*request_wait_update
)(void *ui_handle
, gboolean pulse
,
182 void *(*request_fields
)(const char *title
, const char *primary
,
183 const char *secondary
, PurpleRequestFields
*fields
,
184 const char *ok_text
, GCallback ok_cb
,
185 const char *cancel_text
, GCallback cancel_cb
,
186 PurpleRequestCommonParameters
*cpar
, void *user_data
);
188 void *(*request_file
)(const char *title
, const char *filename
,
189 gboolean savedialog
, GCallback ok_cb
, GCallback cancel_cb
,
190 PurpleRequestCommonParameters
*cpar
, void *user_data
);
192 void *(*request_folder
)(const char *title
, const char *dirname
,
193 GCallback ok_cb
, GCallback cancel_cb
,
194 PurpleRequestCommonParameters
*cpar
, void *user_data
);
196 void (*close_request
)(PurpleRequestType type
, void *ui_handle
);
199 void (*_purple_reserved1
)(void);
200 void (*_purple_reserved2
)(void);
201 void (*_purple_reserved3
)(void);
202 void (*_purple_reserved4
)(void);
205 typedef void (*PurpleRequestInputCb
)(void *, const char *);
207 typedef gboolean (*PurpleRequestFieldValidator
)(PurpleRequestField
*field
,
208 gchar
**errmsg
, gpointer user_data
);
210 typedef gboolean (*PurpleRequestFieldSensitivityCb
)(PurpleRequestField
*field
);
213 * PurpleRequestActionCb:
215 * The type of callbacks passed to purple_request_action(). The first
216 * argument is the <literal>user_data</literal> parameter; the second is the
217 * index in the list of actions of the one chosen.
219 typedef void (*PurpleRequestActionCb
)(void *, int);
221 typedef void (*PurpleRequestChoiceCb
)(void *, gpointer
);
222 typedef void (*PurpleRequestFieldsCb
)(void *, PurpleRequestFields
*fields
);
223 typedef void (*PurpleRequestFileCb
)(void *, const char *filename
);
224 typedef void (*PurpleRequestHelpCb
)(gpointer
);
228 /**************************************************************************/
229 /* Common parameters API */
230 /**************************************************************************/
233 * purple_request_cpar_new:
235 * Creates new parameters set for the request, which may or may not be used by
236 * the UI to display the request.
238 * Returns: The new parameters set.
240 PurpleRequestCommonParameters
*
241 purple_request_cpar_new(void);
244 * purple_request_cpar_from_connection:
246 * Creates new parameters set initially bound with the #PurpleConnection.
248 * Returns: The new parameters set.
250 PurpleRequestCommonParameters
*
251 purple_request_cpar_from_connection(PurpleConnection
*gc
);
254 * purple_request_cpar_from_account:
256 * Creates new parameters set initially bound with the #PurpleAccount.
258 * Returns: The new parameters set.
260 PurpleRequestCommonParameters
*
261 purple_request_cpar_from_account(PurpleAccount
*account
);
264 * purple_request_cpar_from_conversation:
266 * Creates new parameters set initially bound with the #PurpleConversation.
268 * Returns: The new parameters set.
270 PurpleRequestCommonParameters
*
271 purple_request_cpar_from_conversation(PurpleConversation
*conv
);
274 * purple_request_cpar_ref:
275 * @cpar: The object to ref.
277 * Increases the reference count on the parameters set.
280 purple_request_cpar_ref(PurpleRequestCommonParameters
*cpar
);
283 * purple_request_cpar_unref:
284 * @cpar: The parameters set object to unref and possibly destroy.
286 * Decreases the reference count on the parameters set.
288 * The object will be destroyed when this reaches 0.
290 * Returns: The NULL, if object was destroyed, cpar otherwise.
292 PurpleRequestCommonParameters
*
293 purple_request_cpar_unref(PurpleRequestCommonParameters
*cpar
);
296 * purple_request_cpar_set_account:
297 * @cpar: The parameters set.
298 * @account: The #PurpleAccount to associate.
300 * Sets the #PurpleAccount associated with the request, or %NULL, if none is.
303 purple_request_cpar_set_account(PurpleRequestCommonParameters
*cpar
,
304 PurpleAccount
*account
);
307 * purple_request_cpar_get_account:
308 * @cpar: The parameters set (may be %NULL).
310 * Gets the #PurpleAccount associated with the request.
312 * Returns: The associated #PurpleAccount, or NULL if none is.
315 purple_request_cpar_get_account(PurpleRequestCommonParameters
*cpar
);
318 * purple_request_cpar_set_conversation:
319 * @cpar: The parameters set.
320 * @conv: The #PurpleConversation to associate.
322 * Sets the #PurpleConversation associated with the request, or %NULL, if
326 purple_request_cpar_set_conversation(PurpleRequestCommonParameters
*cpar
,
327 PurpleConversation
*conv
);
330 * purple_request_cpar_get_conversation:
331 * @cpar: The parameters set (may be %NULL).
333 * Gets the #PurpleConversation associated with the request.
335 * Returns: The associated #PurpleConversation, or NULL if none is.
338 purple_request_cpar_get_conversation(PurpleRequestCommonParameters
*cpar
);
341 * purple_request_cpar_set_icon:
342 * @cpar: The parameters set.
343 * @icon_type: The icon type.
345 * Sets the icon associated with the request.
348 purple_request_cpar_set_icon(PurpleRequestCommonParameters
*cpar
,
349 PurpleRequestIconType icon_type
);
352 * purple_request_cpar_get_icon:
353 * @cpar: The parameters set.
355 * Gets the icon associated with the request.
357 * Returns: icon_type The icon type.
359 PurpleRequestIconType
360 purple_request_cpar_get_icon(PurpleRequestCommonParameters
*cpar
);
363 * purple_request_cpar_set_custom_icon:
364 * @cpar: The parameters set.
365 * @icon_data: The icon image contents (%NULL to reset).
366 * @icon_size: The icon image size.
368 * Sets the custom icon associated with the request.
371 purple_request_cpar_set_custom_icon(PurpleRequestCommonParameters
*cpar
,
372 gconstpointer icon_data
, gsize icon_size
);
375 * purple_request_cpar_get_custom_icon:
376 * @cpar: The parameters set (may be %NULL).
377 * @icon_size: The pointer to variable, where icon size should be stored
380 * Gets the custom icon associated with the request.
382 * Returns: The icon image contents.
385 purple_request_cpar_get_custom_icon(PurpleRequestCommonParameters
*cpar
,
389 * purple_request_cpar_set_html:
390 * @cpar: The parameters set.
391 * @enabled: 1, if the text passed with the request contains HTML,
392 * 0 otherwise. Don't use any other values, as they may be
393 * redefined in the future.
395 * Switches the request text to be HTML or not.
398 purple_request_cpar_set_html(PurpleRequestCommonParameters
*cpar
,
402 * purple_request_cpar_is_html:
403 * @cpar: The parameters set (may be %NULL).
405 * Checks, if the text passed to the request is HTML.
407 * Returns: %TRUE, if the text is HTML, %FALSE otherwise.
410 purple_request_cpar_is_html(PurpleRequestCommonParameters
*cpar
);
413 * purple_request_cpar_set_compact:
414 * @cpar: The parameters set.
415 * @compact: TRUE for compact, FALSE otherwise.
417 * Sets dialog display mode to compact or default.
420 purple_request_cpar_set_compact(PurpleRequestCommonParameters
*cpar
,
424 * purple_request_cpar_is_compact:
425 * @cpar: The parameters set (may be %NULL).
427 * Gets dialog display mode.
429 * Returns: TRUE for compact, FALSE for default.
432 purple_request_cpar_is_compact(PurpleRequestCommonParameters
*cpar
);
435 * purple_request_cpar_set_help_cb:
436 * @cpar: The parameters set.
438 * @user_data: The data to be passed to the callback.
440 * Sets the callback for the Help button.
443 purple_request_cpar_set_help_cb(PurpleRequestCommonParameters
*cpar
,
444 PurpleRequestHelpCb cb
, gpointer user_data
);
447 * purple_request_cpar_get_help_cb:
448 * @cpar: The parameters set (may be %NULL).
449 * @user_data: The pointer to the variable, where user data (to be passed
450 * to callback function) should be stored.
452 * Gets the callback for the Help button.
454 * Returns: The callback.
457 purple_request_cpar_get_help_cb(PurpleRequestCommonParameters
*cpar
,
458 gpointer
*user_data
);
461 * purple_request_cpar_set_extra_actions:
462 * @cpar: The parameters set.
463 * @...: A list of actions. These are pairs of arguments. The first of
464 * each pair is the <type>char *</type> label that appears on the
465 * button. It should have an underscore before the letter you want
466 * to use as the accelerator key for the button. The second of each
467 * pair is the #PurpleRequestFieldsCb function to use when the
468 * button is clicked. Should be terminated with the NULL label.
470 * Sets extra actions for the PurpleRequestFields dialog.
473 purple_request_cpar_set_extra_actions(PurpleRequestCommonParameters
*cpar
, ...);
476 * purple_request_cpar_get_extra_actions:
477 * @cpar: The parameters set (may be %NULL).
479 * Gets extra actions for the PurpleRequestFields dialog.
481 * Returns: A list of actions (pairs of arguments, as in setter).
484 purple_request_cpar_get_extra_actions(PurpleRequestCommonParameters
*cpar
);
487 * purple_request_cpar_set_parent_from:
488 * @cpar: The parameters set.
489 * @ui_handle: The UI handle.
491 * Sets the same parent window for this dialog, as the parent of specified
492 * Notify API or Request API dialog UI handle.
495 purple_request_cpar_set_parent_from(PurpleRequestCommonParameters
*cpar
,
499 * purple_request_cpar_get_parent_from:
500 * @cpar: The parameters set (may be %NULL).
502 * Gets the parent "donor" for this dialog.
504 * Returns: The donors UI handle.
507 purple_request_cpar_get_parent_from(PurpleRequestCommonParameters
*cpar
);
509 /**************************************************************************/
511 /**************************************************************************/
514 * purple_request_fields_new:
516 * Creates a list of fields to pass to purple_request_fields().
518 * Returns: A PurpleRequestFields structure.
520 PurpleRequestFields
*purple_request_fields_new(void);
523 * purple_request_fields_destroy:
524 * @fields: The list of fields to destroy.
526 * Destroys a list of fields.
528 void purple_request_fields_destroy(PurpleRequestFields
*fields
);
531 * purple_request_fields_add_group:
532 * @fields: The fields list.
533 * @group: The group to add.
535 * Adds a group of fields to the list.
537 void purple_request_fields_add_group(PurpleRequestFields
*fields
,
538 PurpleRequestFieldGroup
*group
);
541 * purple_request_fields_get_groups:
542 * @fields: The fields list.
544 * Returns a list of all groups in a field list.
546 * Returns: (transfer none): A list of groups.
548 GList
*purple_request_fields_get_groups(const PurpleRequestFields
*fields
);
551 * purple_request_fields_set_tab_names:
552 * @fields: The fields list.
553 * @tab_names: NULL-terminated array of localized tab labels,
556 * Set tab names for a field list.
558 void purple_request_fields_set_tab_names(PurpleRequestFields
*fields
,
559 const gchar
**tab_names
);
562 * purple_request_fields_get_tab_names:
563 * @fields: The fields list.
565 * Returns tab names of a field list.
567 * Returns: NULL-terminated array of localized tab labels, or NULL if tabs
571 purple_request_fields_get_tab_names(const PurpleRequestFields
*fields
);
574 * purple_request_fields_exists:
575 * @fields: The fields list.
576 * @id: The ID of the field.
578 * Returns whether or not the field with the specified ID exists.
580 * Returns: TRUE if the field exists, or FALSE.
582 gboolean
purple_request_fields_exists(const PurpleRequestFields
*fields
,
586 * purple_request_fields_get_required:
587 * @fields: The fields list.
589 * Returns a list of all required fields.
591 * Returns: (transfer none): The list of required fields.
593 const GList
*purple_request_fields_get_required(
594 const PurpleRequestFields
*fields
);
597 * purple_request_fields_get_validatable:
598 * @fields: The fields list.
600 * Returns a list of all validated fields.
602 * Returns: (transfer none): The list of validated fields.
604 const GList
*purple_request_fields_get_validatable(
605 const PurpleRequestFields
*fields
);
608 * purple_request_fields_get_autosensitive:
609 * @fields: The fields list.
611 * Returns a list of all fields with sensitivity callback added.
613 * Returns: (transfer none): The list of fields with automatic sensitivity
617 purple_request_fields_get_autosensitive(const PurpleRequestFields
*fields
);
620 * purple_request_fields_is_field_required:
621 * @fields: The fields list.
624 * Returns whether or not a field with the specified ID is required.
626 * Returns: TRUE if the specified field is required, or FALSE.
628 gboolean
purple_request_fields_is_field_required(const PurpleRequestFields
*fields
,
632 * purple_request_fields_all_required_filled:
633 * @fields: The fields list.
635 * Returns whether or not all required fields have values.
637 * Returns: TRUE if all required fields have values, or FALSE.
639 gboolean
purple_request_fields_all_required_filled(
640 const PurpleRequestFields
*fields
);
643 * purple_request_fields_all_valid:
644 * @fields: The fields list.
646 * Returns whether or not all fields are valid.
648 * Returns: TRUE if all fields are valid, or FALSE.
650 gboolean
purple_request_fields_all_valid(const PurpleRequestFields
*fields
);
653 * purple_request_fields_get_field:
654 * @fields: The fields list.
655 * @id: The ID of the field.
657 * Return the field with the specified ID.
659 * Returns: The field, if found.
661 PurpleRequestField
*purple_request_fields_get_field(
662 const PurpleRequestFields
*fields
, const char *id
);
665 * purple_request_fields_get_string:
666 * @fields: The fields list.
667 * @id: The ID of the field.
669 * Returns the string value of a field with the specified ID.
671 * Returns: The string value, if found, or %NULL otherwise.
673 const char *purple_request_fields_get_string(const PurpleRequestFields
*fields
,
677 * purple_request_fields_get_integer:
678 * @fields: The fields list.
679 * @id: The ID of the field.
681 * Returns the integer value of a field with the specified ID.
683 * Returns: The integer value, if found, or 0 otherwise.
685 int purple_request_fields_get_integer(const PurpleRequestFields
*fields
,
689 * purple_request_fields_get_bool:
690 * @fields: The fields list.
691 * @id: The ID of the field.
693 * Returns the boolean value of a field with the specified ID.
695 * Returns: The boolean value, if found, or %FALSE otherwise.
697 gboolean
purple_request_fields_get_bool(const PurpleRequestFields
*fields
,
701 * purple_request_fields_get_choice:
702 * @fields: The fields list.
703 * @id: The ID of the field.
705 * Returns the choice index of a field with the specified ID.
707 * Returns: The choice value, if found, or NULL otherwise.
710 purple_request_fields_get_choice(const PurpleRequestFields
*fields
,
714 * purple_request_fields_get_account:
715 * @fields: The fields list.
716 * @id: The ID of the field.
718 * Returns the account of a field with the specified ID.
720 * Returns: The account value, if found, or NULL otherwise.
722 PurpleAccount
*purple_request_fields_get_account(const PurpleRequestFields
*fields
,
726 * purple_request_fields_get_ui_data:
727 * @fields: The fields list.
729 * Returns the UI data associated with this object.
731 * Returns: The UI data associated with this object. This is a
732 * convenience field provided to the UIs--it is not
733 * used by the libpurple core.
735 gpointer
purple_request_fields_get_ui_data(const PurpleRequestFields
*fields
);
738 * purple_request_fields_set_ui_data:
739 * @fields: The fields list.
740 * @ui_data: A pointer to associate with this object.
742 * Set the UI data associated with this object.
744 void purple_request_fields_set_ui_data(PurpleRequestFields
*fields
, gpointer ui_data
);
746 /**************************************************************************/
747 /* Fields Group API */
748 /**************************************************************************/
751 * purple_request_field_group_new:
752 * @title: The optional title to give the group.
754 * Creates a fields group with an optional title.
756 * Returns: A new fields group
758 PurpleRequestFieldGroup
*purple_request_field_group_new(const char *title
);
761 * purple_request_field_group_set_tab:
763 * @tab_no: The tab number.
765 * Sets tab number for a group.
767 * See purple_request_fields_set_tab_names().
769 void purple_request_field_group_set_tab(PurpleRequestFieldGroup
*group
,
773 * purple_request_field_group_get_tab:
776 * Returns tab number of a group.
778 * See purple_request_fields_get_tab_names().
780 * Returns: Tab number.
782 guint
purple_request_field_group_get_tab(const PurpleRequestFieldGroup
*group
);
785 * purple_request_field_group_destroy:
786 * @group: The group to destroy.
788 * Destroys a fields group.
790 void purple_request_field_group_destroy(PurpleRequestFieldGroup
*group
);
793 * purple_request_field_group_add_field:
794 * @group: The group to add the field to.
795 * @field: The field to add to the group.
797 * Adds a field to the group.
799 void purple_request_field_group_add_field(PurpleRequestFieldGroup
*group
,
800 PurpleRequestField
*field
);
803 * purple_request_field_group_get_title:
806 * Returns the title of a fields group.
808 * Returns: The title, if set.
810 const char *purple_request_field_group_get_title(
811 const PurpleRequestFieldGroup
*group
);
814 * purple_request_field_group_get_fields:
817 * Returns a list of all fields in a group.
819 * Returns: (transfer none): The list of fields in the group.
821 GList
*purple_request_field_group_get_fields(
822 const PurpleRequestFieldGroup
*group
);
825 * purple_request_field_group_get_fields_list:
828 * Returns a list of all fields in a group.
830 * Returns: (transfer none): The list of fields in the group.
832 PurpleRequestFields
*purple_request_field_group_get_fields_list(
833 const PurpleRequestFieldGroup
*group
);
835 /**************************************************************************/
837 /**************************************************************************/
840 * purple_request_field_new:
842 * @text: The text label of the field.
843 * @type: The type of field.
845 * Creates a field of the specified type.
847 * Returns: The new field.
849 PurpleRequestField
*purple_request_field_new(const char *id
, const char *text
,
850 PurpleRequestFieldType type
);
853 * purple_request_field_destroy:
854 * @field: The field to destroy.
858 void purple_request_field_destroy(PurpleRequestField
*field
);
861 * purple_request_field_set_label:
863 * @label: The text label.
865 * Sets the label text of a field.
867 void purple_request_field_set_label(PurpleRequestField
*field
, const char *label
);
870 * purple_request_field_set_visible:
872 * @visible: TRUE if visible, or FALSE if not.
874 * Sets whether or not a field is visible.
876 void purple_request_field_set_visible(PurpleRequestField
*field
, gboolean visible
);
879 * purple_request_field_set_type_hint:
881 * @type_hint: The type hint.
883 * Sets the type hint for the field.
885 * This is optionally used by the UIs to provide such features as
886 * auto-completion for type hints like "account" and "screenname".
888 void purple_request_field_set_type_hint(PurpleRequestField
*field
,
889 const char *type_hint
);
892 * purple_request_field_set_tooltip:
894 * @tooltip: The tooltip text.
896 * Sets the tooltip for the field.
898 * This is optionally used by the UIs to provide a tooltip for
901 void purple_request_field_set_tooltip(PurpleRequestField
*field
,
902 const char *tooltip
);
905 * purple_request_field_set_required:
907 * @required: TRUE if required, or FALSE.
909 * Sets whether or not a field is required.
911 void purple_request_field_set_required(PurpleRequestField
*field
,
915 * purple_request_field_get_field_type:
918 * Returns the type of a field.
920 * Returns: The field's type.
922 PurpleRequestFieldType
purple_request_field_get_field_type(const PurpleRequestField
*field
);
925 * purple_request_field_get_group:
928 * Returns the group for the field.
930 * Returns: The UI data.
932 PurpleRequestFieldGroup
*purple_request_field_get_group(const PurpleRequestField
*field
);
935 * purple_request_field_get_id:
938 * Returns the ID of a field.
942 const char *purple_request_field_get_id(const PurpleRequestField
*field
);
945 * purple_request_field_get_label:
948 * Returns the label text of a field.
950 * Returns: The label text.
952 const char *purple_request_field_get_label(const PurpleRequestField
*field
);
955 * purple_request_field_is_visible:
958 * Returns whether or not a field is visible.
960 * Returns: TRUE if the field is visible. FALSE otherwise.
962 gboolean
purple_request_field_is_visible(const PurpleRequestField
*field
);
965 * purple_request_field_get_type_hint:
968 * Returns the field's type hint.
970 * Returns: The field's type hint.
972 const char *purple_request_field_get_field_type_hint(const PurpleRequestField
*field
);
975 * purple_request_field_get_tooltip:
978 * Returns the field's tooltip.
980 * Returns: The field's tooltip.
982 const char *purple_request_field_get_tooltip(const PurpleRequestField
*field
);
985 * purple_request_field_is_required:
988 * Returns whether or not a field is required.
990 * Returns: TRUE if the field is required, or FALSE.
992 gboolean
purple_request_field_is_required(const PurpleRequestField
*field
);
995 * purple_request_field_is_filled:
998 * Checks, if specified field has value.
1000 * Returns: TRUE if the field has value, or FALSE.
1002 gboolean
purple_request_field_is_filled(const PurpleRequestField
*field
);
1005 * purple_request_field_set_validator:
1006 * @field: The field.
1007 * @validator: The validator callback, NULL to disable validation.
1008 * @user_data: The data to pass to the callback.
1010 * Sets validator for a single field.
1012 void purple_request_field_set_validator(PurpleRequestField
*field
,
1013 PurpleRequestFieldValidator validator
, void *user_data
);
1016 * purple_request_field_is_validatable:
1017 * @field: The field.
1019 * Returns whether or not field has validator set.
1021 * Returns: TRUE if the field has validator, or FALSE.
1023 gboolean
purple_request_field_is_validatable(PurpleRequestField
*field
);
1026 * purple_request_field_is_valid:
1027 * @field: The field.
1028 * @errmsg: If non-NULL, the memory area, where the pointer to validation
1029 * failure message will be set.
1031 * Checks, if specified field is valid.
1033 * If detailed message about failure reason is needed, there is an option to
1034 * return (via errmsg argument) pointer to newly allocated error message.
1035 * It must be freed with g_free after use.
1037 * Note: empty, not required fields are valid.
1039 * Returns: TRUE, if the field is valid, FALSE otherwise.
1041 gboolean
purple_request_field_is_valid(PurpleRequestField
*field
, gchar
**errmsg
);
1044 * purple_request_field_set_sensitive:
1045 * @field: The field.
1046 * @sensitive: TRUE if the field should be sensitive for user input.
1048 * Sets field editable.
1050 void purple_request_field_set_sensitive(PurpleRequestField
*field
,
1051 gboolean sensitive
);
1054 * purple_request_field_is_sensitive:
1055 * @field: The field.
1057 * Checks, if field is editable.
1059 * Returns: TRUE, if the field is sensitive for user input.
1061 gboolean
purple_request_field_is_sensitive(PurpleRequestField
*field
);
1064 * purple_request_field_set_sensitivity_cb:
1065 * @field: The field.
1066 * @cb: The callback.
1068 * Sets the callback, used to determine if the field should be editable.
1070 void purple_request_field_set_sensitivity_cb(PurpleRequestField
*field
,
1071 PurpleRequestFieldSensitivityCb cb
);
1074 * purple_request_field_get_ui_data:
1075 * @field: The field.
1077 * Returns the ui_data for a field.
1079 * Returns: The UI data.
1081 gpointer
purple_request_field_get_ui_data(const PurpleRequestField
*field
);
1084 * purple_request_field_set_ui_data:
1085 * @field: The field.
1086 * @ui_data: The UI data.
1088 * Sets the ui_data for a field.
1090 * Returns: The UI data.
1092 void purple_request_field_set_ui_data(PurpleRequestField
*field
,
1095 /**************************************************************************/
1096 /* String Field API */
1097 /**************************************************************************/
1100 * purple_request_field_string_new:
1101 * @id: The field ID.
1102 * @text: The text label of the field.
1103 * @default_value: The optional default value.
1104 * @multiline: Whether or not this should be a multiline string.
1106 * Creates a string request field.
1108 * Returns: The new field.
1110 PurpleRequestField
*purple_request_field_string_new(const char *id
,
1112 const char *default_value
,
1113 gboolean multiline
);
1116 * purple_request_field_string_set_default_value:
1117 * @field: The field.
1118 * @default_value: The default value.
1120 * Sets the default value in a string field.
1122 void purple_request_field_string_set_default_value(PurpleRequestField
*field
,
1123 const char *default_value
);
1126 * purple_request_field_string_set_value:
1127 * @field: The field.
1128 * @value: The value.
1130 * Sets the value in a string field.
1132 void purple_request_field_string_set_value(PurpleRequestField
*field
,
1136 * purple_request_field_string_set_masked:
1137 * @field: The field.
1138 * @masked: The masked value.
1140 * Sets whether or not a string field is masked
1141 * (commonly used for password fields).
1143 void purple_request_field_string_set_masked(PurpleRequestField
*field
,
1147 * purple_request_field_string_get_default_value:
1148 * @field: The field.
1150 * Returns the default value in a string field.
1152 * Returns: The default value.
1154 const char *purple_request_field_string_get_default_value(
1155 const PurpleRequestField
*field
);
1158 * purple_request_field_string_get_value:
1159 * @field: The field.
1161 * Returns the user-entered value in a string field.
1163 * Returns: The value.
1165 const char *purple_request_field_string_get_value(const PurpleRequestField
*field
);
1168 * purple_request_field_string_is_multiline:
1169 * @field: The field.
1171 * Returns whether or not a string field is multi-line.
1173 * Returns: %TRUE if the field is mulit-line, or %FALSE otherwise.
1175 gboolean
purple_request_field_string_is_multiline(const PurpleRequestField
*field
);
1178 * purple_request_field_string_is_masked:
1179 * @field: The field.
1181 * Returns whether or not a string field is masked.
1183 * Returns: %TRUE if the field is masked, or %FALSE otherwise.
1185 gboolean
purple_request_field_string_is_masked(const PurpleRequestField
*field
);
1187 /**************************************************************************/
1188 /* Integer Field API */
1189 /**************************************************************************/
1192 * purple_request_field_int_new:
1193 * @id: The field ID.
1194 * @text: The text label of the field.
1195 * @default_value: The default value.
1196 * @lower_bound: The lower bound.
1197 * @upper_bound: The upper bound.
1199 * Creates an integer field.
1201 * Returns: The new field.
1203 PurpleRequestField
*purple_request_field_int_new(const char *id
,
1204 const char *text
, int default_value
, int lower_bound
, int upper_bound
);
1207 * purple_request_field_int_set_default_value:
1208 * @field: The field.
1209 * @default_value: The default value.
1211 * Sets the default value in an integer field.
1213 void purple_request_field_int_set_default_value(PurpleRequestField
*field
,
1217 * purple_request_field_int_set_lower_bound:
1218 * @field: The field.
1219 * @lower_bound: The lower bound.
1221 * Sets the lower bound in an integer field.
1223 void purple_request_field_int_set_lower_bound(PurpleRequestField
*field
, int lower_bound
);
1226 * purple_request_field_int_set_upper_bound:
1227 * @field: The field.
1228 * @upper_bound: The upper bound.
1230 * Sets the upper bound in an integer field.
1232 void purple_request_field_int_set_upper_bound(PurpleRequestField
*field
, int upper_bound
);
1235 * purple_request_field_int_set_value:
1236 * @field: The field.
1237 * @value: The value.
1239 * Sets the value in an integer field.
1241 void purple_request_field_int_set_value(PurpleRequestField
*field
, int value
);
1244 * purple_request_field_int_get_default_value:
1245 * @field: The field.
1247 * Returns the default value in an integer field.
1249 * Returns: The default value.
1251 int purple_request_field_int_get_default_value(const PurpleRequestField
*field
);
1254 * purple_request_field_int_get_lower_bound:
1255 * @field: The field.
1257 * Returns the lower bound in an integer field.
1259 * Returns: The lower bound.
1261 int purple_request_field_int_get_lower_bound(const PurpleRequestField
*field
);
1264 * purple_request_field_int_get_upper_bound:
1265 * @field: The field.
1267 * Returns the upper bound in an integer field.
1269 * Returns: The upper bound.
1271 int purple_request_field_int_get_upper_bound(const PurpleRequestField
*field
);
1274 * purple_request_field_int_get_value:
1275 * @field: The field.
1277 * Returns the user-entered value in an integer field.
1279 * Returns: The value.
1281 int purple_request_field_int_get_value(const PurpleRequestField
*field
);
1283 /**************************************************************************/
1284 /* Boolean Field API */
1285 /**************************************************************************/
1288 * purple_request_field_bool_new:
1289 * @id: The field ID.
1290 * @text: The text label of the field.
1291 * @default_value: The default value.
1293 * Creates a boolean field.
1295 * This is often represented as a checkbox.
1297 * Returns: The new field.
1299 PurpleRequestField
*purple_request_field_bool_new(const char *id
,
1301 gboolean default_value
);
1304 * purple_request_field_bool_set_default_value:
1305 * @field: The field.
1306 * @default_value: The default value.
1308 * Sets the default value in an boolean field.
1310 void purple_request_field_bool_set_default_value(PurpleRequestField
*field
,
1311 gboolean default_value
);
1314 * purple_request_field_bool_set_value:
1315 * @field: The field.
1316 * @value: The value.
1318 * Sets the value in an boolean field.
1320 void purple_request_field_bool_set_value(PurpleRequestField
*field
,
1324 * purple_request_field_bool_get_default_value:
1325 * @field: The field.
1327 * Returns the default value in an boolean field.
1329 * Returns: The default value.
1331 gboolean
purple_request_field_bool_get_default_value(
1332 const PurpleRequestField
*field
);
1335 * purple_request_field_bool_get_value:
1336 * @field: The field.
1338 * Returns the user-entered value in an boolean field.
1340 * Returns: The value.
1342 gboolean
purple_request_field_bool_get_value(const PurpleRequestField
*field
);
1344 /**************************************************************************/
1345 /* Choice Field API */
1346 /**************************************************************************/
1349 * purple_request_field_choice_new:
1350 * @id: The field ID.
1351 * @text: The optional label of the field.
1352 * @default_value: The default choice.
1354 * Creates a multiple choice field.
1356 * This is often represented as a group of radio buttons.
1358 * Returns: The new field.
1360 PurpleRequestField
*
1361 purple_request_field_choice_new(const char *id
, const char *text
,
1362 gpointer default_value
);
1365 * purple_request_field_choice_add:
1366 * @field: The choice field.
1367 * @label: The choice label.
1368 * @data: The choice value.
1370 * Adds a choice to a multiple choice field.
1373 purple_request_field_choice_add(PurpleRequestField
*field
, const char *label
,
1377 * purple_request_field_choice_set_default_value:
1378 * @field: The field.
1379 * @default_value: The default value.
1381 * Sets the default value in an choice field.
1384 purple_request_field_choice_set_default_value(PurpleRequestField
*field
,
1385 gpointer default_value
);
1388 * purple_request_field_choice_set_value:
1389 * @field: The field.
1390 * @value: The value.
1392 * Sets the value in an choice field.
1395 purple_request_field_choice_set_value(PurpleRequestField
*field
,
1399 * purple_request_field_choice_get_default_value:
1400 * @field: The field.
1402 * Returns the default value in an choice field.
1404 * Returns: The default value.
1407 purple_request_field_choice_get_default_value(const PurpleRequestField
*field
);
1410 * purple_request_field_choice_get_value:
1411 * @field: The field.
1413 * Returns the user-entered value in an choice field.
1415 * Returns: The value.
1418 purple_request_field_choice_get_value(const PurpleRequestField
*field
);
1421 * purple_request_field_choice_get_elements:
1422 * @field: The field.
1424 * Returns a list of elements in a choice field.
1426 * Returns: (transfer none): The list of pairs of {label, value}.
1429 purple_request_field_choice_get_elements(const PurpleRequestField
*field
);
1432 * purple_request_field_choice_set_data_destructor:
1433 * @field: The field.
1434 * @destroy: The destroy function.
1436 * Sets the destructor for field values.
1439 purple_request_field_choice_set_data_destructor(PurpleRequestField
*field
,
1440 GDestroyNotify destroy
);
1442 /**************************************************************************/
1443 /* List Field API */
1444 /**************************************************************************/
1447 * purple_request_field_list_new:
1448 * @id: The field ID.
1449 * @text: The optional label of the field.
1451 * Creates a multiple list item field.
1453 * Returns: The new field.
1455 PurpleRequestField
*purple_request_field_list_new(const char *id
, const char *text
);
1458 * purple_request_field_list_set_multi_select:
1459 * @field: The list field.
1460 * @multi_select: TRUE if multiple selection is enabled,
1461 * or FALSE otherwise.
1463 * Sets whether or not a list field allows multiple selection.
1465 void purple_request_field_list_set_multi_select(PurpleRequestField
*field
,
1466 gboolean multi_select
);
1469 * purple_request_field_list_get_multi_select:
1470 * @field: The list field.
1472 * Returns whether or not a list field allows multiple selection.
1474 * Returns: TRUE if multiple selection is enabled, or FALSE otherwise.
1476 gboolean
purple_request_field_list_get_multi_select(
1477 const PurpleRequestField
*field
);
1480 * purple_request_field_list_get_data:
1481 * @field: The list field.
1482 * @text: The item text.
1484 * Returns the data for a particular item.
1486 * Returns: The data associated with the item.
1488 void *purple_request_field_list_get_data(const PurpleRequestField
*field
,
1492 * purple_request_field_list_add_icon:
1493 * @field: The list field.
1494 * @item: The list item.
1495 * @icon_path: The path to icon file, or %NULL for no icon.
1496 * @data: The associated data.
1498 * Adds an item to a list field.
1500 void purple_request_field_list_add_icon(PurpleRequestField
*field
,
1501 const char *item
, const char* icon_path
, void* data
);
1504 * purple_request_field_list_add_selected:
1505 * @field: The field.
1506 * @item: The item to add.
1508 * Adds a selected item to the list field.
1510 void purple_request_field_list_add_selected(PurpleRequestField
*field
,
1514 * purple_request_field_list_clear_selected:
1515 * @field: The field.
1517 * Clears the list of selected items in a list field.
1519 void purple_request_field_list_clear_selected(PurpleRequestField
*field
);
1522 * purple_request_field_list_set_selected:
1523 * @field: The field.
1524 * @items: The list of selected items, which is not modified or freed.
1526 * Sets a list of selected items in a list field.
1528 void purple_request_field_list_set_selected(PurpleRequestField
*field
,
1532 * purple_request_field_list_is_selected:
1533 * @field: The field.
1536 * Returns whether or not a particular item is selected in a list field.
1538 * Returns: TRUE if the item is selected. FALSE otherwise.
1540 gboolean
purple_request_field_list_is_selected(const PurpleRequestField
*field
,
1544 * purple_request_field_list_get_selected:
1545 * @field: The field.
1547 * Returns a list of selected items in a list field.
1549 * To retrieve the data for each item, use
1550 * purple_request_field_list_get_data().
1552 * Returns: (transfer none): The list of selected items.
1554 GList
*purple_request_field_list_get_selected(
1555 const PurpleRequestField
*field
);
1558 * purple_request_field_list_get_items:
1559 * @field: The field.
1561 * Returns a list of items in a list field.
1563 * Returns: (transfer none): The list of items.
1565 GList
*purple_request_field_list_get_items(const PurpleRequestField
*field
);
1568 * purple_request_field_list_get_icons:
1569 * @field: The field.
1571 * Returns a list of icons in a list field.
1573 * The icons will correspond with the items, in order.
1575 * Returns: (transfer none): The list of icons or %NULL (i.e. the empty #GList)
1576 * if no items have icons.
1578 GList
*purple_request_field_list_get_icons(const PurpleRequestField
*field
);
1580 /**************************************************************************/
1581 /* Label Field API */
1582 /**************************************************************************/
1585 * purple_request_field_label_new:
1586 * @id: The field ID.
1587 * @text: The label of the field.
1589 * Creates a label field.
1591 * Returns: The new field.
1593 PurpleRequestField
*purple_request_field_label_new(const char *id
,
1596 /**************************************************************************/
1597 /* Image Field API */
1598 /**************************************************************************/
1601 * purple_request_field_image_new:
1602 * @id: The field ID.
1603 * @text: The label of the field.
1604 * @buf: The image data.
1605 * @size: The size of the data in @buf.
1607 * Creates an image field.
1609 * Returns: The new field.
1611 PurpleRequestField
*purple_request_field_image_new(const char *id
, const char *text
,
1612 const char *buf
, gsize size
);
1615 * purple_request_field_image_set_scale:
1616 * @field: The image field.
1617 * @x: The x scale factor.
1618 * @y: The y scale factor.
1620 * Sets the scale factors of an image field.
1622 void purple_request_field_image_set_scale(PurpleRequestField
*field
, unsigned int x
, unsigned int y
);
1625 * purple_request_field_image_get_buffer:
1626 * @field: The image field.
1628 * Returns pointer to the image.
1630 * Returns: Pointer to the image.
1632 const char *purple_request_field_image_get_buffer(PurpleRequestField
*field
);
1635 * purple_request_field_image_get_size:
1636 * @field: The image field.
1638 * Returns size (in bytes) of the image.
1640 * Returns: Size of the image.
1642 gsize
purple_request_field_image_get_size(PurpleRequestField
*field
);
1645 * purple_request_field_image_get_scale_x:
1646 * @field: The image field.
1648 * Returns X scale coefficient of the image.
1650 * Returns: X scale coefficient of the image.
1652 unsigned int purple_request_field_image_get_scale_x(PurpleRequestField
*field
);
1655 * purple_request_field_image_get_scale_y:
1656 * @field: The image field.
1658 * Returns Y scale coefficient of the image.
1660 * Returns: Y scale coefficient of the image.
1662 unsigned int purple_request_field_image_get_scale_y(PurpleRequestField
*field
);
1664 /**************************************************************************/
1665 /* Account Field API */
1666 /**************************************************************************/
1669 * purple_request_field_account_new:
1670 * @id: The field ID.
1671 * @text: The text label of the field.
1672 * @account: The optional default account.
1674 * Creates an account field.
1676 * By default, this field will not show offline accounts.
1678 * Returns: The new field.
1680 PurpleRequestField
*purple_request_field_account_new(const char *id
,
1682 PurpleAccount
*account
);
1685 * purple_request_field_account_set_default_value:
1686 * @field: The account field.
1687 * @default_value: The default account.
1689 * Sets the default account on an account field.
1691 void purple_request_field_account_set_default_value(PurpleRequestField
*field
,
1692 PurpleAccount
*default_value
);
1695 * purple_request_field_account_set_value:
1696 * @field: The account field.
1697 * @value: The account.
1699 * Sets the account in an account field.
1701 void purple_request_field_account_set_value(PurpleRequestField
*field
,
1702 PurpleAccount
*value
);
1705 * purple_request_field_account_set_show_all:
1706 * @field: The account field.
1707 * @show_all: Whether or not to show all accounts.
1709 * Sets whether or not to show all accounts in an account field.
1711 * If TRUE, all accounts, online or offline, will be shown. If FALSE,
1712 * only online accounts will be shown.
1714 void purple_request_field_account_set_show_all(PurpleRequestField
*field
,
1718 * purple_request_field_account_set_filter:
1719 * @field: The account field.
1720 * @filter_func: The account filter function.
1722 * Sets the account filter function in an account field.
1724 * This function will determine which accounts get displayed and which
1727 void purple_request_field_account_set_filter(PurpleRequestField
*field
,
1728 PurpleFilterAccountFunc filter_func
);
1731 * purple_request_field_account_get_default_value:
1732 * @field: The field.
1734 * Returns the default account in an account field.
1736 * Returns: The default account.
1738 PurpleAccount
*purple_request_field_account_get_default_value(
1739 const PurpleRequestField
*field
);
1742 * purple_request_field_account_get_value:
1743 * @field: The field.
1745 * Returns the user-entered account in an account field.
1747 * Returns: The user-entered account.
1749 PurpleAccount
*purple_request_field_account_get_value(
1750 const PurpleRequestField
*field
);
1753 * purple_request_field_account_get_show_all:
1754 * @field: The account field.
1756 * Returns whether or not to show all accounts in an account field.
1758 * If TRUE, all accounts, online or offline, will be shown. If FALSE,
1759 * only online accounts will be shown.
1761 * Returns: Whether or not to show all accounts.
1763 gboolean
purple_request_field_account_get_show_all(
1764 const PurpleRequestField
*field
);
1767 * purple_request_field_account_get_filter:
1768 * @field: The account field.
1770 * Returns the account filter function in an account field.
1772 * This function will determine which accounts get displayed and which
1775 * Returns: The account filter function.
1777 PurpleFilterAccountFunc
purple_request_field_account_get_filter(
1778 const PurpleRequestField
*field
);
1780 /**************************************************************************/
1781 /* Certificate Field API */
1782 /**************************************************************************/
1785 * purple_request_field_certificate_new:
1786 * @id: The field ID.
1787 * @text: The label of the field.
1788 * @cert: The certificate of the field.
1790 * Creates a certificate field.
1792 * Returns: The new field.
1794 PurpleRequestField
*purple_request_field_certificate_new(const char *id
,
1796 GTlsCertificate
*cert
);
1799 * purple_request_field_certificate_get_value:
1800 * @field: The field.
1802 * Returns the certificate in a certificate field.
1804 * Returns: The certificate.
1806 GTlsCertificate
*purple_request_field_certificate_get_value(
1807 const PurpleRequestField
*field
);
1809 /**************************************************************************/
1810 /* Datasheet Field API */
1811 /**************************************************************************/
1814 * purple_request_field_datasheet_new:
1815 * @id: The field ID.
1816 * @text: The label of the field, may be %NULL.
1817 * @sheet: The datasheet.
1819 * Creates a datasheet item field.
1821 * Returns: The new field.
1823 PurpleRequestField
*purple_request_field_datasheet_new(const char *id
,
1824 const gchar
*text
, PurpleRequestDatasheet
*sheet
);
1827 * purple_request_field_datasheet_get_sheet:
1828 * @field: The field.
1830 * Returns a datasheet for a field.
1832 * Returns: (transfer none): The datasheet object.
1834 PurpleRequestDatasheet
*purple_request_field_datasheet_get_sheet(
1835 PurpleRequestField
*field
);
1837 /**************************************************************************/
1838 /* Validators for request fields. */
1839 /**************************************************************************/
1842 * purple_request_field_email_validator:
1843 * @field: The field.
1844 * @errmsg: (Optional) destination for error message.
1845 * @user_data: Ignored.
1847 * Validates a field which should contain an email address.
1849 * See purple_request_field_set_validator().
1851 * Returns: TRUE, if field contains valid email address.
1853 gboolean
purple_request_field_email_validator(PurpleRequestField
*field
,
1854 gchar
**errmsg
, void *user_data
);
1857 * purple_request_field_alphanumeric_validator:
1858 * @field: The field.
1859 * @errmsg: (allow-none): destination for error message.
1860 * @allowed_characters: (allow-none): allowed character list
1861 * (NULL-terminated string).
1863 * Validates a field which should contain alphanumeric content.
1865 * See purple_request_field_set_validator().
1867 * Returns: TRUE, if field contains only alphanumeric characters.
1869 gboolean
purple_request_field_alphanumeric_validator(PurpleRequestField
*field
,
1870 gchar
**errmsg
, void *allowed_characters
);
1872 /**************************************************************************/
1874 /**************************************************************************/
1877 * purple_request_input:
1878 * @handle: The plugin or connection handle. For some
1879 * things this is <emphasis>extremely</emphasis> important. The
1880 * handle is used to programmatically close the request
1881 * dialog when it is no longer needed. For protocols this
1882 * is often a pointer to the #PurpleConnection
1883 * instance. For plugins this should be a similar,
1884 * unique memory location. This value is important
1885 * because it allows a request to be closed with
1886 * purple_request_close_with_handle() when, for
1887 * example, you sign offline. If the request is
1888 * <emphasis>not</emphasis> closed it is
1889 * <emphasis>very</emphasis> likely to cause a crash whenever
1890 * the callback handler functions are triggered.
1891 * @title: The title of the message, or %NULL if it should have
1893 * @primary: The main point of the message, or %NULL if you're
1894 * feeling enigmatic.
1895 * @secondary: Secondary information, or %NULL if there is none.
1896 * @default_value: The default value.
1897 * @multiline: %TRUE if the inputted text can span multiple lines.
1898 * @masked: %TRUE if the inputted text should be masked in some
1899 * way (such as by displaying characters as stars). This
1900 * might be because the input is some kind of password.
1901 * @hint: Optionally suggest how the input box should appear.
1902 * Use "html", for example, to allow the user to enter HTML.
1903 * @ok_text: The text for the <literal>OK</literal> button, which may not
1905 * @ok_cb: The callback for the <literal>OK</literal> button, which may
1907 * @cancel_text: The text for the <literal>Cancel</literal> button, which may
1909 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
1911 * @cpar: The #PurpleRequestCommonParameters object, which gets
1912 * unref'ed after this call.
1913 * @user_data: The data to pass to the callback.
1915 * Prompts the user for text input.
1917 * Returns: A UI-specific handle.
1919 void *purple_request_input(void *handle
, const char *title
, const char *primary
,
1920 const char *secondary
, const char *default_value
, gboolean multiline
,
1921 gboolean masked
, gchar
*hint
,
1922 const char *ok_text
, GCallback ok_cb
,
1923 const char *cancel_text
, GCallback cancel_cb
,
1924 PurpleRequestCommonParameters
*cpar
,
1928 * purple_request_choice:
1929 * @handle: The plugin or connection handle. For some things this
1930 * is <emphasis>extremely</emphasis> important. See the comments on
1931 * purple_request_input().
1932 * @title: The title of the message, or %NULL if it should have
1934 * @primary: The main point of the message, or %NULL if you're
1935 * feeling enigmatic.
1936 * @secondary: Secondary information, or %NULL if there is none.
1937 * @default_value: The default choice; this should be one of the values
1938 * listed in the varargs.
1939 * @ok_text: The text for the <literal>OK</literal> button, which may not
1941 * @ok_cb: The callback for the <literal>OK</literal> button, which may
1943 * @cancel_text: The text for the <literal>Cancel</literal> button, which may
1945 * @cancel_cb: The callback for the <literal>Cancel</literal> button, or
1946 * %NULL to do nothing.
1947 * @cpar: The #PurpleRequestCommonParameters object, which gets
1948 * unref'ed after this call.
1949 * @user_data: The data to pass to the callback.
1950 * @...: The choices, which should be pairs of <type>char *</type>
1951 * descriptions and <type>int</type> values, terminated with a
1954 * Prompts the user for multiple-choice input.
1956 * Returns: A UI-specific handle.
1958 void *purple_request_choice(void *handle
, const char *title
, const char *primary
,
1959 const char *secondary
, gpointer default_value
,
1960 const char *ok_text
, GCallback ok_cb
,
1961 const char *cancel_text
, GCallback cancel_cb
,
1962 PurpleRequestCommonParameters
*cpar
,
1963 void *user_data
, ...) G_GNUC_NULL_TERMINATED
;
1966 * purple_request_choice_varg:
1968 * <literal>va_list</literal> version of purple_request_choice(); see its
1971 void *purple_request_choice_varg(void *handle
, const char *title
,
1972 const char *primary
, const char *secondary
, gpointer default_value
,
1973 const char *ok_text
, GCallback ok_cb
,
1974 const char *cancel_text
, GCallback cancel_cb
,
1975 PurpleRequestCommonParameters
*cpar
,
1976 void *user_data
, va_list choices
);
1979 * purple_request_action:
1980 * @handle: The plugin or connection handle. For some things this
1981 * is <emphasis>extremely</emphasis> important. See the comments on
1982 * purple_request_input().
1983 * @title: The title of the message, or %NULL if it should have
1985 * @primary: The main point of the message, or %NULL if you're
1986 * feeling enigmatic.
1987 * @secondary: Secondary information, or %NULL if there is none.
1988 * @default_action: The default action, zero-indexed; if the third action
1989 * supplied should be the default, supply
1990 * <literal>2</literal>. This should be the action that
1991 * users are most likely to select.
1992 * @cpar: The #PurpleRequestCommonParameters object, which gets
1993 * unref'ed after this call.
1994 * @user_data: The data to pass to the callback.
1995 * @action_count: The number of actions.
1996 * @...: A list of actions. These are pairs of
1997 * arguments. The first of each pair is the
1998 * <type>char *</type> label that appears on the button.
1999 * It should have an underscore before the letter you want
2000 * to use as the accelerator key for the button. The
2001 * second of each pair is the #PurpleRequestActionCb
2002 * function to use when the button is clicked.
2004 * Prompts the user for an action.
2006 * This is often represented as a dialog with a button for each action.
2008 * Returns: A UI-specific handle.
2011 purple_request_action(void *handle
, const char *title
, const char *primary
,
2012 const char *secondary
, int default_action
,
2013 PurpleRequestCommonParameters
*cpar
, void *user_data
,
2014 size_t action_count
, ...);
2017 * purple_request_action_varg:
2019 * <literal>va_list</literal> version of purple_request_action(); see its
2023 purple_request_action_varg(void *handle
, const char *title
, const char *primary
,
2024 const char *secondary
, int default_action
,
2025 PurpleRequestCommonParameters
*cpar
, void *user_data
,
2026 size_t action_count
, va_list actions
);
2029 * purple_request_wait:
2030 * @handle: The plugin or connection handle. For some things this
2031 * is <emphasis>extremely</emphasis> important. See the comments on
2032 * purple_request_input().
2033 * @title: The title of the message, or %NULL if it should have
2035 * @primary: The main point of the message, or %NULL if you're
2036 * feeling enigmatic.
2037 * @secondary: Secondary information, or %NULL if there is none.
2038 * @with_progress: %TRUE, if we want to display progress bar, %FALSE
2040 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
2042 * @cpar: The #PurpleRequestCommonParameters object, which gets
2043 * unref'ed after this call.
2044 * @user_data: The data to pass to the callback.
2046 * Displays a "please wait" dialog.
2048 * Returns: A UI-specific handle.
2051 purple_request_wait(void *handle
, const char *title
, const char *primary
,
2052 const char *secondary
, gboolean with_progress
,
2053 PurpleRequestCancelCb cancel_cb
, PurpleRequestCommonParameters
*cpar
,
2057 * purple_request_wait_pulse:
2058 * @ui_handle: The request UI handle.
2060 * Notifies the "please wait" dialog that some progress has been made, but you
2061 * don't know how much.
2064 purple_request_wait_pulse(void *ui_handle
);
2067 * purple_request_wait_progress:
2068 * @ui_handle: The request UI handle.
2069 * @fraction: The part of task that is done (between 0.0 and 1.0,
2072 * Notifies the "please wait" dialog about progress has been made.
2075 purple_request_wait_progress(void *ui_handle
, gfloat fraction
);
2078 * purple_request_fields:
2079 * @handle: The plugin or connection handle. For some things this
2080 * is <emphasis>extremely</emphasis> important. See the comments on
2081 * purple_request_input().
2082 * @title: The title of the message, or %NULL if it should have
2084 * @primary: The main point of the message, or %NULL if you're
2085 * feeling enigmatic.
2086 * @secondary: Secondary information, or %NULL if there is none.
2087 * @fields: The list of fields.
2088 * @ok_text: The text for the <literal>OK</literal> button, which may not be
2090 * @ok_cb: The callback for the <literal>OK</literal> button, which may
2093 * @cancel_text: The text for the <literal>Cancel</literal> button, which may
2095 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
2097 * @cpar: The #PurpleRequestCommonParameters object, which gets
2098 * unref'ed after this call.
2099 * @user_data: The data to pass to the callback.
2101 * Displays groups of fields for the user to fill in.
2103 * Returns: A UI-specific handle.
2106 purple_request_fields(void *handle
, const char *title
, const char *primary
,
2107 const char *secondary
, PurpleRequestFields
*fields
,
2108 const char *ok_text
, GCallback ok_cb
,
2109 const char *cancel_text
, GCallback cancel_cb
,
2110 PurpleRequestCommonParameters
*cpar
,
2114 * purple_request_is_valid_ui_handle:
2115 * @ui_handle: The UI handle.
2116 * @type: The pointer to variable, where request type may be stored
2119 * Checks, if passed UI handle is valid.
2121 * Returns: TRUE, if handle is valid, FALSE otherwise.
2124 purple_request_is_valid_ui_handle(void *ui_handle
, PurpleRequestType
*type
);
2127 * purple_request_add_close_notify:
2128 * @ui_handle: The UI handle.
2129 * @notify: The function to be called.
2130 * @notify_data: The data to be passed to the callback function.
2132 * Adds a function called when notification dialog is closed.
2135 purple_request_add_close_notify(void *ui_handle
, GDestroyNotify notify
,
2136 gpointer notify_data
);
2139 * purple_request_close:
2140 * @type: The request type.
2141 * @uihandle: The request UI handle.
2145 void purple_request_close(PurpleRequestType type
, void *uihandle
);
2148 * purple_request_close_with_handle:
2149 * @handle: The handle, as supplied as the @handle parameter to one of the
2150 * <literal>purple_request_*</literal> functions.
2152 * Closes all requests registered with the specified handle.
2154 * See purple_request_input().
2156 void purple_request_close_with_handle(void *handle
);
2159 * purple_request_yes_no:
2161 * A wrapper for purple_request_action() that uses <literal>Yes</literal> and
2162 * <literal>No</literal> buttons.
2164 #define purple_request_yes_no(handle, title, primary, secondary, \
2165 default_action, cpar, user_data, yes_cb, no_cb) \
2166 purple_request_action((handle), (title), (primary), (secondary), \
2167 (default_action), (cpar), (user_data), 2, _("_Yes"), (yes_cb), \
2171 * purple_request_ok_cancel:
2173 * A wrapper for purple_request_action() that uses <literal>OK</literal> and
2174 * <literal>Cancel</literal> buttons.
2176 #define purple_request_ok_cancel(handle, title, primary, secondary, \
2177 default_action, cpar, user_data, ok_cb, cancel_cb) \
2178 purple_request_action((handle), (title), (primary), (secondary), \
2179 (default_action), (cpar), (user_data), 2, _("_OK"), (ok_cb), \
2180 _("_Cancel"), (cancel_cb))
2183 * purple_request_accept_cancel:
2185 * A wrapper for purple_request_action() that uses Accept and Cancel buttons.
2187 #define purple_request_accept_cancel(handle, title, primary, secondary, \
2188 default_action, cpar, user_data, accept_cb, cancel_cb) \
2189 purple_request_action((handle), (title), (primary), (secondary), \
2190 (default_action), (cpar), (user_data), 2, _("_Accept"), \
2191 (accept_cb), _("_Cancel"), (cancel_cb))
2194 * purple_request_file:
2195 * @handle: The plugin or connection handle. For some things this
2196 * is <emphasis>extremely</emphasis> important. See the comments on
2197 * purple_request_input().
2198 * @title: The title of the message, or %NULL if it should have
2200 * @filename: The default filename (may be %NULL)
2201 * @savedialog: True if this dialog is being used to save a file.
2202 * False if it is being used to open a file.
2203 * @ok_cb: The callback for the <literal>OK</literal> button.
2204 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
2206 * @cpar: The #PurpleRequestCommonParameters object, which gets
2207 * unref'ed after this call.
2208 * @user_data: The data to pass to the callback.
2210 * Displays a file selector request dialog. Returns the selected filename to
2211 * the callback. Can be used for either opening a file or saving a file.
2213 * Returns: A UI-specific handle.
2216 purple_request_file(void *handle
, const char *title
, const char *filename
,
2217 gboolean savedialog
, GCallback ok_cb
, GCallback cancel_cb
,
2218 PurpleRequestCommonParameters
*cpar
, void *user_data
);
2221 * purple_request_folder:
2222 * @handle: The plugin or connection handle. For some things this
2223 * is <emphasis>extremely</emphasis> important. See the comments on
2224 * purple_request_input().
2225 * @title: The title of the message, or %NULL if it should have
2227 * @dirname: The default directory name (may be %NULL)
2228 * @ok_cb: The callback for the <literal>OK</literal> button.
2229 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
2231 * @cpar: The #PurpleRequestCommonParameters object, which gets
2232 * unref'ed after this call.
2233 * @user_data: The data to pass to the callback.
2235 * Displays a folder select dialog. Returns the selected filename to
2238 * Returns: A UI-specific handle.
2241 purple_request_folder(void *handle
, const char *title
, const char *dirname
,
2242 GCallback ok_cb
, GCallback cancel_cb
,
2243 PurpleRequestCommonParameters
*cpar
, void *user_data
);
2246 * purple_request_certificate:
2247 * @handle: The plugin or connection handle. For some things this
2248 * is <emphasis>extremely</emphasis> important. See the comments on
2249 * purple_request_input().
2250 * @title: The title of the message, or %NULL if it should have
2252 * @primary: The main point of the message, or %NULL if you're
2253 * feeling enigmatic.
2254 * @secondary: Secondary information, or %NULL if there is none.
2255 * @cert: The #GTlsCertificate associated with this request.
2256 * @ok_text: The text for the <literal>OK</literal> button, which may not
2258 * @ok_cb: The callback for the <literal>OK</literal> button, which may
2260 * @cancel_text: The text for the <literal>Cancel</literal> button, which may
2262 * @cancel_cb: The callback for the <literal>Cancel</literal> button, which
2264 * @user_data: The data to pass to the callback.
2266 * Prompts the user for action over a certificate.
2268 * This is often represented as a dialog with a button for each action.
2270 * Returns: A UI-specific handle.
2272 void *purple_request_certificate(void *handle
, const char *title
,
2273 const char *primary
, const char *secondary
, GTlsCertificate
*cert
,
2274 const char *ok_text
, GCallback ok_cb
,
2275 const char *cancel_text
, GCallback cancel_cb
,
2278 /**************************************************************************/
2279 /* UI Registration Functions */
2280 /**************************************************************************/
2283 * purple_request_ui_ops_get_type:
2285 * Returns: The #GType for the #PurpleRequestUiOps boxed structure.
2287 GType
purple_request_ui_ops_get_type(void);
2290 * purple_request_set_ui_ops:
2291 * @ops: The UI operations structure.
2293 * Sets the UI operations structure to be used when displaying a
2296 void purple_request_set_ui_ops(PurpleRequestUiOps
*ops
);
2299 * purple_request_get_ui_ops:
2301 * Returns the UI operations structure to be used when displaying a
2304 * Returns: The UI operations structure.
2306 PurpleRequestUiOps
*purple_request_get_ui_ops(void);
2310 #endif /* _PURPLE_REQUEST_H_ */