gtkblist.h

Go to the documentation of this file.
00001 
00007 /* pidgin
00008  *
00009  * Pidgin is the legal property of its developers, whose names are too numerous
00010  * to list here.  Please refer to the COPYRIGHT file distributed with this
00011  * source distribution.
00012  *
00013  * This program is free software; you can redistribute it and/or modify
00014  * it under the terms of the GNU General Public License as published by
00015  * the Free Software Foundation; either version 2 of the License, or
00016  * (at your option) any later version.
00017  *
00018  * This program is distributed in the hope that it will be useful,
00019  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00020  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00021  * GNU General Public License for more details.
00022  *
00023  * You should have received a copy of the GNU General Public License
00024  * along with this program; if not, write to the Free Software
00025  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00026  */
00027 #ifndef _PIDGINBLIST_H_
00028 #define _PIDGINBLIST_H_
00029 
00031 typedef struct _PidginBuddyList PidginBuddyList;
00032 
00033 enum {
00034     STATUS_ICON_COLUMN,
00035     STATUS_ICON_VISIBLE_COLUMN,
00036     NAME_COLUMN,
00037     IDLE_COLUMN,
00038     IDLE_VISIBLE_COLUMN,
00039     BUDDY_ICON_COLUMN,
00040     BUDDY_ICON_VISIBLE_COLUMN,
00041     NODE_COLUMN,
00042     BGCOLOR_COLUMN,
00043     GROUP_EXPANDER_COLUMN,
00044     GROUP_EXPANDER_VISIBLE_COLUMN,
00045     CONTACT_EXPANDER_COLUMN,
00046     CONTACT_EXPANDER_VISIBLE_COLUMN,
00047     EMBLEM_COLUMN,
00048     EMBLEM_VISIBLE_COLUMN,
00049     PROTOCOL_ICON_COLUMN,
00050     PROTOCOL_ICON_VISIBLE_COLUMN,
00051     BLIST_COLUMNS
00052 
00053 };
00054 
00055 typedef enum {
00056     PIDGIN_STATUS_ICON_LARGE,
00057     PIDGIN_STATUS_ICON_SMALL
00058 
00059 } PidginStatusIconSize;
00060 
00061 #include "pidgin.h"
00062 #include "blist.h"
00063 #include "gtkblist-theme.h"
00064 
00065 /**************************************************************************
00066  * @name Structures
00067  **************************************************************************/
00071 struct _PidginBuddyList {
00072     GtkWidget *window;
00073     GtkWidget *notebook;            
00075     GtkWidget *main_vbox;           
00076     GtkWidget *vbox;                
00079     GtkWidget *treeview;            
00080     GtkTreeStore *treemodel;        
00081     GtkTreeViewColumn *text_column; 
00083     GtkCellRenderer *text_rend;
00084 
00085     GtkItemFactory *ift;
00086     GtkWidget *menutray;            
00087     GtkWidget *menutrayicon;        
00096     GHashTable *connection_errors;
00097 
00098     guint refresh_timer;            
00100     guint      timeout;              
00101     guint      drag_timeout;         
00102     GdkRectangle tip_rect;           
00105     GdkRectangle contact_rect;       
00108     PurpleBlistNode *mouseover_contact; 
00110     GtkWidget *tipwindow;            
00111     GList *tooltipdata;              
00113     PurpleBlistNode *selected_node;    
00115     GdkCursor *hand_cursor;         
00116     GdkCursor *arrow_cursor;        
00118     GtkWidget *scrollbook;          
00119     GtkWidget *headline_hbox;       
00120     GtkWidget *headline_label;  
00121     GtkWidget *headline_image;      
00122     GdkPixbuf *headline_close;      
00123     GCallback headline_callback;    
00124     gpointer headline_data;         
00125     GDestroyNotify headline_destroy; 
00126     gboolean changing_style;        
00128     GtkWidget *error_buttons;        
00129     GtkWidget *statusbox;            
00130     GdkPixbuf *empty_avatar;         
00132     gpointer priv;                   
00133 };
00134 
00135 #define PIDGIN_BLIST(list) ((PidginBuddyList *)purple_blist_get_ui_data())
00136 #define PIDGIN_IS_PIDGIN_BLIST(list) \
00137     (purple_blist_get_ui_ops() == pidgin_blist_get_ui_ops())
00138 
00139 /**************************************************************************
00140  * @name GTK+ Buddy List API
00141  **************************************************************************/
00142 
00148 void *pidgin_blist_get_handle(void);
00149 
00153 void pidgin_blist_init(void);
00154 
00158 void pidgin_blist_uninit(void);
00159 
00165 PurpleBlistUiOps *pidgin_blist_get_ui_ops(void);
00166 
00176 PidginBuddyList *pidgin_blist_get_default_gtk_blist(void);
00177 
00185 void pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub);
00186 
00193 void pidgin_blist_refresh(PurpleBuddyList *list);
00194 
00195 void pidgin_blist_update_columns(void);
00196 void pidgin_blist_update_refresh_timeout(void);
00197 
00208 GdkPixbuf *
00209 pidgin_blist_get_emblem(PurpleBlistNode *node);
00210 
00214 GdkPixbuf *pidgin_blist_get_status_icon(PurpleBlistNode *node,
00215         PidginStatusIconSize size);
00216 
00226 gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node);
00227 
00233 void pidgin_blist_toggle_visibility(void);
00234 
00243 void pidgin_blist_visibility_manager_add(void);
00244 
00249 void pidgin_blist_visibility_manager_remove(void);
00250 
00256 void pidgin_blist_add_alert(GtkWidget *widget);
00257 
00265 void pidgin_blist_set_theme(PidginBlistTheme *theme);
00266 
00274 PidginBlistTheme *pidgin_blist_get_theme(void);
00275 
00276 /**************************************************************************
00277  * @name GTK+ Buddy List sorting functions
00278  **************************************************************************/
00279 
00280 typedef void (*pidgin_blist_sort_function)(PurpleBlistNode *new, PurpleBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur, GtkTreeIter *iter);
00281 
00287 GList *pidgin_blist_get_sort_methods(void);
00288 
00289 struct pidgin_blist_sort_method {
00290     char *id;
00291     char *name;
00292     pidgin_blist_sort_function func;
00293 };
00294 
00295 typedef struct pidgin_blist_sort_method PidginBlistSortMethod;
00296 
00305 void pidgin_blist_sort_method_reg(const char *id, const char *name, pidgin_blist_sort_function func);
00306 
00312 void pidgin_blist_sort_method_unreg(const char *id);
00313 
00319 void pidgin_blist_sort_method_set(const char *id);
00320 
00324 void pidgin_blist_setup_sort_methods(void);
00325 
00329 void pidgin_blist_update_accounts_menu(void);
00330 
00334 void pidgin_blist_update_plugin_actions(void);
00335 
00339 void pidgin_blist_update_sort_methods(void);
00340 
00347 gboolean pidgin_blist_joinchat_is_showable(void);
00348 
00352 void pidgin_blist_joinchat_show(void);
00353 
00358 void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, PurpleBlistNode *node);
00359 
00364 void pidgin_append_blist_node_proto_menu (GtkWidget *menu, PurpleConnection *gc, PurpleBlistNode *node);
00365 
00370 void pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node);
00371 
00384 void pidgin_blist_update_account_error_state(PurpleAccount *account, const char *message);
00385 
00398 void pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data,
00399         GDestroyNotify destroy);
00400 
00411 gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gboolean aliased);
00412 
00424 void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget);
00425 
00431 void pidgin_blist_tooltip_destroy(void);
00432 
00433 
00434 #endif /* _PIDGINBLIST_H_ */