Mercurial > pidgin
annotate src/gtkblist.h @ 11243:a511b77a368b
[gaim-migrate @ 13408]
sf patch #1246384, from shiyee
"This patch globally defines
spacings and boreders according to the Gnome Human
Interfaces Guidelines, and uses those defines where
appropriate. No visual changes are made, but the the
intention is that the defines should help promote
uniformness."
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Fri, 12 Aug 2005 23:53:28 +0000 |
parents | 04f280376f06 |
children | 90be432e8385 |
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 WARNING_COLUMN, | |
35 IDLE_COLUMN, | |
36 BUDDY_ICON_COLUMN, | |
37 NODE_COLUMN, | |
38 BLIST_COLUMNS | |
10008 | 39 |
40 }; | |
5228 | 41 |
42 typedef enum { | |
43 GAIM_STATUS_ICON_LARGE, | |
44 GAIM_STATUS_ICON_SMALL | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
45 |
5228 | 46 } GaimStatusIconSize; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
47 |
10008 | 48 #include "gtkgaim.h" |
49 #include "blist.h" | |
50 | |
5228 | 51 /************************************************************************** |
52 * @name Structures | |
53 **************************************************************************/ | |
54 /** | |
55 * Like, everything you need to know about the gtk buddy list | |
56 */ | |
10008 | 57 struct _GaimGtkBuddyList { |
5228 | 58 GtkWidget *window; |
59 GtkWidget *vbox; /**< This is the vbox that everything gets packed into. Your plugin might | |
60 want to pack something in it itself. Go, plugins! */ | |
61 | |
62 GtkWidget *treeview; /**< It's a treeview... d'uh. */ | |
63 GtkTreeStore *treemodel; /**< This is the treemodel. */ | |
6695 | 64 GtkTreeViewColumn *idle_column, |
65 *warning_column, | |
11016 | 66 *buddy_icon_column, |
67 *text_column; | |
68 | |
69 GtkCellRenderer *text_rend; | |
5228 | 70 |
5427 | 71 GtkItemFactory *ift; |
5228 | 72 GtkWidget *bpmenu; /**< The buddy pounce menu. */ |
73 | |
74 guint refresh_timer; /**< The timer for refreshing every 30 seconds */ | |
75 | |
76 guint timeout; /**< The timeout for the tooltip. */ | |
10354 | 77 guint drag_timeout; /**< The timeout for expanding contacts on drags */ |
7636 | 78 GdkRectangle tip_rect; /**< This is the bounding rectangle of the |
79 cell we're currently hovering over. This is | |
80 used for tooltips. */ | |
81 GdkRectangle contact_rect; /**< This is the bounding rectangle of the contact node | |
82 and its children. This is used for auto-expand on | |
83 mouseover. */ | |
84 GaimBlistNode *mouseover_contact; /**< This is the contact currently mouse-over expanded */ | |
85 | |
5228 | 86 GtkWidget *tipwindow; /**< The window used by the tooltip */ |
87 | |
88 GaimBlistNode *selected_node; /**< The currently selected node */ | |
10643 | 89 GtkWidget *statusbox; /**< The status selector dropdown */ |
7304 | 90 GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
91 GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
92 | |
10008 | 93 }; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
94 |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
95 #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
5228 | 96 #define GAIM_IS_GTK_BLIST(list) \ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
97 ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
5228 | 98 |
99 /************************************************************************** | |
5422 | 100 * @name GTK+ Buddy List API |
5228 | 101 **************************************************************************/ |
5906 | 102 |
103 /** | |
8815 | 104 * Get the handle for the GTK+ blist system. |
105 * | |
106 * @return the handle to the blist system | |
107 */ | |
108 void *gaim_gtk_blist_get_handle(); | |
109 | |
110 /** | |
5906 | 111 * Initializes the GTK+ blist system. |
112 */ | |
113 void gaim_gtk_blist_init(void); | |
114 | |
5228 | 115 /** |
8815 | 116 * Uninitializes the GTK+ blist system. |
117 */ | |
118 void gaim_gtk_blist_uninit(void); | |
119 | |
120 /** | |
5228 | 121 * Returns the UI operations structure for the buddy list. |
122 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
123 * @return The GTK+ list operations structure. |
5228 | 124 */ |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
125 GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
5228 | 126 |
127 /** | |
10643 | 128 * Returns the default gtk buddy list |
129 * | |
130 * There's normally only one buddy list window, but that isn't a necessity. This function | |
131 * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
132 * cleaner than an externed global. | |
133 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
134 * @return The default GTK+ buddy list |
10643 | 135 */ |
136 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
137 | |
138 /** | |
5228 | 139 * Returns the base image to represent the account, based on the currently selected theme |
140 * | |
141 * @param account The account. | |
6695 | 142 * |
5228 | 143 * @return The icon |
144 */ | |
10884 | 145 GdkPixbuf *gaim_gtk_create_prpl_icon(GaimAccount *account); |
5228 | 146 |
147 /** | |
9774 | 148 * Populates a menu with the items shown on the buddy list for a buddy. |
149 * | |
150 * @param menu The menu to populate | |
151 * @param buddy The buddy who's menu to get | |
10484 | 152 * @param sub TRUE if this is a sub-menu, FALSE otherwise |
9774 | 153 */ |
10484 | 154 void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
9774 | 155 |
156 /** | |
5228 | 157 * Refreshes all the nodes of the buddy list. |
158 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
159 * | |
160 * @param list This is the core list that gets updated from | |
161 */ | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
162 void gaim_gtk_blist_refresh(GaimBuddyList *list); |
5228 | 163 |
164 /** | |
165 * Tells the buddy list to update its toolbar based on the preferences | |
166 * | |
167 */ | |
168 void gaim_gtk_blist_update_toolbar(); | |
169 | |
170 /** | |
171 * Useful for the docklet plugin and also for the win32 tray icon | |
6695 | 172 * This is called when one of those is clicked--it will show/hide the |
173 * buddy list/login window--depending on which is active | |
5228 | 174 */ |
175 void gaim_gtk_blist_docklet_toggle(); | |
176 void gaim_gtk_blist_docklet_add(); | |
177 void gaim_gtk_blist_docklet_remove(); | |
178 void gaim_gtk_blist_update_columns(); | |
5411 | 179 void gaim_gtk_blist_update_refresh_timeout(); |
5228 | 180 |
181 /** | |
182 * Useful for the buddy ticker | |
183 */ | |
5234 | 184 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
5228 | 185 GaimStatusIconSize size); |
186 | |
11018 | 187 /** |
188 * Returns a boolean indicating if @a node is part of an expanded contact. | |
189 * | |
190 * This only makes sense for contact and buddy nodes. @c FALSE is returned | |
191 * for other types of nodes. | |
192 * | |
193 * @param node The node in question. | |
194 * @return A boolean indicating if @a node is part of an expanded contact. | |
195 */ | |
196 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node); | |
197 | |
5422 | 198 /************************************************************************** |
199 * @name GTK+ Buddy List sorting functions | |
200 **************************************************************************/ | |
201 | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
202 typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
5422 | 203 |
204 extern GSList *gaim_gtk_blist_sort_methods; | |
205 | |
206 struct gaim_gtk_blist_sort_method { | |
5631 | 207 char *id; |
5422 | 208 char *name; |
209 gaim_gtk_blist_sort_function func; | |
210 }; | |
211 | |
212 /** | |
213 * Registers a buddy list sorting method. | |
214 * | |
5631 | 215 * @param id The unique ID of the sorting method |
5422 | 216 * @param name The method's name. |
217 * @param func A pointer to the function. | |
218 * | |
219 */ | |
5631 | 220 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
5422 | 221 |
222 /** | |
223 * Unregisters a buddy list sorting method. | |
224 * | |
5631 | 225 * @param id The method's id |
5422 | 226 */ |
5631 | 227 void gaim_gtk_blist_sort_method_unreg(const char *id); |
5422 | 228 |
229 /** | |
230 * Sets a buddy list sorting method. | |
231 * | |
5631 | 232 * @param id The method's id. |
5422 | 233 */ |
5631 | 234 void gaim_gtk_blist_sort_method_set(const char *id); |
5422 | 235 |
236 /** | |
237 * Sets up the programs default sort methods | |
238 */ | |
239 void gaim_gtk_blist_setup_sort_methods(); | |
240 | |
5936
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
241 /** |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
242 * Updates the protocol actions menu on the GTK+ buddy list window. |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
243 */ |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
244 void gaim_gtk_blist_update_protocol_actions(); |
5422 | 245 |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
246 /** |
8986 | 247 * Updates the plugin actions menu on the GTK+ buddy list window. |
248 */ | |
249 void gaim_gtk_blist_update_plugin_actions(); | |
250 | |
251 /** | |
8940 | 252 * Determines if showing the join chat dialog is a valid action. |
253 * | |
254 * @return Returns TRUE if there are accounts online capable of | |
255 * joining chat rooms. Otherwise returns FALSE. | |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
256 */ |
8940 | 257 gboolean gaim_gtk_blist_joinchat_is_showable(void); |
258 | |
259 /** | |
260 * Shows the join chat dialog. | |
261 */ | |
262 void gaim_gtk_blist_joinchat_show(void); | |
5422 | 263 |
9051 | 264 /** |
265 * Appends the protocol specific menu items for a GaimBlistNode | |
266 */ | |
267 void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
268 | |
269 /** | |
270 * Appends the extended menu items for a GaimBlistNode | |
271 */ | |
272 void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
273 | |
9713 | 274 #endif /* _GAIM_GTKBLIST_H_ */ |