Mon, 11 Apr 2005 12:24:47 +0000
[gaim-migrate @ 12468]
same thing here, changing to consistently using GTK+, by rlaager
| 5228 | 1 | /** |
|
5248
f4f944f4dbe0
[gaim-migrate @ 5620]
Mark Doliner <markdoliner@pidgin.im>
parents:
5234
diff
changeset
|
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
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9051
diff
changeset
|
25 | #ifndef _GAIM_GTKBLIST_H_ |
|
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9051
diff
changeset
|
26 | #define _GAIM_GTKBLIST_H_ |
| 5228 | 27 | |
|
10008
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
28 | typedef struct _GaimGtkBuddyList GaimGtkBuddyList; |
|
5872
754c63f29b77
[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
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
39 | |
|
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
40 | }; |
| 5228 | 41 | |
| 42 | typedef enum { | |
| 43 | GAIM_STATUS_ICON_LARGE, | |
| 44 | GAIM_STATUS_ICON_SMALL | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
45 | |
| 5228 | 46 | } GaimStatusIconSize; |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
47 | |
|
10008
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
48 | #include "gtkgaim.h" |
|
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
49 | #include "blist.h" |
|
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
50 | |
| 5228 | 51 | /************************************************************************** |
| 52 | * @name Structures | |
| 53 | **************************************************************************/ | |
| 54 | /** | |
| 55 | * Like, everything you need to know about the gtk buddy list | |
| 56 | */ | |
|
10008
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
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, | |
| 5228 | 66 | *buddy_icon_column; |
| 67 | ||
|
5427
a45fa07ef20d
[gaim-migrate @ 5806]
Mark Doliner <markdoliner@pidgin.im>
parents:
5422
diff
changeset
|
68 | GtkItemFactory *ift; |
| 5228 | 69 | GtkWidget *bpmenu; /**< The buddy pounce menu. */ |
| 70 | ||
| 71 | guint refresh_timer; /**< The timer for refreshing every 30 seconds */ | |
| 72 | ||
| 73 | guint timeout; /**< The timeout for the tooltip. */ | |
| 10354 | 74 | guint drag_timeout; /**< The timeout for expanding contacts on drags */ |
| 7636 | 75 | GdkRectangle tip_rect; /**< This is the bounding rectangle of the |
| 76 | cell we're currently hovering over. This is | |
| 77 | used for tooltips. */ | |
| 78 | GdkRectangle contact_rect; /**< This is the bounding rectangle of the contact node | |
| 79 | and its children. This is used for auto-expand on | |
| 80 | mouseover. */ | |
| 81 | GaimBlistNode *mouseover_contact; /**< This is the contact currently mouse-over expanded */ | |
| 82 | ||
| 5228 | 83 | GtkWidget *tipwindow; /**< The window used by the tooltip */ |
| 84 | ||
| 85 | GaimBlistNode *selected_node; /**< The currently selected node */ | |
| 10643 | 86 | GtkWidget *statusbox; /**< The status selector dropdown */ |
| 7304 | 87 | GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
| 88 | GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
| 89 | ||
|
10008
1de3454a0dca
[gaim-migrate @ 10925]
Mark Doliner <markdoliner@pidgin.im>
parents:
9791
diff
changeset
|
90 | }; |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
91 | |
|
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
92 | #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
| 5228 | 93 | #define GAIM_IS_GTK_BLIST(list) \ |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
94 | ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
| 5228 | 95 | |
| 96 | /************************************************************************** | |
| 5422 | 97 | * @name GTK+ Buddy List API |
| 5228 | 98 | **************************************************************************/ |
| 5906 | 99 | |
| 100 | /** | |
| 8815 | 101 | * Get the handle for the GTK+ blist system. |
| 102 | * | |
| 103 | * @return the handle to the blist system | |
| 104 | */ | |
| 105 | void *gaim_gtk_blist_get_handle(); | |
| 106 | ||
| 107 | /** | |
| 5906 | 108 | * Initializes the GTK+ blist system. |
| 109 | */ | |
| 110 | void gaim_gtk_blist_init(void); | |
| 111 | ||
| 5228 | 112 | /** |
| 8815 | 113 | * Uninitializes the GTK+ blist system. |
| 114 | */ | |
| 115 | void gaim_gtk_blist_uninit(void); | |
| 116 | ||
| 117 | /** | |
| 5228 | 118 | * Returns the UI operations structure for the buddy list. |
| 119 | * | |
|
10814
7e17cb56b019
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
120 | * @return The GTK+ list operations structure. |
| 5228 | 121 | */ |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
122 | GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
| 5228 | 123 | |
| 124 | /** | |
| 10643 | 125 | * Returns the default gtk buddy list |
| 126 | * | |
| 127 | * There's normally only one buddy list window, but that isn't a necessity. This function | |
| 128 | * returns the GaimGtkBuddyList we're most likely wanting to work with. This is slightly | |
| 129 | * cleaner than an externed global. | |
| 130 | * | |
|
10814
7e17cb56b019
[gaim-migrate @ 12468]
Luke Schierer <lschiere@pidgin.im>
parents:
10643
diff
changeset
|
131 | * @return The default GTK+ buddy list |
| 10643 | 132 | */ |
| 133 | GaimGtkBuddyList *gaim_gtk_blist_get_default_gtk_blist(); | |
| 134 | ||
| 135 | /** | |
| 5228 | 136 | * Returns the base image to represent the account, based on the currently selected theme |
| 137 | * | |
| 138 | * @param account The account. | |
| 6695 | 139 | * |
| 5228 | 140 | * @return The icon |
| 141 | */ | |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5427
diff
changeset
|
142 | GdkPixbuf *create_prpl_icon(GaimAccount *account); |
| 5228 | 143 | |
| 144 | /** | |
| 9774 | 145 | * Populates a menu with the items shown on the buddy list for a buddy. |
| 146 | * | |
| 147 | * @param menu The menu to populate | |
| 148 | * @param buddy The buddy who's menu to get | |
| 10484 | 149 | * @param sub TRUE if this is a sub-menu, FALSE otherwise |
| 9774 | 150 | */ |
| 10484 | 151 | void gaim_gtk_blist_make_buddy_menu(GtkWidget *menu, GaimBuddy *buddy, gboolean sub); |
| 9774 | 152 | |
| 153 | /** | |
| 5228 | 154 | * Refreshes all the nodes of the buddy list. |
| 155 | * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
| 156 | * | |
| 157 | * @param list This is the core list that gets updated from | |
| 158 | */ | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
159 | void gaim_gtk_blist_refresh(GaimBuddyList *list); |
| 5228 | 160 | |
| 161 | /** | |
| 162 | * Tells the buddy list to update its toolbar based on the preferences | |
| 163 | * | |
| 164 | */ | |
| 165 | void gaim_gtk_blist_update_toolbar(); | |
| 166 | ||
| 167 | /** | |
| 168 | * Useful for the docklet plugin and also for the win32 tray icon | |
| 6695 | 169 | * This is called when one of those is clicked--it will show/hide the |
| 170 | * buddy list/login window--depending on which is active | |
| 5228 | 171 | */ |
| 172 | void gaim_gtk_blist_docklet_toggle(); | |
| 173 | void gaim_gtk_blist_docklet_add(); | |
| 174 | void gaim_gtk_blist_docklet_remove(); | |
| 175 | void gaim_gtk_blist_update_columns(); | |
|
5411
b3683d2acbb4
[gaim-migrate @ 5787]
Mark Doliner <markdoliner@pidgin.im>
parents:
5248
diff
changeset
|
176 | void gaim_gtk_blist_update_refresh_timeout(); |
| 5228 | 177 | |
| 178 | /** | |
| 179 | * Useful for the buddy ticker | |
| 180 | */ | |
| 5234 | 181 | GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
| 5228 | 182 | GaimStatusIconSize size); |
| 183 | ||
| 5422 | 184 | /************************************************************************** |
| 185 | * @name GTK+ Buddy List sorting functions | |
| 186 | **************************************************************************/ | |
| 187 | ||
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
188 | typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
| 5422 | 189 | |
| 190 | extern GSList *gaim_gtk_blist_sort_methods; | |
| 191 | ||
| 192 | struct gaim_gtk_blist_sort_method { | |
| 5631 | 193 | char *id; |
| 5422 | 194 | char *name; |
| 195 | gaim_gtk_blist_sort_function func; | |
| 196 | }; | |
| 197 | ||
| 198 | /** | |
| 199 | * Registers a buddy list sorting method. | |
| 200 | * | |
| 5631 | 201 | * @param id The unique ID of the sorting method |
| 5422 | 202 | * @param name The method's name. |
| 203 | * @param func A pointer to the function. | |
| 204 | * | |
| 205 | */ | |
| 5631 | 206 | void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
| 5422 | 207 | |
| 208 | /** | |
| 209 | * Unregisters a buddy list sorting method. | |
| 210 | * | |
| 5631 | 211 | * @param id The method's id |
| 5422 | 212 | */ |
| 5631 | 213 | void gaim_gtk_blist_sort_method_unreg(const char *id); |
| 5422 | 214 | |
| 215 | /** | |
| 216 | * Sets a buddy list sorting method. | |
| 217 | * | |
| 5631 | 218 | * @param id The method's id. |
| 5422 | 219 | */ |
| 5631 | 220 | void gaim_gtk_blist_sort_method_set(const char *id); |
| 5422 | 221 | |
| 222 | /** | |
| 223 | * Sets up the programs default sort methods | |
| 224 | */ | |
| 225 | void gaim_gtk_blist_setup_sort_methods(); | |
| 226 | ||
|
5936
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
227 | /** |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
228 | * Updates the protocol actions menu on the GTK+ buddy list window. |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
229 | */ |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
230 | void gaim_gtk_blist_update_protocol_actions(); |
| 5422 | 231 | |
|
8305
5a6d1168a8b3
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
232 | /** |
|
8986
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8940
diff
changeset
|
233 | * Updates the plugin actions menu on the GTK+ buddy list window. |
|
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8940
diff
changeset
|
234 | */ |
|
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8940
diff
changeset
|
235 | void gaim_gtk_blist_update_plugin_actions(); |
|
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8940
diff
changeset
|
236 | |
|
30ba617356bb
[gaim-migrate @ 9761]
Christopher O'Brien <siege@pidgin.im>
parents:
8940
diff
changeset
|
237 | /** |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
238 | * Determines if showing the join chat dialog is a valid action. |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
239 | * |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
240 | * @return Returns TRUE if there are accounts online capable of |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
241 | * joining chat rooms. Otherwise returns FALSE. |
|
8305
5a6d1168a8b3
[gaim-migrate @ 9029]
Christian Hammond <chipx86@chipx86.com>
parents:
8046
diff
changeset
|
242 | */ |
|
8940
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
243 | gboolean gaim_gtk_blist_joinchat_is_showable(void); |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
244 | |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
245 | /** |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
246 | * Shows the join chat dialog. |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
247 | */ |
|
3e22cf150db0
[gaim-migrate @ 9710]
Mark Doliner <markdoliner@pidgin.im>
parents:
8815
diff
changeset
|
248 | void gaim_gtk_blist_joinchat_show(void); |
| 5422 | 249 | |
| 9051 | 250 | /** |
| 251 | * Appends the protocol specific menu items for a GaimBlistNode | |
| 252 | */ | |
| 253 | void gaim_gtk_append_blist_node_proto_menu (GtkWidget *menu, GaimConnection *gc, GaimBlistNode *node); | |
| 254 | ||
| 255 | /** | |
| 256 | * Appends the extended menu items for a GaimBlistNode | |
| 257 | */ | |
| 258 | void gaim_gtk_append_blist_node_extended_menu(GtkWidget *menu, GaimBlistNode *node); | |
| 259 | ||
|
9713
bb37562302a1
[gaim-migrate @ 10574]
Mark Doliner <markdoliner@pidgin.im>
parents:
9051
diff
changeset
|
260 | #endif /* _GAIM_GTKBLIST_H_ */ |