gtkblist.h
Go to the documentation of this file.
1
7 /* pidgin
8 *
9 * Pidgin is the legal property of its developers, whose names are too numerous
10 * to list here. Please refer to the COPYRIGHT file distributed with this
11 * source distribution.
12 *
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
17 *
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
26 */
27 #ifndef _PIDGINBLIST_H_
28 #define _PIDGINBLIST_H_
29
31 typedef struct _PidginBuddyList PidginBuddyList;
32
33 enum {
34 STATUS_ICON_COLUMN,
35 STATUS_ICON_VISIBLE_COLUMN,
36 NAME_COLUMN,
37 IDLE_COLUMN,
38 IDLE_VISIBLE_COLUMN,
39 BUDDY_ICON_COLUMN,
40 BUDDY_ICON_VISIBLE_COLUMN,
41 NODE_COLUMN,
42 BGCOLOR_COLUMN,
43 GROUP_EXPANDER_COLUMN,
44 GROUP_EXPANDER_VISIBLE_COLUMN,
45 CONTACT_EXPANDER_COLUMN,
46 CONTACT_EXPANDER_VISIBLE_COLUMN,
47 EMBLEM_COLUMN,
48 EMBLEM_VISIBLE_COLUMN,
49 PROTOCOL_ICON_COLUMN,
50 PROTOCOL_ICON_VISIBLE_COLUMN,
51 BLIST_COLUMNS
52
53 };
54
55 typedef enum {
56 PIDGIN_STATUS_ICON_LARGE,
57 PIDGIN_STATUS_ICON_SMALL
58
59 } PidginStatusIconSize;
60
61 #include "pidgin.h"
62 #include "blist.h"
63 #include "gtkblist-theme.h"
64
65 /**************************************************************************
66 * @name Structures
67 **************************************************************************/
71 struct _PidginBuddyList {
72 GtkWidget *window;
73 GtkWidget *notebook;
75 GtkWidget *main_vbox;
76 GtkWidget *vbox;
79 GtkWidget *treeview;
80 GtkTreeStore *treemodel;
81 GtkTreeViewColumn *text_column;
83 GtkCellRenderer *text_rend;
84
85 GtkItemFactory *ift;
86 GtkWidget *menutray;
87 GtkWidget *menutrayicon;
96 GHashTable *connection_errors;
97
98 guint refresh_timer;
100 guint timeout;
101 guint drag_timeout;
102 GdkRectangle tip_rect;
105 GdkRectangle contact_rect;
108 PurpleBlistNode *mouseover_contact;
110 GtkWidget *tipwindow;
111 GList *tooltipdata;
113 PurpleBlistNode *selected_node;
115 GdkCursor *hand_cursor;
116 GdkCursor *arrow_cursor;
118 GtkWidget *scrollbook;
119 GtkWidget *headline_hbox;
120 GtkWidget *headline_label;
121 GtkWidget *headline_image;
122 GdkPixbuf *headline_close;
123 GCallback headline_callback;
124 gpointer headline_data;
125 GDestroyNotify headline_destroy;
126 gboolean changing_style;
128 GtkWidget *error_buttons;
129 GtkWidget *statusbox;
130 GdkPixbuf *empty_avatar;
132 gpointer priv;
133 };
134
135 #define PIDGIN_BLIST(list) ((PidginBuddyList *)purple_blist_get_ui_data())
136 #define PIDGIN_IS_PIDGIN_BLIST(list) \
137 (purple_blist_get_ui_ops() == pidgin_blist_get_ui_ops())
138
139 /**************************************************************************
140 * @name GTK+ Buddy List API
141 **************************************************************************/
142
148 void *pidgin_blist_get_handle(void);
149
153 void pidgin_blist_init(void);
154
158 void pidgin_blist_uninit(void);
159
165 PurpleBlistUiOps *pidgin_blist_get_ui_ops(void);
166
176 PidginBuddyList *pidgin_blist_get_default_gtk_blist(void);
177
185 void pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub);
186
193 void pidgin_blist_refresh(PurpleBuddyList *list);
194
195 void pidgin_blist_update_columns(void);
196 void pidgin_blist_update_refresh_timeout(void);
197
208 GdkPixbuf *
209 pidgin_blist_get_emblem(PurpleBlistNode *node);
210
214 GdkPixbuf *pidgin_blist_get_status_icon(PurpleBlistNode *node,
215 PidginStatusIconSize size);
216
226 gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node);
227
233 void pidgin_blist_toggle_visibility(void);
234
243 void pidgin_blist_visibility_manager_add(void);
244
249 void pidgin_blist_visibility_manager_remove(void);
250
256 void pidgin_blist_add_alert(GtkWidget *widget);
257
265 void pidgin_blist_set_theme(PidginBlistTheme *theme);
266
274 PidginBlistTheme *pidgin_blist_get_theme(void);
275
276 /**************************************************************************
277 * @name GTK+ Buddy List sorting functions
278 **************************************************************************/
279
280 typedef void (*pidgin_blist_sort_function)(PurpleBlistNode *new, PurpleBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur, GtkTreeIter *iter);
281
287 GList *pidgin_blist_get_sort_methods(void);
288
289 struct pidgin_blist_sort_method {
290 char *id;
291 char *name;
292 pidgin_blist_sort_function func;
293 };
294
295 typedef struct pidgin_blist_sort_method PidginBlistSortMethod;
296
305 void pidgin_blist_sort_method_reg(const char *id, const char *name, pidgin_blist_sort_function func);
306
312 void pidgin_blist_sort_method_unreg(const char *id);
313
319 void pidgin_blist_sort_method_set(const char *id);
320
324 void pidgin_blist_setup_sort_methods(void);
325
329 void pidgin_blist_update_accounts_menu(void);
330
334 void pidgin_blist_update_plugin_actions(void);
335
339 void pidgin_blist_update_sort_methods(void);
340
347 gboolean pidgin_blist_joinchat_is_showable(void);
348
352 void pidgin_blist_joinchat_show(void);
353
358 void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, PurpleBlistNode *node);
359
364 void pidgin_append_blist_node_proto_menu (GtkWidget *menu, PurpleConnection *gc, PurpleBlistNode *node);
365
370 void pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node);
371
384 void pidgin_blist_update_account_error_state(PurpleAccount *account, const char *message);
385
398 void pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data,
399 GDestroyNotify destroy);
400
411 gchar *pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gboolean aliased);
412
424 void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget);
425
431 void pidgin_blist_tooltip_destroy(void);
432
433
434 #endif /* _PIDGINBLIST_H_ */
pidgin_blist_visibility_manager_add
void pidgin_blist_visibility_manager_add(void)
Increases the reference count of visibility managers.
pidgin_blist_refresh
void pidgin_blist_refresh(PurpleBuddyList *list)
Refreshes all the nodes of the buddy list.
pidgin_blist_toggle_visibility
void pidgin_blist_toggle_visibility(void)
Intelligently toggles the visibility of the buddy list.
_PidginBuddyList::tipwindow
GtkWidget * tipwindow
The window used by the tooltip.
Definition: gtkblist.h:110
pidgin_blist_get_default_gtk_blist
PidginBuddyList * pidgin_blist_get_default_gtk_blist(void)
Returns the default gtk buddy list.
pidgin_blist_joinchat_is_showable
gboolean pidgin_blist_joinchat_is_showable(void)
Determines if showing the join chat dialog is a valid action.
pidgin_blist_make_buddy_menu
void pidgin_blist_make_buddy_menu(GtkWidget *menu, PurpleBuddy *buddy, gboolean sub)
Populates a menu with the items shown on the buddy list for a buddy.
pidgin_blist_get_status_icon
GdkPixbuf * pidgin_blist_get_status_icon(PurpleBlistNode *node, PidginStatusIconSize size)
Useful for the buddy ticker.
_PurpleBlistNode
A Buddy list node.
Definition: blist.h:124
pidgin_blist_set_headline
void pidgin_blist_set_headline(const char *text, GdkPixbuf *pixbuf, GCallback callback, gpointer user_data, GDestroyNotify destroy)
Sets a headline notification.
pidgin_append_blist_node_extended_menu
void pidgin_append_blist_node_extended_menu(GtkWidget *menu, PurpleBlistNode *node)
Appends the extended menu items for a PurpleBlistNode TODO: Rename these.
_PidginBuddyList::headline_destroy
GDestroyNotify headline_destroy
Callback to use for destroying the headline-data.
Definition: gtkblist.h:125
_PidginBuddyList::timeout
guint timeout
The timeout for the tooltip.
Definition: gtkblist.h:100
_PidginBuddyList::hand_cursor
GdkCursor * hand_cursor
Hand cursor.
Definition: gtkblist.h:115
_PidginBuddyList
Like, everything you need to know about the gtk buddy list.
Definition: gtkblist.h:71
_PidginBuddyList::changing_style
gboolean changing_style
True when changing GTK+ theme style.
Definition: gtkblist.h:126
pidgin_blist_update_plugin_actions
void pidgin_blist_update_plugin_actions(void)
Updates the plugin actions menu on the GTK+ buddy list window.
pidgin_blist_update_accounts_menu
void pidgin_blist_update_accounts_menu(void)
Updates the accounts menu on the GTK+ buddy list window.
pidgin_blist_get_ui_ops
PurpleBlistUiOps * pidgin_blist_get_ui_ops(void)
Returns the UI operations structure for the buddy list.
pidgin_blist_get_theme
PidginBlistTheme * pidgin_blist_get_theme(void)
Gets Pidgin&#39;s current buddy list theme.
pidgin_blist_set_theme
void pidgin_blist_set_theme(PidginBlistTheme *theme)
Sets the current theme for Pidgin to use.
_PidginBuddyList::empty_avatar
GdkPixbuf * empty_avatar
A 32x32 transparent pixbuf.
Definition: gtkblist.h:130
_PidginBuddyList::headline_data
gpointer headline_data
User data for headline notifications.
Definition: gtkblist.h:124
_PurpleAccount
Structure representing an account.
Definition: account.h:169
_PidginBuddyList::headline_image
GtkWidget * headline_image
Image for headline notifications.
Definition: gtkblist.h:121
pidgin_blist_uninit
void pidgin_blist_uninit(void)
Uninitializes the GTK+ blist system.
_PidginBuddyList::headline_label
GtkWidget * headline_label
Label for headline notifications.
Definition: gtkblist.h:120
pidgin_append_blist_node_proto_menu
void pidgin_append_blist_node_proto_menu(GtkWidget *menu, PurpleConnection *gc, PurpleBlistNode *node)
Appends the protocol specific menu items for a PurpleBlistNode TODO: Rename these.
pidgin_blist_sort_method
Definition: gtkblist.h:289
_PidginBuddyList::statusbox
GtkWidget * statusbox
The status selector dropdown.
Definition: gtkblist.h:129
_PidginBuddyList::treeview
GtkWidget * treeview
It&#39;s a treeview...
Definition: gtkblist.h:79
_PurpleBuddyList
The Buddy List.
Definition: blist.h:189
pidgin.h
UI definitions and includes.
pidgin_blist_tooltip_destroy
void pidgin_blist_tooltip_destroy(void)
Destroys the current (if any) Buddy List tooltip.
_PidginBuddyList::contact_rect
GdkRectangle contact_rect
This is the bounding rectangle of the contact node and its children.
Definition: gtkblist.h:105
blist.h
Buddy List API.
pidgin_blist_get_sort_methods
GList * pidgin_blist_get_sort_methods(void)
Gets the current list of sort methods.
_PidginBuddyList::priv
gpointer priv
Pointer to opaque private data.
Definition: gtkblist.h:132
pidgin_blist_setup_sort_methods
void pidgin_blist_setup_sort_methods(void)
Sets up the programs default sort methods.
_PidginBuddyList::treemodel
GtkTreeStore * treemodel
This is the treemodel.
Definition: gtkblist.h:80
_PidginBuddyList::notebook
GtkWidget * notebook
The notebook that switches between the real buddy list and the helpful instructions page...
Definition: gtkblist.h:73
_PidginBuddyList::text_column
GtkTreeViewColumn * text_column
Column.
Definition: gtkblist.h:81
_PidginBuddyList::headline_close
GdkPixbuf * headline_close
Definition: gtkblist.h:122
pidgin_blist_get_emblem
GdkPixbuf * pidgin_blist_get_emblem(PurpleBlistNode *node)
Returns the blist emblem.
_PidginBuddyList::headline_hbox
GtkWidget * headline_hbox
Hbox for headline notification.
Definition: gtkblist.h:119
_PidginBuddyList::headline_callback
GCallback headline_callback
Callback for headline notifications.
Definition: gtkblist.h:123
pidgin_blist_joinchat_show
void pidgin_blist_joinchat_show(void)
Shows the join chat dialog.
_PidginBuddyList::vbox
GtkWidget * vbox
This is the vbox that everything important gets packed into.
Definition: gtkblist.h:76
pidgin_blist_get_name_markup
gchar * pidgin_blist_get_name_markup(PurpleBuddy *buddy, gboolean selected, gboolean aliased)
Returns a buddy&#39;s Pango markup appropriate for setting in a GtkCellRenderer.
_PidginBuddyList::menutrayicon
GtkWidget * menutrayicon
The menu tray icon.
Definition: gtkblist.h:87
pidgin_blist_update_sort_methods
void pidgin_blist_update_sort_methods(void)
Updates the Sorting menu on the GTK+ buddy list window.
_PidginBuddyList::refresh_timer
guint refresh_timer
The timer for refreshing every 30 seconds.
Definition: gtkblist.h:98
_PidginBuddyList::tooltipdata
GList * tooltipdata
The data for each "chunk" of the tooltip.
Definition: gtkblist.h:111
gtkblist-theme.h
GTK+ Buddy List Theme API.
pidgin_blist_init
void pidgin_blist_init(void)
Initializes the GTK+ blist system.
_PidginBuddyList::scrollbook
GtkWidget * scrollbook
Scrollbook for alerts.
Definition: gtkblist.h:118
_PurpleBlistUiOps
Buddy list UI operations.
Definition: blist.h:203
pidgin_blist_get_handle
void * pidgin_blist_get_handle(void)
Get the handle for the GTK+ blist system.
_PidginBuddyList::error_buttons
GtkWidget * error_buttons
Box containing the connection error buttons.
Definition: gtkblist.h:128
_PidginBuddyList::main_vbox
GtkWidget * main_vbox
This vbox contains the menu and notebook.
Definition: gtkblist.h:75
pidgin_blist_draw_tooltip
void pidgin_blist_draw_tooltip(PurpleBlistNode *node, GtkWidget *widget)
Creates the Buddy List tooltip at the current pointer location for the given buddy list node...
pidgin_blist_sort_method_set
void pidgin_blist_sort_method_set(const char *id)
Sets a buddy list sorting method.
pidgin_blist_update_account_error_state
void pidgin_blist_update_account_error_state(PurpleAccount *account, const char *message)
Was used by the connection API to tell the blist if an account has a connection error or no longer ha...
_PidginBlistTheme
Definition: gtkblist-theme.h:51
_PidginBuddyList::tip_rect
GdkRectangle tip_rect
This is the bounding rectangle of the cell we&#39;re currently hovering over.
Definition: gtkblist.h:102
pidgin_append_blist_node_privacy_menu
void pidgin_append_blist_node_privacy_menu(GtkWidget *menu, PurpleBlistNode *node)
Appends the privacy menu items for a PurpleBlistNode TODO: Rename these.
_PidginBuddyList::selected_node
PurpleBlistNode * selected_node
The currently selected node.
Definition: gtkblist.h:113
_PurpleConnection
Definition: connection.h:245
pidgin_blist_add_alert
void pidgin_blist_add_alert(GtkWidget *widget)
Adds a mini-alert to the blist scrollbook.
_PurpleBuddy
A buddy.
Definition: blist.h:138
pidgin_blist_visibility_manager_remove
void pidgin_blist_visibility_manager_remove(void)
Decreases the reference count of visibility managers.
_PidginBuddyList::mouseover_contact
PurpleBlistNode * mouseover_contact
This is the contact currently mouse-over expanded.
Definition: gtkblist.h:108
_PidginBuddyList::drag_timeout
guint drag_timeout
The timeout for expanding contacts on drags.
Definition: gtkblist.h:101
_PidginBuddyList::arrow_cursor
GdkCursor * arrow_cursor
Arrow cursor.
Definition: gtkblist.h:116
pidgin_blist_sort_method_unreg
void pidgin_blist_sort_method_unreg(const char *id)
Unregisters a buddy list sorting method.
_PidginBuddyList::menutray
GtkWidget * menutray
The menu tray widget.
Definition: gtkblist.h:86
_PidginBuddyList::connection_errors
GHashTable * connection_errors
Caches connection error messages; keys are PurpleAccount and values are non-NULL const char *s contai...
Definition: gtkblist.h:96
pidgin_blist_sort_method_reg
void pidgin_blist_sort_method_reg(const char *id, const char *name, pidgin_blist_sort_function func)
Registers a buddy list sorting method.
pidgin_blist_node_is_contact_expanded
gboolean pidgin_blist_node_is_contact_expanded(PurpleBlistNode *node)
Returns a boolean indicating if node is part of an expanded contact.