Mercurial > pidgin.yaz
annotate src/gtkblist.h @ 12090:34390fe6eced
[gaim-migrate @ 14387]
Yes, rlaager, this change should be in ChangeLog.API
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 14 Nov 2005 22:49:30 +0000 |
parents | 3b52d94437f3 |
children | e75ef7aa913e |
rev | line source |
---|---|
5228 | 1 /** |
5248 | 2 * @file gtkblist.h GTK+ Buddy List API |
5228 | 3 * @ingroup gtkui |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
5906 | 10 * |
5228 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9713 | 25 #ifndef _GAIM_GTKBLIST_H_ |
26 #define _GAIM_GTKBLIST_H_ | |
5228 | 27 |
10008 | 28 typedef struct _GaimGtkBuddyList GaimGtkBuddyList; |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
29 |
5228 | 30 enum { |
31 STATUS_ICON_COLUMN, | |
32 STATUS_ICON_VISIBLE_COLUMN, | |
33 NAME_COLUMN, | |
34 IDLE_COLUMN, | |
35 BUDDY_ICON_COLUMN, | |
36 NODE_COLUMN, | |
37 BLIST_COLUMNS | |
10008 | 38 |
39 }; | |
5228 | 40 |
41 typedef enum { | |
42 GAIM_STATUS_ICON_LARGE, | |
43 GAIM_STATUS_ICON_SMALL | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
44 |
5228 | 45 } GaimStatusIconSize; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
46 |
10008 | 47 #include "gtkgaim.h" |
48 #include "blist.h" | |
49 | |
5228 | 50 /************************************************************************** |
51 * @name Structures | |
52 **************************************************************************/ | |
53 /** | |
54 * Like, everything you need to know about the gtk buddy list | |
55 */ | |
10008 | 56 struct _GaimGtkBuddyList { |
5228 | 57 GtkWidget *window; |
58 GtkWidget *vbox; /**< This is the vbox that everything gets packed into. Your plugin might | |
59 want to pack something in it itself. Go, plugins! */ | |
60 | |
61 GtkWidget *treeview; /**< It's a treeview... d'uh. */ | |
62 GtkTreeStore *treemodel; /**< This is the treemodel. */ | |
6695 | 63 GtkTreeViewColumn *idle_column, |
64 *warning_column, | |
11016 | 65 *buddy_icon_column, |
66 *text_column; | |
67 | |
68 GtkCellRenderer *text_rend; | |
5228 | 69 |
5427 | 70 GtkItemFactory *ift; |
5228 | 71 GtkWidget *bpmenu; /**< The buddy pounce menu. */ |
72 | |
73 guint refresh_timer; /**< The timer for refreshing every 30 seconds */ | |
74 | |
75 guint timeout; /**< The timeout for the tooltip. */ | |
10354 | 76 guint drag_timeout; /**< The timeout for expanding contacts on drags */ |
7636 | 77 GdkRectangle tip_rect; /**< This is the bounding rectangle of the |
78 cell we're currently hovering over. This is | |
79 used for tooltips. */ | |
80 GdkRectangle contact_rect; /**< This is the bounding rectangle of the contact node | |
81 and its children. This is used for auto-expand on | |
82 mouseover. */ | |
83 GaimBlistNode *mouseover_contact; /**< This is the contact currently mouse-over expanded */ | |
84 | |
5228 | 85 GtkWidget *tipwindow; /**< The window used by the tooltip */ |
11890 | 86 GList *tooltipdata; /**< The data for each "chunk" of the tooltip */ |
5228 | 87 |
88 GaimBlistNode *selected_node; /**< The currently selected node */ | |
10643 | 89 GtkWidget *statusbox; /**< The status selector dropdown */ |
11732 | 90 GtkWidget *statusboxbox; /**< A box to hold per account status boxes */ |
91 GList *statusboxes; /**< A list of the per account status boxes */ | |
7304 | 92 GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
93 GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
94 | |
10008 | 95 }; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
96 |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
97 #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
5228 | 98 #define GAIM_IS_GTK_BLIST(list) \ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
99 ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
5228 | 100 |
101 /************************************************************************** | |
5422 | 102 * @name GTK+ Buddy List API |
5228 | 103 **************************************************************************/ |
5906 | 104 |
105 /** | |
8815 | 106 * Get the handle for the GTK+ blist system. |
107 * | |
108 * @return the handle to the blist system | |
109 */ | |
110 void *gaim_gtk_blist_get_handle(); | |
111 | |
112 /** | |
5906 | 113 * Initializes the GTK+ blist system. |
114 */ | |
115 void gaim_gtk_blist_init(void); | |
116 | |
5228 | 117 /** |
8815 | 118 * Uninitializes the GTK+ blist system. |
119 */ | |
120 void gaim_gtk_blist_uninit(void); | |
121 | |
122 /** | |
5228 | 123 * Returns the UI operations structure for the buddy list. |
124 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
125 * @return The GTK+ list operations structure. |
5228 | 126 */ |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
127 GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
5228 | 128 |
129 /** | |
10643 | 130 * Returns the default gtk buddy list |
11732 | 131 * |
10643 | 132 * There's normally only one buddy list window, but that isn't a necessity. This function |
133 * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
134 * cleaner than an externed global. | |
11732 | 135 * |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
136 * @return The default GTK+ buddy list |
10643 | 137 */ |
138 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
139 | |
140 /** | |
9774 | 141 * Populates a menu with the items shown on the buddy list for a buddy. |
142 * | |
143 * @param menu The menu to populate | |
144 * @param buddy The buddy who's menu to get | |
10484 | 145 * @param sub TRUE if this is a sub-menu, FALSE otherwise |
9774 | 146 */ |
10484 | 147 void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
9774 | 148 |
149 /** | |
5228 | 150 * Refreshes all the nodes of the buddy list. |
151 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
152 * | |
153 * @param list This is the core list that gets updated from | |
154 */ | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
155 void gaim_gtk_blist_refresh(GaimBuddyList *list); |
5228 | 156 |
157 /** | |
158 * Tells the buddy list to update its toolbar based on the preferences | |
159 * | |
160 */ | |
161 void gaim_gtk_blist_update_toolbar(); | |
162 | |
163 void gaim_gtk_blist_update_columns(); | |
5411 | 164 void gaim_gtk_blist_update_refresh_timeout(); |
5228 | 165 |
166 /** | |
167 * Useful for the buddy ticker | |
168 */ | |
5234 | 169 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
5228 | 170 GaimStatusIconSize size); |
171 | |
11018 | 172 /** |
173 * Returns a boolean indicating if @a node is part of an expanded contact. | |
174 * | |
175 * This only makes sense for contact and buddy nodes. @c FALSE is returned | |
176 * for other types of nodes. | |
177 * | |
178 * @param node The node in question. | |
179 * @return A boolean indicating if @a node is part of an expanded contact. | |
180 */ | |
181 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node); | |
182 | |
12017
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
183 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
184 * Intelligently toggles the visibility of the buddy list. If the buddy |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
185 * list is obscured, it is brought to the front. If it is not obscured, |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
186 * it is hidden. If it is hidden it is shown. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
187 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
188 void gaim_gtk_blist_toggle_visibility(); |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
189 |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
190 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
191 * Increases the reference count of visibility managers. Callers should |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
192 * call the complementary remove function when no longer managing |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
193 * visibility. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
194 * |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
195 * A visibility manager is something that provides some method for |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
196 * showing the buddy list after it is hidden (e.g. docklet plugin). |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
197 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
198 void gaim_gtk_blist_visibility_manager_add(); |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
199 |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
200 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
201 * Decreases the reference count of visibility managers. If the count |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
202 * drops below zero, the buddy list is shown. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
203 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
204 void gaim_gtk_blist_visibility_manager_remove(); |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
205 |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
206 |
5422 | 207 /************************************************************************** |
208 * @name GTK+ Buddy List sorting functions | |
209 **************************************************************************/ | |
210 | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
211 typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
5422 | 212 |
11796 | 213 /** |
214 * Gets the current list of sort methods. | |
215 * | |
216 * @return A GSlist of sort methods | |
217 */ | |
218 GList *gaim_gtk_blist_get_sort_methods(); | |
5422 | 219 |
220 struct gaim_gtk_blist_sort_method { | |
5631 | 221 char *id; |
5422 | 222 char *name; |
223 gaim_gtk_blist_sort_function func; | |
224 }; | |
225 | |
11796 | 226 typedef struct gaim_gtk_blist_sort_method GaimGtkBlistSortMethod; |
227 | |
5422 | 228 /** |
229 * Registers a buddy list sorting method. | |
230 * | |
5631 | 231 * @param id The unique ID of the sorting method |
5422 | 232 * @param name The method's name. |
233 * @param func A pointer to the function. | |
234 * | |
235 */ | |
5631 | 236 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
5422 | 237 |
238 /** | |
239 * Unregisters a buddy list sorting method. | |
240 * | |
5631 | 241 * @param id The method's id |
5422 | 242 */ |
5631 | 243 void gaim_gtk_blist_sort_method_unreg(const char *id); |
5422 | 244 |
245 /** | |
246 * Sets a buddy list sorting method. | |
247 * | |
5631 | 248 * @param id The method's id. |
5422 | 249 */ |
5631 | 250 void gaim_gtk_blist_sort_method_set(const char *id); |
5422 | 251 |
252 /** | |
253 * Sets up the programs default sort methods | |
254 */ | |
255 void gaim_gtk_blist_setup_sort_methods(); | |
256 | |
5936
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
257 /** |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
258 * Updates the protocol actions menu on the GTK+ buddy list window. |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
259 */ |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
260 void gaim_gtk_blist_update_protocol_actions(); |
5422 | 261 |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
262 /** |
8986 | 263 * Updates the plugin actions menu on the GTK+ buddy list window. |
264 */ | |
265 void gaim_gtk_blist_update_plugin_actions(); | |
266 | |
267 /** | |
11796 | 268 * Updates the Sorting menu on the GTK+ buddy list window. |
269 */ | |
270 void gaim_gtk_blist_update_sort_methods(); | |
271 | |
272 /** | |
8940 | 273 * Determines if showing the join chat dialog is a valid action. |
274 * | |
275 * @return Returns TRUE if there are accounts online capable of | |
276 * joining chat rooms. Otherwise returns FALSE. | |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
277 */ |
8940 | 278 gboolean gaim_gtk_blist_joinchat_is_showable(void); |
279 | |
280 /** | |
281 * Shows the join chat dialog. | |
282 */ | |
283 void gaim_gtk_blist_joinchat_show(void); | |
5422 | 284 |
9051 | 285 /** |
286 * Appends the protocol specific menu items for a GaimBlistNode | |
287 */ | |
288 void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
289 | |
290 /** | |
291 * Appends the extended menu items for a GaimBlistNode | |
292 */ | |
293 void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
294 | |
9713 | 295 #endif /* _GAIM_GTKBLIST_H_ */ |