#include "gtkconv.h"
#include "pidgin.h"
#include "prpl.h"
#include "util.h"
Include dependency graph for gtkutils.h:
Go to the source code of this file.
Enumerations | |
enum | PidginBrowserPlace { PIDGIN_BROWSER_DEFAULT = 0, PIDGIN_BROWSER_CURRENT, PIDGIN_BROWSER_NEW_WINDOW, PIDGIN_BROWSER_NEW_TAB } |
enum | PidginButtonOrientation { PIDGIN_BUTTON_HORIZONTAL, PIDGIN_BUTTON_VERTICAL } |
enum | PidginButtonStyle { PIDGIN_BUTTON_NONE = 0, PIDGIN_BUTTON_TEXT, PIDGIN_BUTTON_IMAGE, PIDGIN_BUTTON_TEXT_IMAGE } |
enum | PidginPrplIconSize { PIDGIN_PRPL_ICON_SMALL, PIDGIN_PRPL_ICON_MEDIUM, PIDGIN_PRPL_ICON_LARGE } |
Functions | |
GdkPixbuf * | gdk_pixbuf_new_from_file_at_scale (const char *filename, int width, int height, gboolean preserve_aspect_ratio, GError **error) |
Creates a new pixbuf by loading an image from a file. | |
GtkTreePath * | gtk_tree_path_new_from_indices (gint first_index,...) |
This is copied from Gtk to support Gtk 2.0. | |
PurpleAccount * | pidgin_account_option_menu_get_selected (GtkWidget *optmenu) |
Gets the currently selected account from an account drop down box. | |
GtkWidget * | pidgin_account_option_menu_new (PurpleAccount *default_account, gboolean show_all, GCallback cb, PurpleFilterAccountFunc filter_func, gpointer user_data) |
Creates a drop-down option menu filled with accounts. | |
void | pidgin_account_option_menu_set_selected (GtkWidget *optmenu, PurpleAccount *account) |
Sets the currently selected account for an account drop down box. | |
void | pidgin_append_menu_action (GtkWidget *menu, PurpleMenuAction *act, gpointer gobject) |
Append a PurpleMenuAction to a menu. | |
GtkWidget * | pidgin_buddy_icon_chooser_new (GtkWindow *parent, void(*callback)(const char *, gpointer), gpointer data) |
Creates a File Selection widget for choosing a buddy icon. | |
void | pidgin_buddy_icon_get_scale_size (GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height) |
Convenience wrapper for purple_buddy_icon_get_scale_size. | |
gboolean | pidgin_check_if_dir (const char *path, GtkFileSelection *filesel) |
Check if the given path is a directory or not. | |
void | pidgin_clear_cursor (GtkWidget *widget) |
Sets the mouse point for a GtkWidget back to that of its parent window. | |
gpointer | pidgin_convert_buddy_icon (PurplePlugin *plugin, const char *path, size_t *len) |
Converts a buddy icon to the required size and format. | |
GtkWidget * | pidgin_create_imhtml (gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret) |
Create an GtkIMHtml widget and associated GtkIMHtmlToolbar widget. | |
GdkPixbuf * | pidgin_create_prpl_icon (PurpleAccount *account, PidginPrplIconSize size) |
Returns the base image to represent the account, based on the currently selected theme. | |
GdkPixbuf * | pidgin_create_status_icon (PurpleStatusPrimitive primitive, GtkWidget *w, const char *size) |
Creates a status icon for a given primitve. | |
void | pidgin_dnd_file_manage (GtkSelectionData *sd, PurpleAccount *account, const char *who) |
Manages drag'n'drop of files. | |
gboolean | pidgin_gdk_pixbuf_is_opaque (GdkPixbuf *pixbuf) |
Returns TRUE if the GdkPixbuf is opaque, as determined by no alpha at any of the edge pixels. | |
gchar * | pidgin_gtk_ellipsis_text (GtkWidget *widget, const char *text, gint min_width, gchar *ellipsis) |
void | pidgin_load_accels (void) |
Load menu accelerators. | |
GtkWidget * | pidgin_make_frame (GtkWidget *parent, const char *title) |
Creates a HIG preferences frame. | |
void * | pidgin_make_mini_dialog (PurpleConnection *handle, const char *stock_id, const char *primary, const char *secondary, void *user_data,...) |
Creates a "mini-dialog" suitable for embedding in the buddy list scrollbook. | |
char * | pidgin_make_pretty_arrows (const char *str) |
Converts "->" and "<-" in strings to Unicode arrow characters, for use in referencing menu items. | |
GtkWidget * | pidgin_new_check_item (GtkWidget *menu, const char *str, GtkSignalFunc sf, gpointer data, gboolean checked) |
Creates a check menu item. | |
GtkWidget * | pidgin_new_item (GtkWidget *menu, const char *str) |
Creates a menu item. | |
GtkWidget * | pidgin_new_item_from_stock (GtkWidget *menu, const char *str, const char *icon, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) |
Creates a menu item. | |
gboolean | pidgin_parse_x_im_contact (const char *msg, gboolean all_accounts, PurpleAccount **ret_account, char **ret_protocol, char **ret_username, char **ret_alias) |
Parses an application/x-im-contact MIME message and returns the data inside. | |
GtkWidget * | pidgin_pixbuf_button_from_stock (const char *text, const char *icon, PidginButtonOrientation style) |
Creates a button with the specified text and stock icon. | |
GtkWidget * | pidgin_pixbuf_toolbar_button_from_stock (const char *stock) |
Creates a toolbar button with the stock icon. | |
GtkWidget * | pidgin_protocol_option_menu_new (const char *id, GCallback cb, gpointer user_data) |
Creates a drop-down option menu filled with protocols. | |
gboolean | pidgin_save_accels (gpointer data) |
Save menu accelerators. | |
void | pidgin_save_accels_cb (GtkAccelGroup *accel_group, guint arg1, GdkModifierType arg2, GClosure *arg3, gpointer data) |
Save menu accelerators callback. | |
void | pidgin_separator (GtkWidget *menu) |
Adds a separator to a menu. | |
void | pidgin_set_accessible_label (GtkWidget *w, GtkWidget *l) |
Sets an ATK name for a given widget. | |
void | pidgin_set_cursor (GtkWidget *widget, GdkCursorType cursor_type) |
Sets the mouse pointer for a GtkWidget. | |
void | pidgin_set_custom_buddy_icon (PurpleAccount *account, const char *who, const char *filename) |
Set or unset a custom buddyicon for a user. | |
void | pidgin_set_sensitive_if_input (GtkWidget *entry, GtkWidget *dialog) |
Checks if text has been entered into a GtkTextEntry widget. | |
void | pidgin_set_urgent (GtkWindow *window, gboolean urgent) |
Sets or resets a window to 'urgent,' by setting the URGENT hint in X or blinking in the win32 taskbar. | |
void | pidgin_setup_gtkspell (GtkTextView *textview) |
Sets up GtkSpell for the given GtkTextView, reporting errors if encountered. | |
void | pidgin_setup_imhtml (GtkWidget *imhtml) |
Sets up a gtkimhtml widget, loads it with smileys, and sets the default signal handlers. | |
void | pidgin_setup_screenname_autocomplete (GtkWidget *entry, GtkWidget *optmenu, gboolean all) |
Add autocompletion of screenames to an entry. | |
void | pidgin_toggle_sensitive (GtkWidget *widget, GtkWidget *to_toggle) |
Toggles the sensitivity of a widget. | |
void | pidgin_toggle_sensitive_array (GtkWidget *w, GPtrArray *data) |
Toggles the sensitivity of all widgets in a pointer array. | |
void | pidgin_toggle_showhide (GtkWidget *widget, GtkWidget *to_toggle) |
Toggles the visibility of a widget. | |
gboolean | pidgin_tree_view_search_equal_func (GtkTreeModel *model, gint column, const gchar *key, GtkTreeIter *iter, gpointer data) |
This is a callback function to be used for Ctrl+F searching in treeviews. | |
void | pidgin_treeview_popup_menu_position_func (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data) |
A valid GtkMenuPositionFunc. |
pidgin
Pidgin is the legal property of its developers, whose names are too numerous to list here. Please refer to the COPYRIGHT file distributed with this source distribution.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Definition in file gtkutils.h.
enum PidginBrowserPlace |
PIDGIN_BROWSER_DEFAULT | |
PIDGIN_BROWSER_CURRENT | |
PIDGIN_BROWSER_NEW_WINDOW | |
PIDGIN_BROWSER_NEW_TAB |
Definition at line 57 of file gtkutils.h.
Definition at line 33 of file gtkutils.h.
enum PidginButtonStyle |
Definition at line 40 of file gtkutils.h.
enum PidginPrplIconSize |
Definition at line 49 of file gtkutils.h.
GdkPixbuf* gdk_pixbuf_new_from_file_at_scale | ( | const char * | filename, | |
int | width, | |||
int | height, | |||
gboolean | preserve_aspect_ratio, | |||
GError ** | error | |||
) |
Creates a new pixbuf by loading an image from a file.
The image will be scaled to fit in the requested size, optionally preserving the image's aspect ratio.
GtkTreePath* gtk_tree_path_new_from_indices | ( | gint | first_index, | |
... | ||||
) |
This is copied from Gtk to support Gtk 2.0.
Creates a new path with first_index and the varargs as indices.
first_index | first integer | |
... | list of integers terminated by -1 |
PurpleAccount* pidgin_account_option_menu_get_selected | ( | GtkWidget * | optmenu | ) |
Gets the currently selected account from an account drop down box.
optmenu | The GtkOptionMenu created by pidgin_account_option_menu_new. |
GtkWidget* pidgin_account_option_menu_new | ( | PurpleAccount * | default_account, | |
gboolean | show_all, | |||
GCallback | cb, | |||
PurpleFilterAccountFunc | filter_func, | |||
gpointer | user_data | |||
) |
Creates a drop-down option menu filled with accounts.
default_account | The account to select by default. | |
show_all | Whether or not to show all accounts, or just active accounts. | |
cb | The callback to call when an account is selected. | |
filter_func | A function for checking if an account should be shown. This can be NULL. | |
user_data | Data to pass to the callback function. |
void pidgin_account_option_menu_set_selected | ( | GtkWidget * | optmenu, | |
PurpleAccount * | account | |||
) |
Sets the currently selected account for an account drop down box.
optmenu | The GtkOptionMenu created by pidgin_account_option_menu_new. | |
account | The PurpleAccount to select. |
void pidgin_append_menu_action | ( | GtkWidget * | menu, | |
PurpleMenuAction * | act, | |||
gpointer | gobject | |||
) |
Append a PurpleMenuAction to a menu.
menu | The menu to append to. | |
act | The PurpleMenuAction to append. | |
gobject | The object to be passed to the action callback. |
GtkWidget* pidgin_buddy_icon_chooser_new | ( | GtkWindow * | parent, | |
void(*)(const char *, gpointer) | callback, | |||
gpointer | data | |||
) |
Creates a File Selection widget for choosing a buddy icon.
parent | The parent window | |
callback | The callback to call when the window is closed. If the user chose an icon, the char* argument will point to its path | |
data | Data to pass to callback |
gboolean pidgin_check_if_dir | ( | const char * | path, | |
GtkFileSelection * | filesel | |||
) |
Check if the given path is a directory or not.
If it is, then modify the given GtkFileSelection dialog so that it displays the given path. If the given path is not a directory, then do nothing.
path | The path entered in the file selection window by the user. | |
filesel | The file selection window. |
void pidgin_clear_cursor | ( | GtkWidget * | widget | ) |
Sets the mouse point for a GtkWidget back to that of its parent window.
If widget is NULL
, this function simply returns.
If the window for widget is NULL
, this function simply returns.
gpointer pidgin_convert_buddy_icon | ( | PurplePlugin * | plugin, | |
const char * | path, | |||
size_t * | len | |||
) |
Converts a buddy icon to the required size and format.
plugin | The prpl to convert the icon | |
path | The path of a file to convert | |
len | If not NULL , the length of the returned data will be set here. |
NULL
if an error occurred. GtkWidget* pidgin_create_imhtml | ( | gboolean | editable, | |
GtkWidget ** | imhtml_ret, | |||
GtkWidget ** | toolbar_ret, | |||
GtkWidget ** | sw_ret | |||
) |
Create an GtkIMHtml widget and associated GtkIMHtmlToolbar widget.
This functions puts both widgets in a nice GtkFrame. They're separate by an attractive GtkSeparator.
editable | TRUE if this imhtml should be editable. If this is FALSE , then the toolbar will NOT be created. If this imthml should be read-only at first, but may become editable later, then pass in TRUE here and then manually call gtk_imhtml_set_editable() later. | |
imhtml_ret | A pointer to a pointer to a GtkWidget. This pointer will be set to the imhtml when this function exits. | |
toolbar_ret | A pointer to a pointer to a GtkWidget. If editable is TRUE then this will be set to the toolbar when this function exits. Otherwise this will be set to NULL . | |
sw_ret | This will be filled with a pointer to the scrolled window widget which contains the imhtml. |
GdkPixbuf* pidgin_create_prpl_icon | ( | PurpleAccount * | account, | |
PidginPrplIconSize | size | |||
) |
Returns the base image to represent the account, based on the currently selected theme.
account | The account. | |
size | The size of the icon to return. |
GdkPixbuf* pidgin_create_status_icon | ( | PurpleStatusPrimitive | primitive, | |
GtkWidget * | w, | |||
const char * | size | |||
) |
Creates a status icon for a given primitve.
primitive | The status primitive | |
w | The widget to render this | |
size | The icon size to render at |
void pidgin_dnd_file_manage | ( | GtkSelectionData * | sd, | |
PurpleAccount * | account, | |||
const char * | who | |||
) |
Manages drag'n'drop of files.
sd | GtkSelectionData for managing drag'n'drop | |
account | Account to be used (may be NULL if conv is not NULL) | |
who | Buddy name (may be NULL if conv is not NULL) |
gboolean pidgin_gdk_pixbuf_is_opaque | ( | GdkPixbuf * | pixbuf | ) |
Returns TRUE if the GdkPixbuf is opaque, as determined by no alpha at any of the edge pixels.
pixbuf | The pixbug |
GtkWidget* pidgin_make_frame | ( | GtkWidget * | parent, | |
const char * | title | |||
) |
Creates a HIG preferences frame.
parent | The widget to put the frame into. | |
title | The title for the frame. |
void* pidgin_make_mini_dialog | ( | PurpleConnection * | handle, | |
const char * | stock_id, | |||
const char * | primary, | |||
const char * | secondary, | |||
void * | user_data, | |||
... | ||||
) |
Creates a "mini-dialog" suitable for embedding in the buddy list scrollbook.
handle | A handle | |
stock_id | The ID of a stock image to use in the mini dialog | |
primary | The primary text | |
secondary | The secondary text | |
user_data | Data to pass to the callbacks | |
... | a NULL-terminated list of button labels and callbacks |
char* pidgin_make_pretty_arrows | ( | const char * | str | ) |
Converts "->" and "<-" in strings to Unicode arrow characters, for use in referencing menu items.
str | The text to convert |
GtkWidget* pidgin_new_check_item | ( | GtkWidget * | menu, | |
const char * | str, | |||
GtkSignalFunc | sf, | |||
gpointer | data, | |||
gboolean | checked | |||
) |
Creates a check menu item.
menu | The menu to which to append the check menu item. | |
str | The title to use for the newly created menu item. | |
sf | A function to call when the menu item is activated. | |
data | Data to pass to the signal function. | |
checked | The initial state of the check item |
GtkWidget* pidgin_new_item | ( | GtkWidget * | menu, | |
const char * | str | |||
) |
Creates a menu item.
menu | The menu to which to append the menu item. | |
str | The title to use for the newly created menu item. |
GtkWidget* pidgin_new_item_from_stock | ( | GtkWidget * | menu, | |
const char * | str, | |||
const char * | icon, | |||
GtkSignalFunc | sf, | |||
gpointer | data, | |||
guint | accel_key, | |||
guint | accel_mods, | |||
char * | mod | |||
) |
Creates a menu item.
menu | The menu to which to append the menu item. | |
str | The title for the menu item. | |
icon | An icon to place to the left of the menu item, or NULL for no icon. | |
sf | A function to call when the menu item is activated. | |
data | Data to pass to the signal function. | |
accel_key | Something. | |
accel_mods | Something. | |
mod | Something. |
gboolean pidgin_parse_x_im_contact | ( | const char * | msg, | |
gboolean | all_accounts, | |||
PurpleAccount ** | ret_account, | |||
char ** | ret_protocol, | |||
char ** | ret_username, | |||
char ** | ret_alias | |||
) |
Parses an application/x-im-contact MIME message and returns the data inside.
msg | The MIME message. | |
all_accounts | If TRUE, check all compatible accounts, online or offline. If FALSE, check only online accounts. | |
ret_account | The best guess at a compatible protocol, based on ret_protocol. If NULL, no account was found. | |
ret_protocol | The returned protocol type. | |
ret_username | The returned username. | |
ret_alias | The returned alias. |
GtkWidget* pidgin_pixbuf_button_from_stock | ( | const char * | text, | |
const char * | icon, | |||
PidginButtonOrientation | style | |||
) |
Creates a button with the specified text and stock icon.
text | The text for the button. | |
icon | The stock icon name. | |
style | The orientation of the button. |
GtkWidget* pidgin_pixbuf_toolbar_button_from_stock | ( | const char * | stock | ) |
Creates a toolbar button with the stock icon.
stock | The stock icon name. |
GtkWidget* pidgin_protocol_option_menu_new | ( | const char * | id, | |
GCallback | cb, | |||
gpointer | user_data | |||
) |
void pidgin_separator | ( | GtkWidget * | menu | ) |
Adds a separator to a menu.
menu | The menu to add a separator to. |
void pidgin_set_accessible_label | ( | GtkWidget * | w, | |
GtkWidget * | l | |||
) |
Sets an ATK name for a given widget.
Also sets the labelled-by and label-for ATK relationships.
w | The widget that we want to name. | |
l | A GtkLabel that we want to use as the ATK name for the widget. |
void pidgin_set_cursor | ( | GtkWidget * | widget, | |
GdkCursorType | cursor_type | |||
) |
Sets the mouse pointer for a GtkWidget.
After setting the cursor, the display is flushed, so the change will take effect immediately.
If the window for widget is NULL
, this function simply returns.
widget | The widget for which to set the mouse pointer | |
cursor_type | The type of cursor to set |
void pidgin_set_custom_buddy_icon | ( | PurpleAccount * | account, | |
const char * | who, | |||
const char * | filename | |||
) |
Set or unset a custom buddyicon for a user.
account | The account the user belongs to. | |
who | The name of the user. | |
filename | The path of the custom icon. If this is NULL , then any previously set custom buddy icon for the user is removed. |
void pidgin_set_sensitive_if_input | ( | GtkWidget * | entry, | |
GtkWidget * | dialog | |||
) |
Checks if text has been entered into a GtkTextEntry widget.
If so, the GTK_RESPONSE_OK on the given dialog is set to TRUE. Otherwise GTK_RESPONSE_OK is set to FALSE.
entry | The text entry widget. | |
dialog | The dialog containing the text entry widget. |
void pidgin_set_urgent | ( | GtkWindow * | window, | |
gboolean | urgent | |||
) |
Sets or resets a window to 'urgent,' by setting the URGENT hint in X or blinking in the win32 taskbar.
window | The window to draw attention to | |
urgent | Whether to set the urgent hint or not |
void pidgin_setup_gtkspell | ( | GtkTextView * | textview | ) |
Sets up GtkSpell for the given GtkTextView, reporting errors if encountered.
This does nothing if Pidgin is not compiled with GtkSpell support.
textview | The textview widget to setup spellchecking for. |
void pidgin_setup_imhtml | ( | GtkWidget * | imhtml | ) |
Sets up a gtkimhtml widget, loads it with smileys, and sets the default signal handlers.
imhtml | The gtkimhtml widget to setup. |
void pidgin_setup_screenname_autocomplete | ( | GtkWidget * | entry, | |
GtkWidget * | optmenu, | |||
gboolean | all | |||
) |
Add autocompletion of screenames to an entry.
entry | The GtkEntry on which to setup autocomplete. | |
optmenu | A menu for accounts, returned by pidgin_account_option_menu_new(). If optmenu is not NULL , it'll be updated when a screenname is chosen from the autocomplete list. | |
all | Whether to include screennames from disconnected accounts. |
void pidgin_toggle_sensitive | ( | GtkWidget * | widget, | |
GtkWidget * | to_toggle | |||
) |
Toggles the sensitivity of a widget.
widget | NULL . Used for signal handlers. | |
to_toggle | The widget to toggle. |
void pidgin_toggle_sensitive_array | ( | GtkWidget * | w, | |
GPtrArray * | data | |||
) |
Toggles the sensitivity of all widgets in a pointer array.
w | NULL . Used for signal handlers. | |
data | The array containing the widgets to toggle. |
void pidgin_toggle_showhide | ( | GtkWidget * | widget, | |
GtkWidget * | to_toggle | |||
) |
Toggles the visibility of a widget.
widget | NULL . Used for signal handlers. | |
to_toggle | The widget to toggle. |
gboolean pidgin_tree_view_search_equal_func | ( | GtkTreeModel * | model, | |
gint | column, | |||
const gchar * | key, | |||
GtkTreeIter * | iter, | |||
gpointer | data | |||
) |
This is a callback function to be used for Ctrl+F searching in treeviews.
Sample Use: gtk_tree_view_set_search_equal_func(treeview, pidgin_tree_view_search_equal_func, search_data, search_data_destroy_cb);
void pidgin_treeview_popup_menu_position_func | ( | GtkMenu * | menu, | |
gint * | x, | |||
gint * | y, | |||
gboolean * | push_in, | |||
gpointer | user_data | |||
) |
A valid GtkMenuPositionFunc.
This is used to determine where to draw context menu's when the menu is activated with the keyboard (shift+F10). If the menu is activated with the mouse, then you should just use GTK's built-in position function, because it does a better job of positioning the menu.
menu | The menu we are positioning. | |
x | Address of the gint representing the horizontal position where the menu shall be drawn. This is an output parameter. | |
y | Address of the gint representing the vertical position where the menu shall be drawn. This is an output parameter. | |
push_in | This is an output parameter? | |
user_data | Not used by this particular position function. |