Mercurial > pidgin
annotate src/gtkblist.h @ 12119:312efb43c49a
[gaim-migrate @ 14419]
Let's try this modification to charkins latest visibility_manager change.
I moved the restore_position and show_all calls into the blist_show function,
since I really don't think we need to be showing and then iconifying the
blist everytime we set_visible gets called without a visibility manager.
I removed the gaim_blist_show call from connection.c that was causing the
blist window to be re-shown when an account connected. I think this was either
a remnant of the blist raise on events pref or a remnant from when we had a
Login screen. I don't think we need it anymore, someone let me know if this
breaks things. I also removed what I believe was the visibility_manager check
that was added to work around the annoyance this was causing.
committer: Tailor Script <tailor@pidgin.im>
author | Etan Reisner <pidgin@unreliablesource.net> |
---|---|
date | Thu, 17 Nov 2005 00:11:53 +0000 |
parents | e75ef7aa913e |
children | 370f9d7868f9 |
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. */ |
12116
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12080
diff
changeset
|
72 GtkWidget *menutray; /**< The menu tray widget. */ |
e75ef7aa913e
[gaim-migrate @ 14416]
Luke Schierer <lschiere@pidgin.im>
parents:
12080
diff
changeset
|
73 GtkWidget *menutrayicon; /**< The menu tray icon. */ |
5228 | 74 |
75 guint refresh_timer; /**< The timer for refreshing every 30 seconds */ | |
76 | |
77 guint timeout; /**< The timeout for the tooltip. */ | |
10354 | 78 guint drag_timeout; /**< The timeout for expanding contacts on drags */ |
7636 | 79 GdkRectangle tip_rect; /**< This is the bounding rectangle of the |
80 cell we're currently hovering over. This is | |
81 used for tooltips. */ | |
82 GdkRectangle contact_rect; /**< This is the bounding rectangle of the contact node | |
83 and its children. This is used for auto-expand on | |
84 mouseover. */ | |
85 GaimBlistNode *mouseover_contact; /**< This is the contact currently mouse-over expanded */ | |
86 | |
5228 | 87 GtkWidget *tipwindow; /**< The window used by the tooltip */ |
11890 | 88 GList *tooltipdata; /**< The data for each "chunk" of the tooltip */ |
5228 | 89 |
90 GaimBlistNode *selected_node; /**< The currently selected node */ | |
10643 | 91 GtkWidget *statusbox; /**< The status selector dropdown */ |
11732 | 92 GtkWidget *statusboxbox; /**< A box to hold per account status boxes */ |
93 GList *statusboxes; /**< A list of the per account status boxes */ | |
7304 | 94 GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
95 GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
96 | |
10008 | 97 }; |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
98 |
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
99 #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
5228 | 100 #define GAIM_IS_GTK_BLIST(list) \ |
7035
feb3d21a7794
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
101 ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
5228 | 102 |
103 /************************************************************************** | |
5422 | 104 * @name GTK+ Buddy List API |
5228 | 105 **************************************************************************/ |
5906 | 106 |
107 /** | |
8815 | 108 * Get the handle for the GTK+ blist system. |
109 * | |
110 * @return the handle to the blist system | |
111 */ | |
112 void *gaim_gtk_blist_get_handle(); | |
113 | |
114 /** | |
5906 | 115 * Initializes the GTK+ blist system. |
116 */ | |
117 void gaim_gtk_blist_init(void); | |
118 | |
5228 | 119 /** |
8815 | 120 * Uninitializes the GTK+ blist system. |
121 */ | |
122 void gaim_gtk_blist_uninit(void); | |
123 | |
124 /** | |
5228 | 125 * Returns the UI operations structure for the buddy list. |
126 * | |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
127 * @return The GTK+ list operations structure. |
5228 | 128 */ |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
129 GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
5228 | 130 |
131 /** | |
10643 | 132 * Returns the default gtk buddy list |
11732 | 133 * |
10643 | 134 * There's normally only one buddy list window, but that isn't a necessity. This function |
135 * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
136 * cleaner than an externed global. | |
11732 | 137 * |
10814
364a2ef907ae
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
138 * @return The default GTK+ buddy list |
10643 | 139 */ |
140 GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
141 | |
142 /** | |
9774 | 143 * Populates a menu with the items shown on the buddy list for a buddy. |
144 * | |
145 * @param menu The menu to populate | |
146 * @param buddy The buddy who's menu to get | |
10484 | 147 * @param sub TRUE if this is a sub-menu, FALSE otherwise |
9774 | 148 */ |
10484 | 149 void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
9774 | 150 |
151 /** | |
5228 | 152 * Refreshes all the nodes of the buddy list. |
153 * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
154 * | |
155 * @param list This is the core list that gets updated from | |
156 */ | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
157 void gaim_gtk_blist_refresh(GaimBuddyList *list); |
5228 | 158 |
159 /** | |
160 * Tells the buddy list to update its toolbar based on the preferences | |
161 * | |
162 */ | |
163 void gaim_gtk_blist_update_toolbar(); | |
164 | |
165 void gaim_gtk_blist_update_columns(); | |
5411 | 166 void gaim_gtk_blist_update_refresh_timeout(); |
5228 | 167 |
168 /** | |
169 * Useful for the buddy ticker | |
170 */ | |
5234 | 171 GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
5228 | 172 GaimStatusIconSize size); |
173 | |
11018 | 174 /** |
175 * Returns a boolean indicating if @a node is part of an expanded contact. | |
176 * | |
177 * This only makes sense for contact and buddy nodes. @c FALSE is returned | |
178 * for other types of nodes. | |
179 * | |
180 * @param node The node in question. | |
181 * @return A boolean indicating if @a node is part of an expanded contact. | |
182 */ | |
183 gboolean gaim_gtk_blist_node_is_contact_expanded(GaimBlistNode *node); | |
184 | |
12017
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
185 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
186 * 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
|
187 * 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
|
188 * it is hidden. If it is hidden it is shown. |
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 void gaim_gtk_blist_toggle_visibility(); |
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 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
193 * Increases the reference count of visibility managers. Callers should |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
194 * call the complementary remove function when no longer managing |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
195 * visibility. |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
196 * |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
197 * A visibility manager is something that provides some method for |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
198 * 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
|
199 */ |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
200 void gaim_gtk_blist_visibility_manager_add(); |
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 /** |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
203 * Decreases the reference count of visibility managers. If the count |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
204 * drops below zero, the buddy list is shown. |
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 void gaim_gtk_blist_visibility_manager_remove(); |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
207 |
2b6e0be024fb
[gaim-migrate @ 14310]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11890
diff
changeset
|
208 |
5422 | 209 /************************************************************************** |
210 * @name GTK+ Buddy List sorting functions | |
211 **************************************************************************/ | |
212 | |
7098
770233dad86c
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
213 typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
5422 | 214 |
11796 | 215 /** |
216 * Gets the current list of sort methods. | |
217 * | |
218 * @return A GSlist of sort methods | |
219 */ | |
220 GList *gaim_gtk_blist_get_sort_methods(); | |
5422 | 221 |
222 struct gaim_gtk_blist_sort_method { | |
5631 | 223 char *id; |
5422 | 224 char *name; |
225 gaim_gtk_blist_sort_function func; | |
226 }; | |
227 | |
11796 | 228 typedef struct gaim_gtk_blist_sort_method GaimGtkBlistSortMethod; |
229 | |
5422 | 230 /** |
231 * Registers a buddy list sorting method. | |
232 * | |
5631 | 233 * @param id The unique ID of the sorting method |
5422 | 234 * @param name The method's name. |
235 * @param func A pointer to the function. | |
236 * | |
237 */ | |
5631 | 238 void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
5422 | 239 |
240 /** | |
241 * Unregisters a buddy list sorting method. | |
242 * | |
5631 | 243 * @param id The method's id |
5422 | 244 */ |
5631 | 245 void gaim_gtk_blist_sort_method_unreg(const char *id); |
5422 | 246 |
247 /** | |
248 * Sets a buddy list sorting method. | |
249 * | |
5631 | 250 * @param id The method's id. |
5422 | 251 */ |
5631 | 252 void gaim_gtk_blist_sort_method_set(const char *id); |
5422 | 253 |
254 /** | |
255 * Sets up the programs default sort methods | |
256 */ | |
257 void gaim_gtk_blist_setup_sort_methods(); | |
258 | |
5936
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 * Updates the protocol actions menu on the GTK+ buddy list window. |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
261 */ |
1b56a833d665
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
262 void gaim_gtk_blist_update_protocol_actions(); |
5422 | 263 |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
264 /** |
8986 | 265 * Updates the plugin actions menu on the GTK+ buddy list window. |
266 */ | |
267 void gaim_gtk_blist_update_plugin_actions(); | |
268 | |
269 /** | |
11796 | 270 * Updates the Sorting menu on the GTK+ buddy list window. |
271 */ | |
272 void gaim_gtk_blist_update_sort_methods(); | |
273 | |
274 /** | |
8940 | 275 * Determines if showing the join chat dialog is a valid action. |
276 * | |
277 * @return Returns TRUE if there are accounts online capable of | |
278 * joining chat rooms. Otherwise returns FALSE. | |
8305
57bdd25752c1
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
279 */ |
8940 | 280 gboolean gaim_gtk_blist_joinchat_is_showable(void); |
281 | |
282 /** | |
283 * Shows the join chat dialog. | |
284 */ | |
285 void gaim_gtk_blist_joinchat_show(void); | |
5422 | 286 |
9051 | 287 /** |
288 * Appends the protocol specific menu items for a GaimBlistNode | |
289 */ | |
290 void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
291 | |
292 /** | |
293 * Appends the extended menu items for a GaimBlistNode | |
294 */ | |
295 void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
296 | |
9713 | 297 #endif /* _GAIM_GTKBLIST_H_ */ |