Mercurial > pidgin.yaz
annotate src/gtkblist.h @ 11331:64fadbf3810f
[gaim-migrate @ 13544]
General polishing of DBus code, improving examples, removing obsolete files.
committer: Tailor Script <tailor@pidgin.im>
author | Piotr Zielinski <zielaj> |
---|---|
date | Wed, 24 Aug 2005 02:34:40 +0000 |
parents | 90be432e8385 |
children | cedd48571c90 |
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 */ |
86 | |
87 GaimBlistNode *selected_node; /**< The currently selected node */ | |
10643 | 88 GtkWidget *statusbox; /**< The status selector dropdown */ |
7304 | 89 GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
90 GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
91 | |
10008 | 92 }; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
93 |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
94 #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
5228 | 95 #define GAIM_IS_GTK_BLIST(list) \ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
96 ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
5228 | 97 |
98 /************************************************************************** | |
5422 | 99 * @name GTK+ Buddy List API |
5228 | 100 **************************************************************************/ |
5906 | 101 |
102 /** | |
8815 | 103 * Get the handle for the GTK+ blist system. |
104 * | |
105 * @return the handle to the blist system | |
106 */ | |
107 void *gaim_gtk_blist_get_handle(); | |
108 | |
109 /** | |
5906 | 110 * Initializes the GTK+ blist system. |
111 */ | |
112 void gaim_gtk_blist_init(void); | |
113 | |
5228 | 114 /** |
8815 | 115 * Uninitializes the GTK+ blist system. |
116 */ | |
117 void gaim_gtk_blist_uninit(void); | |
118 | |
119 /** | |
5228 | 120 * Returns the UI operations structure for the buddy list. |
121 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
122 * @return The GTK+ list operations structure. |
5228 | 123 */ |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
124 GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
5228 | 125 |
126 /** | |
10643 | 127 * Returns the default gtk buddy list |
128 * | |
129 * There's normally only one buddy list window, but that isn't a necessity. This function | |
130 * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
131 * cleaner than an externed global. | |
132 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
133 * @return The default GTK+ buddy list |
10643 | 134 */ |
135 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
136 | |
137 /** | |
5228 | 138 * Returns the base image to represent the account, based on the currently selected theme |
139 * | |
140 * @param account The account. | |
6695 | 141 * |
5228 | 142 * @return The icon |
143 */ | |
10884 | 144 GdkPixbuf *gaim_gtk_create_prpl_icon(GaimAccount *account); |
5228 | 145 |
146 /** | |
9774 | 147 * Populates a menu with the items shown on the buddy list for a buddy. |
148 * | |
149 * @param menu The menu to populate | |
150 * @param buddy The buddy who's menu to get | |
10484 | 151 * @param sub TRUE if this is a sub-menu, FALSE otherwise |
9774 | 152 */ |
10484 | 153 void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
9774 | 154 |
155 /** | |
5228 | 156 * Refreshes all the nodes of the buddy list. |
157 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
158 * | |
159 * @param list This is the core list that gets updated from | |
160 */ | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
161 void gaim_gtk_blist_refresh(GaimBuddyList *list); |
5228 | 162 |
163 /** | |
164 * Tells the buddy list to update its toolbar based on the preferences | |
165 * | |
166 */ | |
167 void gaim_gtk_blist_update_toolbar(); | |
168 | |
169 /** | |
170 * Useful for the docklet plugin and also for the win32 tray icon | |
6695 | 171 * This is called when one of those is clicked--it will show/hide the |
172 * buddy list/login window--depending on which is active | |
5228 | 173 */ |
174 void gaim_gtk_blist_docklet_toggle(); | |
175 void gaim_gtk_blist_docklet_add(); | |
176 void gaim_gtk_blist_docklet_remove(); | |
177 void gaim_gtk_blist_update_columns(); | |
5411 | 178 void gaim_gtk_blist_update_refresh_timeout(); |
5228 | 179 |
180 /** | |
181 * Useful for the buddy ticker | |
182 */ | |
5234 | 183 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
5228 | 184 GaimStatusIconSize size); |
185 | |
11018 | 186 /** |
187 * Returns a boolean indicating if @a node is part of an expanded contact. | |
188 * | |
189 * This only makes sense for contact and buddy nodes. @c FALSE is returned | |
190 * for other types of nodes. | |
191 * | |
192 * @param node The node in question. | |
193 * @return A boolean indicating if @a node is part of an expanded contact. | |
194 */ | |
195 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node); | |
196 | |
5422 | 197 /************************************************************************** |
198 * @name GTK+ Buddy List sorting functions | |
199 **************************************************************************/ | |
200 | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
201 typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
5422 | 202 |
203 extern GSList *gaim_gtk_blist_sort_methods; | |
204 | |
205 struct gaim_gtk_blist_sort_method { | |
5631 | 206 char *id; |
5422 | 207 char *name; |
208 gaim_gtk_blist_sort_function func; | |
209 }; | |
210 | |
211 /** | |
212 * Registers a buddy list sorting method. | |
213 * | |
5631 | 214 * @param id The unique ID of the sorting method |
5422 | 215 * @param name The method's name. |
216 * @param func A pointer to the function. | |
217 * | |
218 */ | |
5631 | 219 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
5422 | 220 |
221 /** | |
222 * Unregisters a buddy list sorting method. | |
223 * | |
5631 | 224 * @param id The method's id |
5422 | 225 */ |
5631 | 226 void gaim_gtk_blist_sort_method_unreg(const char *id); |
5422 | 227 |
228 /** | |
229 * Sets a buddy list sorting method. | |
230 * | |
5631 | 231 * @param id The method's id. |
5422 | 232 */ |
5631 | 233 void gaim_gtk_blist_sort_method_set(const char *id); |
5422 | 234 |
235 /** | |
236 * Sets up the programs default sort methods | |
237 */ | |
238 void gaim_gtk_blist_setup_sort_methods(); | |
239 | |
5936
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
240 /** |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
241 * Updates the protocol actions menu on the GTK+ buddy list window. |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
242 */ |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
243 void gaim_gtk_blist_update_protocol_actions(); |
5422 | 244 |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
245 /** |
8986 | 246 * Updates the plugin actions menu on the GTK+ buddy list window. |
247 */ | |
248 void gaim_gtk_blist_update_plugin_actions(); | |
249 | |
250 /** | |
8940 | 251 * Determines if showing the join chat dialog is a valid action. |
252 * | |
253 * @return Returns TRUE if there are accounts online capable of | |
254 * joining chat rooms. Otherwise returns FALSE. | |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
255 */ |
8940 | 256 gboolean gaim_gtk_blist_joinchat_is_showable(void); |
257 | |
258 /** | |
259 * Shows the join chat dialog. | |
260 */ | |
261 void gaim_gtk_blist_joinchat_show(void); | |
5422 | 262 |
9051 | 263 /** |
264 * Appends the protocol specific menu items for a GaimBlistNode | |
265 */ | |
266 void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
267 | |
268 /** | |
269 * Appends the extended menu items for a GaimBlistNode | |
270 */ | |
271 void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
272 | |
9713 | 273 #endif /* _GAIM_GTKBLIST_H_ */ |