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 
00129 void pidgin_toggle_sensitive(GtkWidget *widget, GtkWidget *to_toggle);
00130 
00139 void pidgin_set_sensitive_if_input(GtkWidget *entry, GtkWidget *dialog);
00140 
00147 void pidgin_toggle_sensitive_array(GtkWidget *w, GPtrArray *data);
00148 
00155 void pidgin_toggle_showhide(GtkWidget *widget, GtkWidget *to_toggle);
00156 
00164 GtkWidget *pidgin_separator(GtkWidget *menu);
00165 
00174 GtkWidget *pidgin_new_item(GtkWidget *menu, const char *str);
00175 
00187 GtkWidget *pidgin_new_check_item(GtkWidget *menu, const char *str,
00188         GtkSignalFunc sf, gpointer data, gboolean checked);
00189 
00205 GtkWidget *pidgin_new_item_from_stock(GtkWidget *menu, const char *str,
00206                                     const char *icon, GtkSignalFunc sf,
00207                                     gpointer data, guint accel_key,
00208                                     guint accel_mods, char *mod);
00209 
00219 GtkWidget *pidgin_pixbuf_button_from_stock(const char *text, const char *icon,
00220                                          PidginButtonOrientation style);
00221 
00229 GtkWidget *pidgin_pixbuf_toolbar_button_from_stock(const char *stock);
00230 
00239 GtkWidget *pidgin_make_frame(GtkWidget *parent, const char *title);
00240 
00250 GtkWidget *pidgin_protocol_option_menu_new(const char *id,
00251                                              GCallback cb,
00252                                              gpointer user_data);
00253 
00261 const char *pidgin_protocol_option_menu_get_selected(GtkWidget *optmenu);
00262 
00276 GtkWidget *pidgin_account_option_menu_new(PurpleAccount *default_account,
00277         gboolean show_all, GCallback cb,
00278         PurpleFilterAccountFunc filter_func, gpointer user_data);
00279 
00287 PurpleAccount *pidgin_account_option_menu_get_selected(GtkWidget *optmenu);
00288 
00296 void pidgin_account_option_menu_set_selected(GtkWidget *optmenu, PurpleAccount *account);
00297 
00309 void pidgin_setup_screenname_autocomplete_with_filter(GtkWidget *entry, GtkWidget *optmenu, PidginFilterBuddyCompletionEntryFunc filter_func, gpointer user_data);
00310 
00319 gboolean pidgin_screenname_autocomplete_default_filter(const PidginBuddyCompletionEntry *completion_entry, gpointer all_accounts);
00320 
00333 void pidgin_setup_screenname_autocomplete(GtkWidget *entry, GtkWidget *optmenu, gboolean all);
00334 
00345 gboolean pidgin_check_if_dir(const char *path, GtkFileSelection *filesel);
00346 
00355 void pidgin_setup_gtkspell(GtkTextView *textview);
00356 
00360 void pidgin_save_accels_cb(GtkAccelGroup *accel_group, guint arg1,
00361                              GdkModifierType arg2, GClosure *arg3,
00362                              gpointer data);
00363 
00367 gboolean pidgin_save_accels(gpointer data);
00368 
00372 void pidgin_load_accels(void);
00373 
00380 void pidgin_retrieve_user_info(PurpleConnection *conn, const char *name);
00381 
00389 void pidgin_retrieve_user_info_in_chat(PurpleConnection *conn, const char *name, int chatid);
00390 
00407 gboolean pidgin_parse_x_im_contact(const char *msg, gboolean all_accounts,
00408                                      PurpleAccount **ret_account,
00409                                      char **ret_protocol, char **ret_username,
00410                                      char **ret_alias);
00411 
00419 void pidgin_set_accessible_label(GtkWidget *w, GtkWidget *l);
00420 
00427 void pidgin_set_accessible_relations(GtkWidget *w, GtkWidget *l);
00428 
00441 void pidgin_menu_position_func_helper(GtkMenu *menu, gint *x, gint *y,
00442                                         gboolean *push_in, gpointer data);
00443 
00459 void pidgin_treeview_popup_menu_position_func(GtkMenu *menu,
00460                                                 gint *x,
00461                                                 gint *y,
00462                                                 gboolean *push_in,
00463                                                 gpointer user_data);
00464 
00472 void pidgin_dnd_file_manage(GtkSelectionData *sd, PurpleAccount *account, const char *who);
00473 
00477 void pidgin_buddy_icon_get_scale_size(GdkPixbuf *buf, PurpleBuddyIconSpec *spec, PurpleIconScaleRules rules, int *width, int *height);
00478 
00493 GdkPixbuf *pidgin_create_prpl_icon(PurpleAccount *account, PidginPrplIconSize size);
00494 
00503 GdkPixbuf * pidgin_create_status_icon(PurpleStatusPrimitive primitive, GtkWidget *w, const char *size);
00504 
00505 
00515 GtkWidget *pidgin_append_menu_action(GtkWidget *menu, PurpleMenuAction *act,
00516                                  gpointer gobject);
00517 
00529 void pidgin_set_cursor(GtkWidget *widget, GdkCursorType cursor_type);
00530 
00540 void pidgin_clear_cursor(GtkWidget *widget);
00541 
00550 GtkWidget *pidgin_buddy_icon_chooser_new(GtkWindow *parent, void(*callback)(const char*,gpointer), gpointer data);
00551 
00561 gpointer pidgin_convert_buddy_icon(PurplePlugin *plugin, const char *path, size_t *len);
00562 
00563 #if !GTK_CHECK_VERSION(2,6,0)
00564 
00569 GdkPixbuf *gdk_pixbuf_new_from_file_at_scale(const char *filename, int width, int height,
00570                                              gboolean preserve_aspect_ratio,
00571                                              GError **error);
00572 #endif
00573 
00582 void pidgin_set_custom_buddy_icon(PurpleAccount *account, const char *who, const char *filename);
00583 
00591 char *" and "<-" in strings to Unicode arrow characters, for use in referencing...">pidgin_make_pretty_arrows(const char *str);
00592 
00603 void *pidgin_make_mini_dialog(PurpleConnection *handle, const char* stock_id, 
00604                 const char *primary, const char *secondary,
00605                 void *user_data,  ...);
00606 
00615 gboolean pidgin_tree_view_search_equal_func(GtkTreeModel *model, gint column,
00616             const gchar *key, GtkTreeIter *iter, gpointer data);
00617 
00625 void pidgin_set_urgent(GtkWindow *window, gboolean urgent);
00626 
00634 gboolean pidgin_gdk_pixbuf_is_opaque(GdkPixbuf *pixbuf);
00635 
00641 void pidgin_gdk_pixbuf_make_round(GdkPixbuf *pixbuf);
00642 
00650 const char *pidgin_get_dim_grey_string(GtkWidget *widget);
00651 
00652 #if !GTK_CHECK_VERSION(2,2,0)
00653 
00663 GtkTreePath *gtk_tree_path_new_from_indices (gint first_index, ...);
00664 #endif
00665 
00675 GtkWidget *pidgin_text_combo_box_entry_new(const char *default_item, GList *items);
00676 
00684 const char *pidgin_text_combo_box_entry_get_text(GtkWidget *widget);
00685 
00692 void pidgin_text_combo_box_entry_set_text(GtkWidget *widget, const char *text);
00693 
00694 #endif /* _PIDGINUTILS_H_ */
00695