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 /**************************************************************************
154 * GTK+ Buddy List API
155 **************************************************************************/
158 * pidgin_buddy_list_get_type:
160 * Returns: The #GType for the #PidginBuddyList boxed structure.
162 G_DECLARE_FINAL_TYPE(PidginBuddyList
, pidgin_buddy_list
, PIDGIN
, BUDDY_LIST
,
166 * pidgin_blist_get_handle:
168 * Get the handle for the GTK+ blist system.
170 * Returns: the handle to the blist system
172 void *pidgin_blist_get_handle(void);
177 * Initializes the GTK+ blist system.
179 void pidgin_blist_init(void);
182 * pidgin_blist_uninit:
184 * Uninitializes the GTK+ blist system.
186 void pidgin_blist_uninit(void);
189 * pidgin_blist_get_default_gtk_blist:
191 * Returns the default gtk buddy list
193 * There's normally only one buddy list window, but that isn't a necessity. This function
194 * returns the PidginBuddyList we're most likely wanting to work with. This is slightly
195 * cleaner than an externed global.
197 * Returns: (transfer none): The default GTK+ buddy list.
199 PidginBuddyList
*pidgin_blist_get_default_gtk_blist(void);
202 * pidgin_blist_make_buddy_menu:
203 * @menu: The menu to populate
204 * @buddy: The buddy whose menu to get
205 * @sub: %TRUE if this is a sub-menu, %FALSE otherwise
207 * Populates a menu with the items shown on the buddy list for a buddy.
209 void pidgin_blist_make_buddy_menu(GtkWidget
*menu
, PurpleBuddy
*buddy
, gboolean sub
);
212 * pidgin_blist_refresh:
213 * @list: This is the core list that gets updated from
215 * Refreshes all the nodes of the buddy list.
216 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing)
218 void pidgin_blist_refresh(PurpleBuddyList
*list
);
220 void pidgin_blist_update_columns(void);
221 void pidgin_blist_update_refresh_timeout(void);
224 * pidgin_blist_get_emblem:
225 * @node: The node to return an emblem for
227 * Returns the blist emblem.
229 * This may be an existing pixbuf that has been given an additional ref,
230 * so it shouldn't be modified.
232 * Returns: (transfer full): A GdkPixbuf for the emblem to show, or NULL
235 pidgin_blist_get_emblem(PurpleBlistNode
*node
);
238 * pidgin_blist_get_status_icon:
240 * Useful for the buddy ticker
242 * Returns: (transfer full): A #GdkPixbuf of status icon.
244 GdkPixbuf
*pidgin_blist_get_status_icon(PurpleBlistNode
*node
,
245 PidginStatusIconSize size
);
248 * pidgin_blist_node_is_contact_expanded:
249 * @node: The node in question.
251 * Returns a boolean indicating if @node is part of an expanded contact.
253 * This only makes sense for contact and buddy nodes. %FALSE is returned
254 * for other types of nodes.
256 * Returns: A boolean indicating if @node is part of an expanded contact.
258 gboolean
pidgin_blist_node_is_contact_expanded(PurpleBlistNode
*node
);
261 * pidgin_blist_toggle_visibility:
263 * Intelligently toggles the visibility of the buddy list. If the buddy
264 * list is obscured, it is brought to the front. If it is not obscured,
265 * it is hidden. If it is hidden it is shown.
267 void pidgin_blist_toggle_visibility(void);
270 * pidgin_blist_visibility_manager_add:
272 * Increases the reference count of visibility managers. Callers should
273 * call the complementary remove function when no longer managing
276 * A visibility manager is something that provides some method for
277 * showing the buddy list after it is hidden (e.g. docklet plugin).
279 void pidgin_blist_visibility_manager_add(void);
282 * pidgin_blist_visibility_manager_remove:
284 * Decreases the reference count of visibility managers. If the count
285 * drops below zero, the buddy list is shown.
287 void pidgin_blist_visibility_manager_remove(void);
290 * pidgin_blist_add_alert:
291 * @widget: The widget to add
293 * Adds a mini-alert to the blist scrollbook
295 void pidgin_blist_add_alert(GtkWidget
*widget
);
298 * pidgin_blist_set_theme:
299 * @theme: the new theme to use
301 * Sets the current theme for Pidgin to use
303 void pidgin_blist_set_theme(PidginBlistTheme
*theme
);
306 * pidgin_blist_get_theme:
308 * Gets Pidgin's current buddy list theme
310 * Returns: (transfer none): the current theme
312 PidginBlistTheme
*pidgin_blist_get_theme(void);
314 /**************************************************************************
315 * GTK+ Buddy List sorting functions
316 **************************************************************************/
318 typedef void (*pidgin_blist_sort_function
)(PurpleBlistNode
*new, PurpleBuddyList
*blist
, GtkTreeIter group
, GtkTreeIter
*cur
, GtkTreeIter
*iter
);
321 * pidgin_blist_get_sort_methods:
323 * Gets the current list of sort methods.
325 * Returns: (transfer none) (element-type PidginBlistSortMethod): A GSlist of sort methods
327 GList
*pidgin_blist_get_sort_methods(void);
329 struct _PidginBlistSortMethod
{
332 pidgin_blist_sort_function func
;
335 typedef struct _PidginBlistSortMethod PidginBlistSortMethod
;
338 * pidgin_blist_sort_method_reg:
339 * @id: The unique ID of the sorting method
340 * @name: The method's name.
341 * @func: (scope call): A pointer to the function.
343 * Registers a buddy list sorting method.
345 void pidgin_blist_sort_method_reg(const char *id
, const char *name
, pidgin_blist_sort_function func
);
348 * pidgin_blist_sort_method_unreg:
349 * @id: The method's id
351 * Unregisters a buddy list sorting method.
353 void pidgin_blist_sort_method_unreg(const char *id
);
356 * pidgin_blist_sort_method_set:
357 * @id: The method's id.
359 * Sets a buddy list sorting method.
361 void pidgin_blist_sort_method_set(const char *id
);
364 * pidgin_blist_setup_sort_methods:
366 * Sets up the programs default sort methods
368 void pidgin_blist_setup_sort_methods(void);
371 * pidgin_blist_update_accounts_menu:
373 * Updates the accounts menu on the GTK+ buddy list window.
375 void pidgin_blist_update_accounts_menu(void);
378 * pidgin_blist_update_plugin_actions:
380 * Updates the plugin actions menu on the GTK+ buddy list window.
382 void pidgin_blist_update_plugin_actions(void);
385 * pidgin_blist_update_sort_methods:
387 * Updates the Sorting menu on the GTK+ buddy list window.
389 void pidgin_blist_update_sort_methods(void);
392 * pidgin_blist_joinchat_is_showable:
394 * Determines if showing the join chat dialog is a valid action.
396 * Returns: Returns TRUE if there are accounts online capable of
397 * joining chat rooms. Otherwise returns FALSE.
399 gboolean
pidgin_blist_joinchat_is_showable(void);
402 * pidgin_blist_joinchat_show:
404 * Shows the join chat dialog.
406 void pidgin_blist_joinchat_show(void);
409 * pidgin_append_blist_node_privacy_menu:
411 * Appends the privacy menu items for a PurpleBlistNode
413 /* TODO Rename these. */
414 void pidgin_append_blist_node_privacy_menu(GtkWidget
*menu
, PurpleBlistNode
*node
);
417 * pidgin_append_blist_node_proto_menu:
419 * Appends the protocol specific menu items for a PurpleBlistNode
421 /* TODO Rename these. */
422 void pidgin_append_blist_node_proto_menu (GtkWidget
*menu
, PurpleConnection
*gc
, PurpleBlistNode
*node
);
425 * pidgin_append_blist_node_extended_menu:
427 * Appends the extended menu items for a PurpleBlistNode
429 /* TODO Rename these. */
430 void pidgin_append_blist_node_extended_menu(GtkWidget
*menu
, PurpleBlistNode
*node
);
433 * pidgin_blist_set_headline:
434 * @text: Pango Markup for the label text
435 * @icon_name: The icon name from the #GtkIconTheme
436 * @callback: The callback to call when headline is clicked
437 * @user_data: The userdata to include in the callback
438 * @destroy: The callback to call when headline is closed or replaced by another headline.
440 * Sets a headline notification
442 * This is currently used for mail notification, but could theoretically be used for anything.
443 * Only the most recent headline will be shown.
445 void pidgin_blist_set_headline(const char *text
, const gchar
*icon_name
,
446 GCallback callback
, gpointer user_data
, GDestroyNotify destroy
);
449 * pidgin_blist_get_name_markup:
450 * @buddy: The buddy to return markup from
451 * @selected: Whether this buddy is selected. If TRUE, the markup will not change the color.
452 * @aliased: TRUE to return the appropriate alias of this buddy, FALSE to return its username and status information
454 * Returns a buddy's Pango markup appropriate for setting in a GtkCellRenderer.
456 * Returns: The markup for this buddy
458 gchar
*pidgin_blist_get_name_markup(PurpleBuddy
*buddy
, gboolean selected
, gboolean aliased
);
461 * pidgin_blist_draw_tooltip:
462 * @node: The buddy list node to show a tooltip for
463 * @widget: The widget to draw the tooltip on
465 * Creates the Buddy List tooltip at the current pointer location for the given buddy list node.
467 * This tooltip will be destroyed the next time this function is called, or when XXXX
470 void pidgin_blist_draw_tooltip(PurpleBlistNode
*node
, GtkWidget
*widget
);
473 * pidgin_blist_tooltip_destroy:
475 * Destroys the current (if any) Buddy List tooltip
477 void pidgin_blist_tooltip_destroy(void);
481 #endif /* _PIDGINBLIST_H_ */