3 * Pidgin 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 _PIDGINUTILS_H_
23 #define _PIDGINUTILS_H_
26 * @section_id: pidgin-gtkutils
27 * @short_description: <filename>gtkutils.h</filename>
28 * @title: Utility functions
38 PIDGIN_BUTTON_HORIZONTAL
,
39 PIDGIN_BUTTON_VERTICAL
41 } PidginButtonOrientation
;
45 PIDGIN_BUTTON_NONE
= 0,
48 PIDGIN_BUTTON_TEXT_IMAGE
54 PIDGIN_PROTOCOL_ICON_SMALL
,
55 PIDGIN_PROTOCOL_ICON_MEDIUM
,
56 PIDGIN_PROTOCOL_ICON_LARGE
57 } PidginProtocolIconSize
;
62 PIDGIN_BROWSER_DEFAULT
= 0,
63 /* value '1' was used by PIDGIN_BROWSER_CURRENT, which no longer exists */
64 PIDGIN_BROWSER_NEW_WINDOW
= 2,
65 PIDGIN_BROWSER_NEW_TAB
74 PurpleLogSet
*logged_buddy
;
76 } PidginBuddyCompletionEntry
;
78 typedef gboolean (*PidginFilterBuddyCompletionEntryFunc
) (const PidginBuddyCompletionEntry
*completion_entry
, gpointer user_data
);
84 * pidgin_setup_webview:
85 * @webview: The gtkwebview widget to setup.
87 * Sets up a gtkwebview widget and sets the default signal handlers.
89 void pidgin_setup_webview(GtkWidget
*webview
);
92 * pidgin_create_webview:
93 * @editable: %TRUE if this webview should be editable. If this is
94 * %FALSE, then the toolbar will NOT be created. If this webview
95 * should be read-only at first, but may become editable later, then
96 * pass in %TRUE here and then manually call
97 * webkit_web_view_set_editable() later.
98 * @webview_ret: A pointer to a pointer to a GtkWidget. This pointer
99 * will be set to the webview when this function exits.
100 * @sw_ret: This will be filled with a pointer to the scrolled window
101 * widget which contains the webview.
103 * Create an PidginWebView widget and associated PidginWebViewToolbar widget. This
104 * function puts both widgets in a nice GtkFrame. They're separated by an
105 * attractive GtkSeparator.
107 * Returns: The GtkFrame containing the toolbar and webview.
109 GtkWidget
*pidgin_create_webview(gboolean editable
, GtkWidget
**webview_ret
, GtkWidget
**sw_ret
);
112 * pidgin_create_small_button:
113 * @image: A button image.
115 * Creates a small button
117 * Returns: A GtkButton created from the image.
119 GtkWidget
*pidgin_create_small_button(GtkWidget
*image
);
122 * pidgin_create_window:
123 * @title: The window title, or %NULL
124 * @border_width: The window's desired border width
125 * @role: A string indicating what the window is responsible for doing, or %NULL
126 * @resizable: Whether the window should be resizable (%TRUE) or not (%FALSE)
128 * Creates a new window
130 GtkWidget
*pidgin_create_window(const char *title
, guint border_width
, const char *role
, gboolean resizable
);
133 * pidgin_create_dialog:
134 * @title: The window title, or %NULL
135 * @border_width: The window's desired border width
136 * @role: A string indicating what the window is responsible for doing, or %NULL
137 * @resizable: Whether the window should be resizable (%TRUE) or not (%FALSE)
139 * Creates a new dialog window
141 GtkWidget
*pidgin_create_dialog(const char *title
, guint border_width
, const char *role
, gboolean resizable
);
144 * pidgin_create_video_widget:
146 * Creates a new drawing area suitable for displaying a video
148 GtkWidget
*pidgin_create_video_widget(void);
151 * pidgin_dialog_get_vbox_with_properties:
152 * @dialog: The dialog window
153 * @homogeneous: TRUE if all children are to be given equal space allotments.
154 * @spacing: the number of pixels to place by default between children
156 * Retrieves the main content box (vbox) from a pidgin dialog window
158 GtkWidget
*pidgin_dialog_get_vbox_with_properties(GtkDialog
*dialog
, gboolean homogeneous
, gint spacing
);
161 * pidgin_dialog_get_vbox:
162 * @dialog: The dialog window
164 * Retrieves the main content box (vbox) from a pidgin dialog window
166 GtkWidget
*pidgin_dialog_get_vbox(GtkDialog
*dialog
);
169 * pidgin_dialog_add_button:
170 * @dialog: The dialog window
171 * @label: The stock-id or the label for the button
172 * @callback: The callback function for the button
173 * @callbackdata: The user data for the callback function
175 * Add a button to a dialog created by #pidgin_create_dialog.
177 * Returns: The created button.
179 GtkWidget
*pidgin_dialog_add_button(GtkDialog
*dialog
, const char *label
,
180 GCallback callback
, gpointer callbackdata
);
183 * pidgin_dialog_get_action_area:
184 * @dialog: The dialog window
186 * Retrieves the action area (button box) from a pidgin dialog window
188 GtkWidget
*pidgin_dialog_get_action_area(GtkDialog
*dialog
);
191 * pidgin_toggle_sensitive:
192 * @widget: %NULL. Used for signal handlers.
193 * @to_toggle: The widget to toggle.
195 * Toggles the sensitivity of a widget.
197 void pidgin_toggle_sensitive(GtkWidget
*widget
, GtkWidget
*to_toggle
);
200 * pidgin_set_sensitive_if_input:
201 * @entry: The text entry widget.
202 * @dialog: The dialog containing the text entry widget.
204 * Checks if text has been entered into a GtkTextEntry widget. If
205 * so, the GTK_RESPONSE_OK on the given dialog is set to TRUE.
206 * Otherwise GTK_RESPONSE_OK is set to FALSE.
208 void pidgin_set_sensitive_if_input(GtkWidget
*entry
, GtkWidget
*dialog
);
211 * pidgin_toggle_sensitive_array:
212 * @w: %NULL. Used for signal handlers.
213 * @data: The array containing the widgets to toggle.
215 * Toggles the sensitivity of all widgets in a pointer array.
217 void pidgin_toggle_sensitive_array(GtkWidget
*w
, GPtrArray
*data
);
220 * pidgin_toggle_showhide:
221 * @widget: %NULL. Used for signal handlers.
222 * @to_toggle: The widget to toggle.
224 * Toggles the visibility of a widget.
226 void pidgin_toggle_showhide(GtkWidget
*widget
, GtkWidget
*to_toggle
);
230 * @menu: The menu to add a separator to.
232 * Adds a separator to a menu.
234 * Returns: The separator.
236 GtkWidget
*pidgin_separator(GtkWidget
*menu
);
239 * pidgin_new_check_item:
240 * @menu: The menu to which to append the check menu item.
241 * @str: The title to use for the newly created menu item.
242 * @cb: A function to call when the menu item is activated.
243 * @data: Data to pass to the signal function.
244 * @checked: The initial state of the check item
246 * Creates a check menu item.
248 * Returns: The newly created menu item.
250 GtkWidget
*pidgin_new_check_item(GtkWidget
*menu
, const char *str
,
251 GCallback cb
, gpointer data
, gboolean checked
);
254 * pidgin_new_menu_item:
255 * @menu: The menu to which to append the menu item.
256 * @mnemonic: The title for the menu item.
257 * @icon: An icon to place to the left of the menu item,
258 * or %NULL for no icon.
259 * @cb: A function to call when the menu item is activated.
260 * @data: Data to pass to the signal function.
261 * @accel_key: Something.
262 * @accel_mods: Something.
265 * Creates a menu item.
267 * Returns: The newly created menu item.
269 GtkWidget
*pidgin_new_menu_item(GtkWidget
*menu
, const char *mnemonic
,
270 const char *icon
, GCallback cb
, gpointer data
);
273 * pidgin_pixbuf_button_from_stock:
274 * @text: The text for the button.
275 * @icon: The stock icon name.
276 * @style: The orientation of the button.
278 * Creates a button with the specified text and stock icon.
280 * Returns: The button.
282 GtkWidget
*pidgin_pixbuf_button_from_stock(const char *text
, const char *icon
,
283 PidginButtonOrientation style
);
286 * pidgin_pixbuf_toolbar_button_from_stock:
287 * @stock: The stock icon name.
289 * Creates a toolbar button with the stock icon.
291 * Returns: The button.
293 GtkWidget
*pidgin_pixbuf_toolbar_button_from_stock(const char *stock
);
297 * @parent: The widget to put the frame into.
298 * @title: The title for the frame.
300 * Creates a HIG preferences frame.
302 * Returns: The vbox to put things into.
304 GtkWidget
*pidgin_make_frame(GtkWidget
*parent
, const char *title
);
307 * pidgin_protocol_option_menu_new:
308 * @id: The protocol to select by default.
309 * @cb: The callback to call when a protocol is selected.
310 * @user_data: Data to pass to the callback function.
312 * Creates a drop-down option menu filled with protocols.
314 * Returns: The drop-down option menu.
316 GtkWidget
*pidgin_protocol_option_menu_new(const char *id
,
321 * pidgin_protocol_option_menu_get_selected:
322 * @optmenu: The drop-down option menu created by
323 * pidgin_account_option_menu_new.
325 * Gets the currently selected protocol from a protocol drop down box.
327 * Returns: Returns the protocol ID that is currently selected.
329 const char *pidgin_protocol_option_menu_get_selected(GtkWidget
*optmenu
);
332 * pidgin_account_option_menu_new:
333 * @default_account: The account to select by default.
334 * @show_all: Whether or not to show all accounts, or just
336 * @cb: The callback to call when an account is selected.
337 * @filter_func: A function for checking if an account should
338 * be shown. This can be NULL.
339 * @user_data: Data to pass to the callback function.
341 * Creates a drop-down option menu filled with accounts.
343 * Returns: The drop-down option menu.
345 GtkWidget
*pidgin_account_option_menu_new(PurpleAccount
*default_account
,
346 gboolean show_all
, GCallback cb
,
347 PurpleFilterAccountFunc filter_func
, gpointer user_data
);
350 * pidgin_account_option_menu_get_selected:
351 * @optmenu: The drop-down option menu created by
352 * pidgin_account_option_menu_new.
354 * Gets the currently selected account from an account drop down box.
356 * Returns: Returns the PurpleAccount that is currently selected.
358 PurpleAccount
*pidgin_account_option_menu_get_selected(GtkWidget
*optmenu
);
361 * pidgin_account_option_menu_set_selected:
362 * @optmenu: The GtkOptionMenu created by
363 * pidgin_account_option_menu_new.
364 * @account: The PurpleAccount to select.
366 * Sets the currently selected account for an account drop down box.
368 void pidgin_account_option_menu_set_selected(GtkWidget
*optmenu
, PurpleAccount
*account
);
371 * pidgin_setup_screenname_autocomplete:
372 * @entry: The GtkEntry on which to setup autocomplete.
373 * @optmenu: A menu for accounts, returned by pidgin_account_option_menu_new().
374 * If @optmenu is not %NULL, it'll be updated when a username is chosen
375 * from the autocomplete list.
376 * @filter_func: A function for checking if an autocomplete entry
377 * should be shown. This can be %NULL.
378 * @user_data: The data to be passed to the filter_func function.
380 * Add autocompletion of screenames to an entry, supporting a filtering function.
382 void pidgin_setup_screenname_autocomplete(GtkWidget
*entry
, GtkWidget
*optmenu
, PidginFilterBuddyCompletionEntryFunc filter_func
, gpointer user_data
);
385 * pidgin_screenname_autocomplete_default_filter:
386 * @completion_entry: The completion entry to filter.
387 * @all_accounts: If this is %FALSE, only the autocompletion entries
388 * which belong to an online account will be filtered.
390 * The default filter function for username autocomplete.
392 * Returns: Returns %TRUE if the autocompletion entry is filtered.
394 gboolean
pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry
*completion_entry
, gpointer all_accounts
);
397 * pidgin_save_accels_cb:
399 * Save menu accelerators callback
401 void pidgin_save_accels_cb(GtkAccelGroup
*accel_group
, guint arg1
,
402 GdkModifierType arg2
, GClosure
*arg3
,
406 * pidgin_save_accels:
408 * Save menu accelerators
410 gboolean
pidgin_save_accels(gpointer data
);
413 * pidgin_load_accels:
415 * Load menu accelerators
417 void pidgin_load_accels(void);
420 * pidgin_retrieve_user_info:
421 * @conn: The connection to get information from.
422 * @name: The user to get information about.
424 * Get information about a user. Show immediate feedback.
426 void pidgin_retrieve_user_info(PurpleConnection
*conn
, const char *name
);
429 * pidgin_retrieve_user_info_in_chat:
430 * @conn: The connection to get information from.
431 * @name: The user to get information about.
432 * @chatid: The chat id.
434 * Get information about a user in a chat. Show immediate feedback.
436 void pidgin_retrieve_user_info_in_chat(PurpleConnection
*conn
, const char *name
, int chatid
);
439 * pidgin_parse_x_im_contact:
440 * @msg: The MIME message.
441 * @all_accounts: If TRUE, check all compatible accounts, online or
442 * offline. If FALSE, check only online accounts.
443 * @ret_account: The best guess at a compatible protocol,
444 * based on ret_protocol. If NULL, no account was found.
445 * @ret_protocol: The returned protocol type.
446 * @ret_username: The returned username.
447 * @ret_alias: The returned alias.
449 * Parses an application/x-im-contact MIME message and returns the
452 * Returns: TRUE if the message was parsed for the minimum necessary data.
455 gboolean
pidgin_parse_x_im_contact(const char *msg
, gboolean all_accounts
,
456 PurpleAccount
**ret_account
,
457 char **ret_protocol
, char **ret_username
,
461 * pidgin_set_accessible_label:
462 * @w: The widget that we want to name.
463 * @l: A GtkLabel that we want to use as the ATK name for the widget.
465 * Sets an ATK name for a given widget. Also sets the labelled-by
466 * and label-for ATK relationships.
468 void pidgin_set_accessible_label(GtkWidget
*w
, GtkLabel
*l
);
471 * pidgin_set_accessible_relations:
472 * @w: The widget that we want to label.
473 * @l: A GtkLabel that we want to use as the label for the widget.
475 * Sets the labelled-by and label-for ATK relationships.
477 void pidgin_set_accessible_relations(GtkWidget
*w
, GtkLabel
*l
);
480 * pidgin_menu_position_func_helper:
481 * @menu: The menu we are positioning.
482 * @x: Address of the gint representing the horizontal position
483 * where the menu shall be drawn. This is an output parameter.
484 * @y: Address of the gint representing the vertical position
485 * where the menu shall be drawn. This is an output parameter.
486 * @push_in: This is an output parameter?
487 * @data: Not used by this particular position function.
489 * A helper function for GtkMenuPositionFuncs. This ensures the menu will
490 * be kept on screen if possible.
492 void pidgin_menu_position_func_helper(GtkMenu
*menu
, gint
*x
, gint
*y
,
493 gboolean
*push_in
, gpointer data
);
496 * pidgin_treeview_popup_menu_position_func:
497 * @menu: The menu we are positioning.
498 * @x: Address of the gint representing the horizontal position
499 * where the menu shall be drawn. This is an output parameter.
500 * @y: Address of the gint representing the vertical position
501 * where the menu shall be drawn. This is an output parameter.
502 * @push_in: This is an output parameter?
503 * @user_data: Not used by this particular position function.
505 * A valid GtkMenuPositionFunc. This is used to determine where
506 * to draw context menus when the menu is activated with the
507 * keyboard (shift+F10). If the menu is activated with the mouse,
508 * then you should just use GTK's built-in position function,
509 * because it does a better job of positioning the menu.
511 void pidgin_treeview_popup_menu_position_func(GtkMenu
*menu
,
518 * pidgin_dnd_file_manage:
519 * @sd: GtkSelectionData for managing drag'n'drop
520 * @account: Account to be used (may be NULL if conv is not NULL)
521 * @who: Buddy name (may be NULL if conv is not NULL)
523 * Manages drag'n'drop of files.
525 void pidgin_dnd_file_manage(GtkSelectionData
*sd
, PurpleAccount
*account
, const char *who
);
528 * pidgin_buddy_icon_get_scale_size:
530 * Convenience wrapper for purple_buddy_icon_spec_get_scaled_size
532 void pidgin_buddy_icon_get_scale_size(GdkPixbuf
*buf
, PurpleBuddyIconSpec
*spec
, PurpleBuddyIconScaleFlags rules
, int *width
, int *height
);
535 * pidgin_create_protocol_icon:
536 * @account: The account.
537 * @size: The size of the icon to return.
539 * Returns the base image to represent the account, based on
540 * the currently selected theme.
542 * Returns: A newly-created pixbuf with a reference count of 1,
543 * or NULL if any of several error conditions occurred:
544 * the file could not be opened, there was no loader
545 * for the file's format, there was not enough memory
546 * to allocate the image buffer, or the image file
547 * contained invalid data.
549 GdkPixbuf
*pidgin_create_protocol_icon(PurpleAccount
*account
, PidginProtocolIconSize size
);
552 * pidgin_create_status_icon:
553 * @primitive: The status primitive
554 * @w: The widget to render this
555 * @size: The icon size to render at
557 * Creates a status icon for a given primitve
559 * Returns: A GdkPixbuf, created from stock
561 GdkPixbuf
* pidgin_create_status_icon(PurpleStatusPrimitive primitive
, GtkWidget
*w
, const char *size
);
564 * pidgin_stock_id_from_status_primitive:
565 * @prim: The status primitive
567 * Returns an appropriate stock-id for a status primitive.
569 * Returns: The stock-id
571 const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim
);
574 * pidgin_stock_id_from_presence:
575 * @presence: The presence.
577 * Returns an appropriate stock-id for a PurplePresence.
579 * Returns: The stock-id
581 const char *pidgin_stock_id_from_presence(PurplePresence
*presence
);
584 * pidgin_append_menu_action:
585 * @menu: The menu to append to.
586 * @act: The PurpleMenuAction to append.
587 * @gobject: The object to be passed to the action callback.
589 * Append a PurpleMenuAction to a menu.
591 * Returns: The menuitem added.
593 GtkWidget
*pidgin_append_menu_action(GtkWidget
*menu
, PurpleMenuAction
*act
,
598 * @widget: The widget for which to set the mouse pointer
599 * @cursor_type: The type of cursor to set
601 * Sets the mouse pointer for a GtkWidget.
603 * After setting the cursor, the display is flushed, so the change will
604 * take effect immediately.
606 * If the window for @widget is %NULL, this function simply returns.
608 void pidgin_set_cursor(GtkWidget
*widget
, GdkCursorType cursor_type
);
611 * pidgin_clear_cursor:
613 * Sets the mouse point for a GtkWidget back to that of its parent window.
615 * If @widget is %NULL, this function simply returns.
617 * If the window for @widget is %NULL, this function simply returns.
619 * Note: The display is not flushed from this function.
621 void pidgin_clear_cursor(GtkWidget
*widget
);
624 * pidgin_buddy_icon_chooser_new:
625 * @parent: The parent window
626 * @callback: The callback to call when the window is closed. If the user chose an icon, the char* argument will point to its path
627 * @data: Data to pass to @callback
629 * Creates a File Selection widget for choosing a buddy icon
631 * Returns: The file dialog
633 GtkWidget
*pidgin_buddy_icon_chooser_new(GtkWindow
*parent
, void(*callback
)(const char*,gpointer
), gpointer data
);
636 * pidgin_convert_buddy_icon:
637 * @protocol: The protocol to convert the icon
638 * @path: The path of a file to convert
639 * @len: If not %NULL, the length of the returned data will be set here.
641 * Converts a buddy icon to the required size and format
643 * Returns: The converted image data, or %NULL if an error occurred.
645 gpointer
pidgin_convert_buddy_icon(PurpleProtocol
*protocol
, const char *path
, size_t *len
);
648 * pidgin_make_pretty_arrows:
649 * @str: The text to convert
651 * Converts "->" and "<-" in strings to Unicode arrow characters, for use in referencing
654 * Returns: A newly allocated string with unicode arrow characters
656 char *pidgin_make_pretty_arrows(const char *str
);
659 * PidginUtilMiniDialogCallback:
661 * The type of callbacks passed to pidgin_make_mini_dialog().
663 typedef void (*PidginUtilMiniDialogCallback
)(gpointer user_data
, GtkButton
*);
666 * pidgin_make_mini_dialog:
667 * @handle: The #PurpleConnection to which this mini-dialog
668 * refers, or %NULL if it does not refer to a
669 * connection. If @handle is supplied, the mini-dialog
670 * will be automatically removed and destroyed when the
671 * connection signs off.
672 * @stock_id: The ID of a stock image to use in the mini dialog.
673 * @primary: The primary text
674 * @secondary: The secondary text, or %NULL for no description.
675 * @user_data: Data to pass to the callbacks
676 * @...: a %NULL-terminated list of button labels
677 * (<type>char *</type>) and callbacks
678 * (#PidginUtilMiniDialogCallback). @user_data will be
679 * passed as the first argument. (Callbacks may lack a
680 * second argument, or be %NULL to take no action when
681 * the corresponding button is pressed.) When a button is
682 * pressed, the callback (if any) will be called; when
683 * the callback returns the dialog will be destroyed.
685 * Creates a #PidginMiniDialog, tied to a #PurpleConnection, suitable for
686 * embedding in the buddy list scrollbook with pidgin_blist_add_alert().
688 * See <link linkend="pidgin-pidginstock">Stock Resources</link>.
690 * Returns: A #PidginMiniDialog, suitable for passing to
691 * pidgin_blist_add_alert().
693 GtkWidget
*pidgin_make_mini_dialog(PurpleConnection
*handle
,
694 const char* stock_id
, const char *primary
, const char *secondary
,
695 void *user_data
, ...) G_GNUC_NULL_TERMINATED
;
698 * pidgin_make_mini_dialog_with_custom_icon:
700 * Does exactly what pidgin_make_mini_dialog() does, except you can specify
701 * a custom icon for the dialog.
703 GtkWidget
*pidgin_make_mini_dialog_with_custom_icon(PurpleConnection
*gc
,
704 GdkPixbuf
*custom_icon
,
706 const char *secondary
,
708 ...) G_GNUC_NULL_TERMINATED
;
711 * pidgin_tree_view_search_equal_func:
713 * This is a callback function to be used for Ctrl+F searching in treeviews.
715 * gtk_tree_view_set_search_equal_func(treeview,
716 * pidgin_tree_view_search_equal_func,
717 * search_data, search_data_destroy_cb);
720 gboolean
pidgin_tree_view_search_equal_func(GtkTreeModel
*model
, gint column
,
721 const gchar
*key
, GtkTreeIter
*iter
, gpointer data
);
725 * @window: The window to draw attention to
726 * @urgent: Whether to set the urgent hint or not
728 * Sets or resets a window to 'urgent,' by setting the URGENT hint in X
729 * or blinking in the win32 taskbar
731 void pidgin_set_urgent(GtkWindow
*window
, gboolean urgent
);
734 * pidgin_gdk_pixbuf_is_opaque:
735 * @pixbuf: The pixbug
737 * Returns TRUE if the GdkPixbuf is opaque, as determined by no
738 * alpha at any of the edge pixels.
740 * Returns: TRUE if the pixbuf is opaque around the edges, FALSE otherwise
742 gboolean
pidgin_gdk_pixbuf_is_opaque(GdkPixbuf
*pixbuf
);
745 * pidgin_gdk_pixbuf_make_round:
746 * @pixbuf: The buddy icon to transform
748 * Rounds the corners of a 32x32 GdkPixbuf in place
750 void pidgin_gdk_pixbuf_make_round(GdkPixbuf
*pixbuf
);
753 * pidgin_get_dim_grey_string:
754 * @widget: The widget to return dim grey for
756 * Returns an HTML-style color string for use as a dim grey
759 * Returns: The dim grey string
761 const char *pidgin_get_dim_grey_string(GtkWidget
*widget
);
764 * pidgin_text_combo_box_entry_new:
765 * @default_item: Initial contents of GtkEntry
766 * @items: GList containing strings to add to GtkComboBox
768 * Create a simple text GtkComboBoxEntry equivalent
770 * Returns: A newly created text GtkComboBox containing a GtkEntry
773 GtkWidget
*pidgin_text_combo_box_entry_new(const char *default_item
, GList
*items
);
776 * pidgin_text_combo_box_entry_get_text:
777 * @widget: The simple text GtkComboBoxEntry equivalent widget
779 * Retrieve the text from the entry of the simple text GtkComboBoxEntry equivalent
781 * Returns: The text in the widget's entry. It must not be freed
783 const char *pidgin_text_combo_box_entry_get_text(GtkWidget
*widget
);
786 * pidgin_text_combo_box_entry_set_text:
787 * @widget: The simple text GtkComboBoxEntry equivalent widget
788 * @text: The text to set
790 * Set the text in the entry of the simple text GtkComboBoxEntry equivalent
792 void pidgin_text_combo_box_entry_set_text(GtkWidget
*widget
, const char *text
);
795 * pidgin_auto_parent_window:
796 * @window: The window to make transient.
798 * Automatically make a window transient to a suitable parent window.
800 * Returns: Whether the window was made transient or not.
802 gboolean
pidgin_auto_parent_window(GtkWidget
*window
);
805 * pidgin_add_widget_to_vbox:
806 * @vbox: The vertically-oriented GtkBox to add the widget to.
807 * @widget_label: The label to give the widget, can be %NULL.
808 * @sg: The GtkSizeGroup to add the label to, can be %NULL.
809 * @widget: The GtkWidget to add.
810 * @expand: Whether to expand the widget horizontally.
811 * @p_label: Place to store a pointer to the GtkLabel, or %NULL if you don't care.
813 * Add a labelled widget to a GtkBox
815 * Returns: A GtkBox already added to the GtkBox containing the GtkLabel and the GtkWidget.
817 GtkWidget
*pidgin_add_widget_to_vbox(GtkBox
*vbox
, const char *widget_label
, GtkSizeGroup
*sg
, GtkWidget
*widget
, gboolean expand
, GtkWidget
**p_label
);
820 * pidgin_pixbuf_from_data:
821 * @buf: The raw binary image data.
822 * @count: The length of buf in bytes.
824 * Create a GdkPixbuf from a chunk of image data.
826 * Returns: A GdkPixbuf created from the image data, or NULL if
827 * there was an error parsing the data.
829 GdkPixbuf
*pidgin_pixbuf_from_data(const guchar
*buf
, gsize count
);
832 * pidgin_pixbuf_anim_from_data:
833 * @buf: The raw binary image data.
834 * @count: The length of buf in bytes.
836 * Create a GdkPixbufAnimation from a chunk of image data.
838 * Returns: A GdkPixbufAnimation created from the image data, or NULL if
839 * there was an error parsing the data.
841 GdkPixbufAnimation
*pidgin_pixbuf_anim_from_data(const guchar
*buf
, gsize count
);
844 * pidgin_pixbuf_from_image:
845 * @image: a PurpleImage.
847 * Create a GdkPixbuf from a PurpleImage.
849 * Returns: a GdkPixbuf created from the @image.
852 pidgin_pixbuf_from_image(PurpleImage
*image
);
855 * pidgin_pixbuf_new_from_file:
856 * @filename: Name of file to load, in the GLib file name encoding
858 * Helper function that calls gdk_pixbuf_new_from_file() and checks both
859 * the return code and the GError and returns NULL if either one failed.
861 * The gdk-pixbuf documentation implies that it is sufficient to check
862 * the return value of gdk_pixbuf_new_from_file() to determine
863 * whether the image was able to be loaded. However, this is not the case
864 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
865 * cases a GdkPixbuf object is returned that will cause some operations
866 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
869 * This function shouldn't be necessary once Pidgin requires a version of
870 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
871 * nice to keep this function around for the debug message that it logs.
873 * Returns: The GdkPixbuf if successful. Otherwise NULL is returned and
874 * a warning is logged.
876 GdkPixbuf
*pidgin_pixbuf_new_from_file(const char *filename
);
879 * pidgin_pixbuf_new_from_file_at_size:
880 * @filename: Name of file to load, in the GLib file name encoding
881 * @width: The width the image should have or -1 to not constrain the width
882 * @height: The height the image should have or -1 to not constrain the height
884 * Helper function that calls gdk_pixbuf_new_from_file_at_size() and checks
885 * both the return code and the GError and returns NULL if either one failed.
887 * The gdk-pixbuf documentation implies that it is sufficient to check
888 * the return value of gdk_pixbuf_new_from_file_at_size() to determine
889 * whether the image was able to be loaded. However, this is not the case
890 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
891 * cases a GdkPixbuf object is returned that will cause some operations
892 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
895 * This function shouldn't be necessary once Pidgin requires a version of
896 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
897 * nice to keep this function around for the debug message that it logs.
899 * Returns: The GdkPixbuf if successful. Otherwise NULL is returned and
900 * a warning is logged.
902 GdkPixbuf
*pidgin_pixbuf_new_from_file_at_size(const char *filename
, int width
, int height
);
905 * pidgin_pixbuf_new_from_file_at_scale:
906 * @filename: Name of file to load, in the GLib file name encoding
907 * @width: The width the image should have or -1 to not constrain the width
908 * @height: The height the image should have or -1 to not constrain the height
909 * @preserve_aspect_ratio: TRUE to preserve the image's aspect ratio
911 * Helper function that calls gdk_pixbuf_new_from_file_at_scale() and checks
912 * both the return code and the GError and returns NULL if either one failed.
914 * The gdk-pixbuf documentation implies that it is sufficient to check
915 * the return value of gdk_pixbuf_new_from_file_at_scale() to determine
916 * whether the image was able to be loaded. However, this is not the case
917 * with gdk-pixbuf 2.23.3 and probably many earlier versions. In some
918 * cases a GdkPixbuf object is returned that will cause some operations
919 * (like gdk_pixbuf_scale_simple()) to rapidly consume memory in an
922 * This function shouldn't be necessary once Pidgin requires a version of
923 * gdk-pixbuf where the aforementioned bug is fixed. However, it might be
924 * nice to keep this function around for the debug message that it logs.
926 * Returns: The GdkPixbuf if successful. Otherwise NULL is returned and
927 * a warning is logged.
929 GdkPixbuf
*pidgin_pixbuf_new_from_file_at_scale(const char *filename
, int width
, int height
, gboolean preserve_aspect_ratio
);
932 * pidgin_pixbuf_scale_down:
933 * @src: The source image.
934 * @max_width: Maximum width in px.
935 * @max_height: Maximum height in px.
936 * @interp_type: Interpolation method.
937 * @preserve_ratio: %TRUE to preserve image's aspect ratio.
939 * Scales the image to the desired dimensions. If image is smaller, it will be
940 * returned without modifications.
942 * If new image is created, @src reference cound will be decreased and new image
943 * with a ref count of 1 will be returned.
945 * Returns: The image with proper sizing. %NULL in case of error.
948 pidgin_pixbuf_scale_down(GdkPixbuf
*src
, guint max_width
, guint max_height
,
949 GdkInterpType interp_type
, gboolean preserve_ratio
);
952 * pidgin_make_scrollable:
953 * @child: The child widget
954 * @hscrollbar_policy: Horizontal scrolling policy
955 * @vscrollbar_policy: Vertical scrolling policy
956 * @shadow_type: Shadow type
957 * @width: Desired widget width, or -1 for default
958 * @height: Desired widget height, or -1 for default
960 * Add scrollbars to a widget
962 GtkWidget
*pidgin_make_scrollable(GtkWidget
*child
, GtkPolicyType hscrollbar_policy
, GtkPolicyType vscrollbar_policy
, GtkShadowType shadow_type
, int width
, int height
);
967 * Initialize some utility functions.
969 void pidgin_utils_init(void);
972 * pidgin_utils_uninit:
974 * Uninitialize some utility functions.
976 void pidgin_utils_uninit(void);
980 #endif /* _PIDGINUTILS_H_ */