Mercurial > pidgin.yaz
annotate src/gtkblist.h @ 12136:370f9d7868f9
[gaim-migrate @ 14436]
SF Patch #1356575 from Kevin Stange (SimGuy)
"This patch moves buddy pounces out of the menu and into
a new dialog, as suggested by Sean. I'm not ready to
say this is finished, but it's a solid starting point
and it does work.
I changed the namespacing a little from gaim_gtkpounce
to gaim_gtk_pounce to be consistent with the rest of Gaim.
I wanted to try to get more information into the pounce
manager, but I wasn't sure how to display it. I
thought perhaps a column containing a row of icons
representing which events are being watched (so the
user can see which of several pounces for the same
buddy are which), however, while I know how to do this,
there aren't icons in Gaim suitable for representing
all the events. Like "returned from away" and
"idle/unidle", as far as I can see. I'm not sure what
else could be shown to make the manager dialog more
"informative."
The dialog updates automatically to show pounces only
for connected accounts and updates when a pounce is
added, changed, or removed in some other way than the
dialog.
I'd like to get feedback on it if anyone has anything
they think I should change or fix, I'll do that and
update this patch. Otherwise, feel free to commit. :)"
As ridingpigs commented in the tracker, this is "far better than the current menu thing."
I made a few small changes to this. I believe most of them were related to adding hooks to disable things if there were no accounts connected. I also sorte
d the Tools menu a bit and updated the docklet to match.
I wish the plugin action code could sort the items it added.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 18 Nov 2005 16:37:51 +0000 |
parents | e75ef7aa913e |
children | 2f4577ae3810 |
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; |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12080
diff
changeset
|
71 GtkWidget *menutray; /**< The menu tray widget. */ |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12080
diff
changeset
|
72 GtkWidget *menutrayicon; /**< The menu tray icon. */ |
5228 | 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 */ |
11890 | 87 GList *tooltipdata; /**< The data for each "chunk" of the tooltip */ |
5228 | 88 |
89 GaimBlistNode *selected_node; /**< The currently selected node */ | |
10643 | 90 GtkWidget *statusbox; /**< The status selector dropdown */ |
11732 | 91 GtkWidget *statusboxbox; /**< A box to hold per account status boxes */ |
92 GList *statusboxes; /**< A list of the per account status boxes */ | |
7304 | 93 GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
94 GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
95 | |
10008 | 96 }; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
97 |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
98 #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
5228 | 99 #define GAIM_IS_GTK_BLIST(list) \ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
100 ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
5228 | 101 |
102 /************************************************************************** | |
5422 | 103 * @name GTK+ Buddy List API |
5228 | 104 **************************************************************************/ |
5906 | 105 |
106 /** | |
8815 | 107 * Get the handle for the GTK+ blist system. |
108 * | |
109 * @return the handle to the blist system | |
110 */ | |
111 void *gaim_gtk_blist_get_handle(); | |
112 | |
113 /** | |
5906 | 114 * Initializes the GTK+ blist system. |
115 */ | |
116 void gaim_gtk_blist_init(void); | |
117 | |
5228 | 118 /** |
8815 | 119 * Uninitializes the GTK+ blist system. |
120 */ | |
121 void gaim_gtk_blist_uninit(void); | |
122 | |
123 /** | |
5228 | 124 * Returns the UI operations structure for the buddy list. |
125 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
126 * @return The GTK+ list operations structure. |
5228 | 127 */ |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
128 GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
5228 | 129 |
130 /** | |
10643 | 131 * Returns the default gtk buddy list |
11732 | 132 * |
10643 | 133 * There's normally only one buddy list window, but that isn't a necessity. This function |
134 * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
135 * cleaner than an externed global. | |
11732 | 136 * |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
137 * @return The default GTK+ buddy list |
10643 | 138 */ |
139 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
140 | |
141 /** | |
9774 | 142 * Populates a menu with the items shown on the buddy list for a buddy. |
143 * | |
144 * @param menu The menu to populate | |
145 * @param buddy The buddy who's menu to get | |
10484 | 146 * @param sub TRUE if this is a sub-menu, FALSE otherwise |
9774 | 147 */ |
10484 | 148 void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
9774 | 149 |
150 /** | |
5228 | 151 * Refreshes all the nodes of the buddy list. |
152 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
153 * | |
154 * @param list This is the core list that gets updated from | |
155 */ | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
156 void gaim_gtk_blist_refresh(GaimBuddyList *list); |
5228 | 157 |
158 /** | |
159 * Tells the buddy list to update its toolbar based on the preferences | |
160 * | |
161 */ | |
162 void gaim_gtk_blist_update_toolbar(); | |
163 | |
164 void gaim_gtk_blist_update_columns(); | |
5411 | 165 void gaim_gtk_blist_update_refresh_timeout(); |
5228 | 166 |
167 /** | |
168 * Useful for the buddy ticker | |
169 */ | |
5234 | 170 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
5228 | 171 GaimStatusIconSize size); |
172 | |
11018 | 173 /** |
174 * Returns a boolean indicating if @a node is part of an expanded contact. | |
175 * | |
176 * This only makes sense for contact and buddy nodes. @c FALSE is returned | |
177 * for other types of nodes. | |
178 * | |
179 * @param node The node in question. | |
180 * @return A boolean indicating if @a node is part of an expanded contact. | |
181 */ | |
182 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node); | |
183 | |
12017
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
184 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
185 * 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
|
186 * 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
|
187 * it is hidden. If it is hidden it is shown. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
188 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
189 void gaim_gtk_blist_toggle_visibility(); |
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 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
192 * Increases the reference count of visibility managers. Callers should |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
193 * call the complementary remove function when no longer managing |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
194 * visibility. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
195 * |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
196 * A visibility manager is something that provides some method for |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
197 * 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
|
198 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
199 void gaim_gtk_blist_visibility_manager_add(); |
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 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
202 * Decreases the reference count of visibility managers. If the count |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
203 * drops below zero, the buddy list is shown. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
204 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
205 void gaim_gtk_blist_visibility_manager_remove(); |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
206 |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
207 |
5422 | 208 /************************************************************************** |
209 * @name GTK+ Buddy List sorting functions | |
210 **************************************************************************/ | |
211 | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
212 typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
5422 | 213 |
11796 | 214 /** |
215 * Gets the current list of sort methods. | |
216 * | |
217 * @return A GSlist of sort methods | |
218 */ | |
219 GList *gaim_gtk_blist_get_sort_methods(); | |
5422 | 220 |
221 struct gaim_gtk_blist_sort_method { | |
5631 | 222 char *id; |
5422 | 223 char *name; |
224 gaim_gtk_blist_sort_function func; | |
225 }; | |
226 | |
11796 | 227 typedef struct gaim_gtk_blist_sort_method GaimGtkBlistSortMethod; |
228 | |
5422 | 229 /** |
230 * Registers a buddy list sorting method. | |
231 * | |
5631 | 232 * @param id The unique ID of the sorting method |
5422 | 233 * @param name The method's name. |
234 * @param func A pointer to the function. | |
235 * | |
236 */ | |
5631 | 237 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
5422 | 238 |
239 /** | |
240 * Unregisters a buddy list sorting method. | |
241 * | |
5631 | 242 * @param id The method's id |
5422 | 243 */ |
5631 | 244 void gaim_gtk_blist_sort_method_unreg(const char *id); |
5422 | 245 |
246 /** | |
247 * Sets a buddy list sorting method. | |
248 * | |
5631 | 249 * @param id The method's id. |
5422 | 250 */ |
5631 | 251 void gaim_gtk_blist_sort_method_set(const char *id); |
5422 | 252 |
253 /** | |
254 * Sets up the programs default sort methods | |
255 */ | |
256 void gaim_gtk_blist_setup_sort_methods(); | |
257 | |
5936
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
258 /** |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
259 * Updates the protocol actions menu on the GTK+ buddy list window. |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
260 */ |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
261 void gaim_gtk_blist_update_protocol_actions(); |
5422 | 262 |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
263 /** |
8986 | 264 * Updates the plugin actions menu on the GTK+ buddy list window. |
265 */ | |
266 void gaim_gtk_blist_update_plugin_actions(); | |
267 | |
268 /** | |
11796 | 269 * Updates the Sorting menu on the GTK+ buddy list window. |
270 */ | |
271 void gaim_gtk_blist_update_sort_methods(); | |
272 | |
273 /** | |
8940 | 274 * Determines if showing the join chat dialog is a valid action. |
275 * | |
276 * @return Returns TRUE if there are accounts online capable of | |
277 * joining chat rooms. Otherwise returns FALSE. | |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
278 */ |
8940 | 279 gboolean gaim_gtk_blist_joinchat_is_showable(void); |
280 | |
281 /** | |
282 * Shows the join chat dialog. | |
283 */ | |
284 void gaim_gtk_blist_joinchat_show(void); | |
5422 | 285 |
9051 | 286 /** |
287 * Appends the protocol specific menu items for a GaimBlistNode | |
288 */ | |
289 void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
290 | |
291 /** | |
292 * Appends the extended menu items for a GaimBlistNode | |
293 */ | |
294 void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
295 | |
9713 | 296 #endif /* _GAIM_GTKBLIST_H_ */ |