gtkutils.h

Go to the documentation of this file.
00001 
00006 /* pidgin
00007  *
00008  * Pidgin is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PIDGINUTILS_H_
00027 #define _PIDGINUTILS_H_
00028 
00029 #include "gtkconv.h"
00030 #include "pidgin.h"
00031 #include "prpl.h"
00032 #include "util.h"
00033 
00034 
00035 
00036 
00037 
00038 typedef enum
00039 {
00040     PIDGIN_BUTTON_HORIZONTAL,
00041     PIDGIN_BUTTON_VERTICAL
00042 
00043 } PidginButtonOrientation;
00044 
00045 typedef enum
00046 {
00047     PIDGIN_BUTTON_NONE = 0,
00048     PIDGIN_BUTTON_TEXT,
00049     PIDGIN_BUTTON_IMAGE,
00050     PIDGIN_BUTTON_TEXT_IMAGE
00051 
00052 } PidginButtonStyle;
00053 
00054 typedef enum
00055 {
00056     PIDGIN_PRPL_ICON_SMALL,
00057     PIDGIN_PRPL_ICON_MEDIUM,
00058     PIDGIN_PRPL_ICON_LARGE
00059 } PidginPrplIconSize;
00060 
00061 #ifndef _WIN32
00062 typedef enum
00063 {
00064     PIDGIN_BROWSER_DEFAULT = 0,
00065     PIDGIN_BROWSER_CURRENT,
00066     PIDGIN_BROWSER_NEW_WINDOW,
00067     PIDGIN_BROWSER_NEW_TAB
00068 
00069 } PidginBrowserPlace;
00070 #endif /* _WIN32 */
00071 
00072 typedef struct {
00073     gboolean is_buddy;
00074     union {
00075         PurpleBuddy *buddy;
00076         PurpleLogSet *logged_buddy;
00077     } entry;
00078 } PidginBuddyCompletionEntry;
00079 
00080 typedef gboolean (*PidginFilterBuddyCompletionEntryFunc) (const PidginBuddyCompletionEntry *completion_entry, gpointer user_data);
00081 
00082 
00089 void pidgin_setup_imhtml(GtkWidget *imhtml);
00090 
00109 GtkWidget *pidgin_create_imhtml(gboolean editable, GtkWidget **imhtml_ret, GtkWidget **toolbar_ret, GtkWidget **sw_ret);
00110 
00119 GtkWidget *pidgin_create_small_button(GtkWidget *image);
00120 
00131 GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable);
00132 
00143 GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable);
00144 
00154 GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing);
00155 
00163 GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog);
00164 
00176 GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
00177         GCallback callback, gpointer callbackdata);
00178 
00186 GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog);
00187 
00194 void pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle);
00195 
00204 void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog);
00205 
00212 void pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data);
00213 
00220 void pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle);
00221 
00229 GtkWidget *pidgin_separator(GtkWidget *menu);
00230 
00239 GtkWidget *pidgin_new_item(GtkWidget *menu, const char *str);
00240 
00252 GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str,
00253         GCallback cb, gpointer data, gboolean checked);
00254 
00270 GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str,
00271                                     const char *icon, GCallback cb,
00272                                     gpointer data, guint accel_key,
00273                                     guint accel_mods, char *mod);
00274 
00284 GtkWidget *pidgin_pixbuf_button_from_stock(const char *text, const char *icon,
00285                                          PidginButtonOrientation style);
00286 
00294 GtkWidget *pidgin_pixbuf_toolbar_button_from_stock(const char *stock);
00295 
00304 GtkWidget *pidgin_make_frame(GtkWidget *parent, const char *title);
00305 
00315 GtkWidget *pidgin_protocol_option_menu_new(const char *id,
00316                                              GCallback cb,
00317                                              gpointer user_data);
00318 
00326 const char *pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu);
00327 
00341 GtkWidget *pidgin_account_option_menu_new(PurpleAccount *default_account,
00342         gboolean show_all, GCallback cb,
00343         PurpleFilterAccountFunc filter_func, gpointer user_data);
00344 
00352 PurpleAccount *pidgin_account_option_menu_get_selected(GtkWidget *optmenu);
00353 
00361 void pidgin_account_option_menu_set_selected(GtkWidget *optmenu, PurpleAccount *account);
00362 
00374 void pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *optmenu, PidginFilterBuddyCompletionEntryFunc filter_func, gpointer user_data);
00375 
00384 gboolean pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry *completion_entry, gpointer all_accounts);
00385 
00402 void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all);
00403 
00414 gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel);
00415 
00424 void pidgin_setup_gtkspell(GtkTextView *textview);
00425 
00429 void pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
00430                              GdkModifierType arg2, GClosure *arg3,
00431                              gpointer data);
00432 
00436 gboolean pidgin_save_accels(gpointer data);
00437 
00441 void pidgin_load_accels(void);
00442 
00451 void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name);
00452 
00462 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid);
00463 
00480 gboolean pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts,
00481                                      PurpleAccount **ret_account,
00482                                      char **ret_protocol, char **ret_username,
00483                                      char **ret_alias);
00484 
00492 void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l);
00493 
00502 void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l);
00503 
00518 void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y,
00519                                         gboolean *push_in, gpointer data);
00520 
00536 void pidgin_treeview_popup_menu_position_func(GtkMenu *menu,
00537                                                 gint *x,
00538                                                 gint *y,
00539                                                 gboolean *push_in,
00540                                                 gpointer user_data);
00541 
00549 void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who);
00550 
00554 void pidgin_buddy_icon_get_scale_size(GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height);
00555 
00570 GdkPixbuf *pidgin_create_prpl_icon(PurpleAccount *account, PidginPrplIconSize size);
00571 
00580 GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget *w, const char *size);
00581 
00591 const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim);
00592 
00602 const char *pidgin_stock_id_from_presence(PurplePresence *presence);
00603 
00613 GtkWidget *pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act,
00614                                  gpointer gobject);
00615 
00627 void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type);
00628 
00638 void pidgin_clear_cursor(GtkWidget *widget);
00639 
00648 GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char*,gpointer), gpointer data);
00649 
00659 gpointer pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len);
00660 
00661 #if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKUTILS_C_)
00662 
00671 void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename);
00672 #endif
00673 
00681 char *pidgin_make_pretty_arrows(const char *str);
00682 
00686 typedef void (*PidginUtilMiniDialogCallback)(gpointer user_data, GtkButton *);
00687 
00713 GtkWidget *pidgin_make_mini_dialog(PurpleConnection *handle,
00714     const char* stock_id, const char *primary, const char *secondary,
00715     void *user_data, ...) G_GNUC_NULL_TERMINATED;
00716 
00725 gboolean pidgin_tree_view_search_equal_func(GtkTreeModel *model, gint column,
00726             const gchar *key, GtkTreeIter *iter, gpointer data);
00727 
00735 void pidgin_set_urgent(GtkWindow *window, gboolean urgent);
00736 
00744 gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf);
00745 
00751 void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf);
00752 
00760 const char *pidgin_get_dim_grey_string(GtkWidget *widget);
00761 
00773 GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items);
00774 
00784 const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget);
00785 
00794 void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text);
00795 
00805 gboolean pidgin_auto_parent_window(GtkWidget *window);
00806 
00820 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label);
00821 
00831 GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image);
00832 
00838 void pidgin_utils_init(void);
00839 
00845 void pidgin_utils_uninit(void);
00846 
00847 gchar *pidgin_gtk_ellipsis_text(GtkWidget *widget, const char *text, gint min_width, gchar *ellipsis);
00848 
00849 #endif /* _PIDGINUTILS_H_ */
00850