3 * Pidgin is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PIDGINBLIST_H_
23 #define _PIDGINBLIST_H_
26 * @section_id: pidgin-gtkblist
27 * @short_description: <filename>gtkblist.h</filename>
28 * @title: Buddy List API
29 * @see_also: <link linkend="chapter-signals-gtkblist">Buddy List signals</link>
32 #define PIDGIN_TYPE_BUDDY_LIST (pidgin_buddy_list_get_type())
34 typedef struct _PidginBuddyList PidginBuddyList
;
38 STATUS_ICON_VISIBLE_COLUMN
,
43 BUDDY_ICON_VISIBLE_COLUMN
,
46 GROUP_EXPANDER_COLUMN
,
47 GROUP_EXPANDER_VISIBLE_COLUMN
,
48 CONTACT_EXPANDER_COLUMN
,
49 CONTACT_EXPANDER_VISIBLE_COLUMN
,
51 EMBLEM_VISIBLE_COLUMN
,
53 PROTOCOL_ICON_VISIBLE_COLUMN
,
59 PIDGIN_STATUS_ICON_LARGE
,
60 PIDGIN_STATUS_ICON_SMALL
62 } PidginStatusIconSize
;
65 #include "buddylist.h"
66 #include "gtkblist-theme.h"
68 /**************************************************************************
70 **************************************************************************/
73 * @notebook: The notebook that switches between the real buddy list
74 * and the helpful instructions page
75 * @main_vbox: This vbox contains the menu and notebook
76 * @vbox: This is the vbox that everything important gets packed
77 * into. Your plugin might want to pack something in it
78 * itself. Go, plugins!
79 * @treeview: It's a treeview... d'uh.
80 * @treemodel: This is the treemodel.
81 * @text_column: Column
82 * @menutray: The menu tray widget.
83 * @menutrayicon: The menu tray icon.
84 * @refresh_timer: The timer for refreshing every 30 seconds
85 * @timeout: The timeout for the tooltip.
86 * @drag_timeout: The timeout for expanding contacts on drags
87 * @tip_rect: This is the bounding rectangle of the cell we're
88 * currently hovering over. This is used for tooltips.
89 * @contact_rect: This is the bounding rectangle of the contact node and
90 * its children. This is used for auto-expand on mouseover.
91 * @mouseover_contact: This is the contact currently mouse-over expanded
92 * @tipwindow: The window used by the tooltip
93 * @tooltipdata: The data for each "chunk" of the tooltip
94 * @selected_node: The currently selected node
95 * @scrollbook: Scrollbook for alerts
96 * @headline: Widget for headline notifications
97 * @headline_label: Label for headline notifications
98 * @headline_image: Image for headline notifications
99 * @headline_callback: Callback for headline notifications
100 * @headline_data: User data for headline notifications
101 * @headline_destroy: Callback to use for destroying the headline-data
102 * @statusbox: The status selector dropdown
103 * @empty_avatar: A 32x32 transparent pixbuf
104 * @priv: Pointer to opaque private data
106 * Like, everything you need to know about the gtk buddy list
108 struct _PidginBuddyList
{
109 PurpleBuddyList parent
;
113 GtkWidget
*main_vbox
;
117 GtkTreeStore
*treemodel
;
118 GtkTreeViewColumn
*text_column
;
120 GtkCellRenderer
*text_rend
;
124 GtkWidget
*menutrayicon
;
130 GdkRectangle tip_rect
;
131 GdkRectangle contact_rect
;
132 PurpleBlistNode
*mouseover_contact
;
134 GtkWidget
*tipwindow
;
137 PurpleBlistNode
*selected_node
;
139 GtkWidget
*scrollbook
;
141 GtkWidget
*headline_label
;
142 GtkWidget
*headline_image
;
143 GCallback headline_callback
;
144 gpointer headline_data
;
145 GDestroyNotify headline_destroy
;
147 GtkWidget
*statusbox
;
148 GdkPixbuf
*empty_avatar
;
153 #define PIDGIN_BLIST(list) ((PidginBuddyList *)purple_blist_get_ui_data())
157 /**************************************************************************
158 * GTK+ Buddy List API
159 **************************************************************************/
162 * pidgin_buddy_list_get_type:
164 * Returns: The #GType for the #PidginBuddyList boxed structure.
166 G_DECLARE_FINAL_TYPE(PidginBuddyList
, pidgin_buddy_list
, PIDGIN
, BUDDY_LIST
,
170 * pidgin_blist_get_handle:
172 * Get the handle for the GTK+ blist system.
174 * Returns: the handle to the blist system
176 void *pidgin_blist_get_handle(void);
181 * Initializes the GTK+ blist system.
183 void pidgin_blist_init(void);
186 * pidgin_blist_uninit:
188 * Uninitializes the GTK+ blist system.
190 void pidgin_blist_uninit(void);
193 * pidgin_blist_get_default_gtk_blist:
195 * Returns the default gtk buddy list
197 * There's normally only one buddy list window, but that isn't a necessity. This function
198 * returns the PidginBuddyList we're most likely wanting to work with. This is slightly
199 * cleaner than an externed global.
201 * Returns: The default GTK+ buddy list
203 PidginBuddyList
*pidgin_blist_get_default_gtk_blist(void);
206 * pidgin_blist_make_buddy_menu:
207 * @menu: The menu to populate
208 * @buddy: The buddy whose menu to get
209 * @sub: %TRUE if this is a sub-menu, %FALSE otherwise
211 * Populates a menu with the items shown on the buddy list for a buddy.
213 void pidgin_blist_make_buddy_menu(GtkWidget
*menu
, PurpleBuddy
*buddy
, gboolean sub
);
216 * pidgin_blist_refresh:
217 * @list: This is the core list that gets updated from
219 * Refreshes all the nodes of the buddy list.
220 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing)
222 void pidgin_blist_refresh(PurpleBuddyList
*list
);
224 void pidgin_blist_update_columns(void);
225 void pidgin_blist_update_refresh_timeout(void);
228 * pidgin_blist_get_emblem:
229 * @node: The node to return an emblem for
231 * Returns the blist emblem.
233 * This may be an existing pixbuf that has been given an additional ref,
234 * so it shouldn't be modified.
236 * Returns: (transfer full): A GdkPixbuf for the emblem to show, or NULL
239 pidgin_blist_get_emblem(PurpleBlistNode
*node
);
242 * pidgin_blist_get_status_icon:
244 * Useful for the buddy ticker
246 * Returns: (transfer full): A #GdkPixbuf of status icon.
248 GdkPixbuf
*pidgin_blist_get_status_icon(PurpleBlistNode
*node
,
249 PidginStatusIconSize size
);
252 * pidgin_blist_node_is_contact_expanded:
253 * @node: The node in question.
255 * Returns a boolean indicating if @node is part of an expanded contact.
257 * This only makes sense for contact and buddy nodes. %FALSE is returned
258 * for other types of nodes.
260 * Returns: A boolean indicating if @node is part of an expanded contact.
262 gboolean
pidgin_blist_node_is_contact_expanded(PurpleBlistNode
*node
);
265 * pidgin_blist_toggle_visibility:
267 * Intelligently toggles the visibility of the buddy list. If the buddy
268 * list is obscured, it is brought to the front. If it is not obscured,
269 * it is hidden. If it is hidden it is shown.
271 void pidgin_blist_toggle_visibility(void);
274 * pidgin_blist_visibility_manager_add:
276 * Increases the reference count of visibility managers. Callers should
277 * call the complementary remove function when no longer managing
280 * A visibility manager is something that provides some method for
281 * showing the buddy list after it is hidden (e.g. docklet plugin).
283 void pidgin_blist_visibility_manager_add(void);
286 * pidgin_blist_visibility_manager_remove:
288 * Decreases the reference count of visibility managers. If the count
289 * drops below zero, the buddy list is shown.
291 void pidgin_blist_visibility_manager_remove(void);
294 * pidgin_blist_add_alert:
295 * @widget: The widget to add
297 * Adds a mini-alert to the blist scrollbook
299 void pidgin_blist_add_alert(GtkWidget
*widget
);
302 * pidgin_blist_set_theme:
303 * @theme: the new theme to use
305 * Sets the current theme for Pidgin to use
307 void pidgin_blist_set_theme(PidginBlistTheme
*theme
);
310 * pidgin_blist_get_theme:
312 * Gets Pidgin's current buddy list theme
314 * Returns: (transfer none): the current theme
316 PidginBlistTheme
*pidgin_blist_get_theme(void);
318 /**************************************************************************
319 * GTK+ Buddy List sorting functions
320 **************************************************************************/
322 typedef void (*pidgin_blist_sort_function
)(PurpleBlistNode
*new, PurpleBuddyList
*blist
, GtkTreeIter group
, GtkTreeIter
*cur
, GtkTreeIter
*iter
);
325 * pidgin_blist_get_sort_methods:
327 * Gets the current list of sort methods.
329 * Returns: (transfer none) (element-type PidginBlistSortMethod): A GSlist of sort methods
331 GList
*pidgin_blist_get_sort_methods(void);
333 struct _PidginBlistSortMethod
{
336 pidgin_blist_sort_function func
;
339 typedef struct _PidginBlistSortMethod PidginBlistSortMethod
;
342 * pidgin_blist_sort_method_reg:
343 * @id: The unique ID of the sorting method
344 * @name: The method's name.
345 * @func: (scope call): A pointer to the function.
347 * Registers a buddy list sorting method.
349 void pidgin_blist_sort_method_reg(const char *id
, const char *name
, pidgin_blist_sort_function func
);
352 * pidgin_blist_sort_method_unreg:
353 * @id: The method's id
355 * Unregisters a buddy list sorting method.
357 void pidgin_blist_sort_method_unreg(const char *id
);
360 * pidgin_blist_sort_method_set:
361 * @id: The method's id.
363 * Sets a buddy list sorting method.
365 void pidgin_blist_sort_method_set(const char *id
);
368 * pidgin_blist_setup_sort_methods:
370 * Sets up the programs default sort methods
372 void pidgin_blist_setup_sort_methods(void);
375 * pidgin_blist_update_accounts_menu:
377 * Updates the accounts menu on the GTK+ buddy list window.
379 void pidgin_blist_update_accounts_menu(void);
382 * pidgin_blist_update_plugin_actions:
384 * Updates the plugin actions menu on the GTK+ buddy list window.
386 void pidgin_blist_update_plugin_actions(void);
389 * pidgin_blist_update_sort_methods:
391 * Updates the Sorting menu on the GTK+ buddy list window.
393 void pidgin_blist_update_sort_methods(void);
396 * pidgin_blist_joinchat_is_showable:
398 * Determines if showing the join chat dialog is a valid action.
400 * Returns: Returns TRUE if there are accounts online capable of
401 * joining chat rooms. Otherwise returns FALSE.
403 gboolean
pidgin_blist_joinchat_is_showable(void);
406 * pidgin_blist_joinchat_show:
408 * Shows the join chat dialog.
410 void pidgin_blist_joinchat_show(void);
413 * pidgin_append_blist_node_privacy_menu:
415 * Appends the privacy menu items for a PurpleBlistNode
417 /* TODO Rename these. */
418 void pidgin_append_blist_node_privacy_menu(GtkWidget
*menu
, PurpleBlistNode
*node
);
421 * pidgin_append_blist_node_proto_menu:
423 * Appends the protocol specific menu items for a PurpleBlistNode
425 /* TODO Rename these. */
426 void pidgin_append_blist_node_proto_menu (GtkWidget
*menu
, PurpleConnection
*gc
, PurpleBlistNode
*node
);
429 * pidgin_append_blist_node_extended_menu:
431 * Appends the extended menu items for a PurpleBlistNode
433 /* TODO Rename these. */
434 void pidgin_append_blist_node_extended_menu(GtkWidget
*menu
, PurpleBlistNode
*node
);
437 * pidgin_blist_set_headline:
438 * @text: Pango Markup for the label text
439 * @icon_name: The icon name from the #GtkIconTheme
440 * @callback: The callback to call when headline is clicked
441 * @user_data: The userdata to include in the callback
442 * @destroy: The callback to call when headline is closed or replaced by another headline.
444 * Sets a headline notification
446 * This is currently used for mail notification, but could theoretically be used for anything.
447 * Only the most recent headline will be shown.
449 void pidgin_blist_set_headline(const char *text
, const gchar
*icon_name
,
450 GCallback callback
, gpointer user_data
, GDestroyNotify destroy
);
453 * pidgin_blist_get_name_markup:
454 * @buddy: The buddy to return markup from
455 * @selected: Whether this buddy is selected. If TRUE, the markup will not change the color.
456 * @aliased: TRUE to return the appropriate alias of this buddy, FALSE to return its username and status information
458 * Returns a buddy's Pango markup appropriate for setting in a GtkCellRenderer.
460 * Returns: The markup for this buddy
462 gchar
*pidgin_blist_get_name_markup(PurpleBuddy
*buddy
, gboolean selected
, gboolean aliased
);
465 * pidgin_blist_draw_tooltip:
466 * @node: The buddy list node to show a tooltip for
467 * @widget: The widget to draw the tooltip on
469 * Creates the Buddy List tooltip at the current pointer location for the given buddy list node.
471 * This tooltip will be destroyed the next time this function is called, or when XXXX
474 void pidgin_blist_draw_tooltip(PurpleBlistNode
*node
, GtkWidget
*widget
);
477 * pidgin_blist_tooltip_destroy:
479 * Destroys the current (if any) Buddy List tooltip
481 void pidgin_blist_tooltip_destroy(void);
485 #endif /* _PIDGINBLIST_H_ */