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
00121 GtkWidget *pidgin_create_window(const char *title, guint border_width, const char *role, gboolean resizable);
00122
00133 GtkWidget *pidgin_create_dialog(const char *title, guint border_width, const char *role, gboolean resizable);
00134
00144 GtkWidget *pidgin_dialog_get_vbox_with_properties(GtkDialog *dialog, gboolean homogeneous, gint spacing);
00145
00153 GtkWidget *pidgin_dialog_get_vbox(GtkDialog *dialog);
00154
00166 GtkWidget *pidgin_dialog_add_button(GtkDialog *dialog, const char *label,
00167         GCallback callback, gpointer callbackdata);
00168
00176 GtkWidget *pidgin_dialog_get_action_area(GtkDialog *dialog);
00177
00184 void pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle);
00185
00194 void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog);
00195
00202 void pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data);
00203
00210 void pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle);
00211
00219 GtkWidget *pidgin_separator(GtkWidget *menu);
00220
00229 GtkWidget *pidgin_new_item(GtkWidget *menu, const char *str);
00230
00242 GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str,
00243         GCallback cb, gpointer data, gboolean checked);
00244
00260 GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str,
00261                                     const char *icon, GCallback cb,
00262                                     gpointer data, guint accel_key,
00263                                     guint accel_mods, char *mod);
00264
00274 GtkWidget *pidgin_pixbuf_button_from_stock(const char *text, const char *icon,
00275                                          PidginButtonOrientation style);
00276
00284 GtkWidget *pidgin_pixbuf_toolbar_button_from_stock(const char *stock);
00285
00294 GtkWidget *pidgin_make_frame(GtkWidget *parent, const char *title);
00295
00305 GtkWidget *pidgin_protocol_option_menu_new(const char *id,
00306                                              GCallback cb,
00307                                              gpointer user_data);
00308
00316 const char *pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu);
00317
00331 GtkWidget *pidgin_account_option_menu_new(PurpleAccount *default_account,
00332         gboolean show_all, GCallback cb,
00333         PurpleFilterAccountFunc filter_func, gpointer user_data);
00334
00342 PurpleAccount *pidgin_account_option_menu_get_selected(GtkWidget *optmenu);
00343
00351 void pidgin_account_option_menu_set_selected(GtkWidget *optmenu, PurpleAccount *account);
00352
00364 void pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *optmenu, PidginFilterBuddyCompletionEntryFunc filter_func, gpointer user_data);
00365
00374 gboolean pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry *completion_entry, gpointer all_accounts);
00375
00392 void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all);
00393
00404 gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel);
00405
00414 void pidgin_setup_gtkspell(GtkTextView *textview);
00415
00419 void pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
00420                              GdkModifierType arg2, GClosure *arg3,
00421                              gpointer data);
00422
00426 gboolean pidgin_save_accels(gpointer data);
00427
00431 void pidgin_load_accels(void);
00432
00441 void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name);
00442
00452 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid);
00453
00470 gboolean pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts,
00471                                      PurpleAccount **ret_account,
00472                                      char **ret_protocol, char **ret_username,
00473                                      char **ret_alias);
00474
00482 void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l);
00483
00492 void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l);
00493
00508 void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y,
00509                                         gboolean *push_in, gpointer data);
00510
00526 void pidgin_treeview_popup_menu_position_func(GtkMenu *menu,
00527                                                 gint *x,
00528                                                 gint *y,
00529                                                 gboolean *push_in,
00530                                                 gpointer user_data);
00531
00539 void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who);
00540
00544 void pidgin_buddy_icon_get_scale_size(GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height);
00545
00560 GdkPixbuf *pidgin_create_prpl_icon(PurpleAccount *account, PidginPrplIconSize size);
00561
00570 GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget *w, const char *size);
00571
00581 const char *pidgin_stock_id_from_status_primitive(PurpleStatusPrimitive prim);
00582
00592 const char *pidgin_stock_id_from_presence(PurplePresence *presence);
00593
00603 GtkWidget *pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act,
00604                                  gpointer gobject);
00605
00617 void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type);
00618
00628 void pidgin_clear_cursor(GtkWidget *widget);
00629
00638 GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char*,gpointer), gpointer data);
00639
00649 gpointer pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len);
00650
00651 #if !(defined PIDGIN_DISABLE_DEPRECATED) || (defined _PIDGIN_GTKUTILS_C_)
00652 
00661 void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename);
00662 #endif
00663 
00671 char *pidgin_make_pretty_arrows(const char *str);
00672
00676 typedef void (*PidginUtilMiniDialogCallback)(gpointer user_data, GtkButton *);
00677
00703 GtkWidget *pidgin_make_mini_dialog(PurpleConnection *handle,
00704     const char* stock_id, const char *primary, const char *secondary,
00705     void *user_data, ...) G_GNUC_NULL_TERMINATED;
00706
00715 gboolean pidgin_tree_view_search_equal_func(GtkTreeModel *model, gint column,
00716             const gchar *key, GtkTreeIter *iter, gpointer data);
00717
00725 void pidgin_set_urgent(GtkWindow *window, gboolean urgent);
00726
00734 gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf);
00735
00741 void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf);
00742
00750 const char *pidgin_get_dim_grey_string(GtkWidget *widget);
00751
00763 GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items);
00764
00774 const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget);
00775
00784 void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text);
00785
00795 gboolean pidgin_auto_parent_window(GtkWidget *window);
00796
00810 GtkWidget *pidgin_add_widget_to_vbox(GtkBox *vbox, const char *widget_label, GtkSizeGroup *sg, GtkWidget *widget, gboolean expand, GtkWidget **p_label);
00811
00821 GdkPixbuf *pidgin_pixbuf_from_imgstore(PurpleStoredImage *image);
00822
00828 void pidgin_utils_init(void);
00829
00835 void pidgin_utils_uninit(void);
00836
00837 #endif /* _PIDGINUTILS_H_ */
00838