Tue, 02 Dec 2003 16:37:22 +0000
[gaim-migrate @ 8346]
saen maent tihs
| 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 | * | |
| 7 | * Copyright (C) 2002-2003, Sean Egan <sean.egan@binghamton.edu> | |
| 5906 | 8 | * |
| 5228 | 9 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License as published by | |
| 11 | * the Free Software Foundation; either version 2 of the License, or | |
| 12 | * (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, | |
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 | * GNU General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 20 | * along with this program; if not, write to the Free Software | |
| 21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
| 22 | */ | |
| 23 | ||
| 24 | #ifndef _GAIM_GTK_LIST_H_ | |
| 25 | #define _GAIM_GTK_LIST_H_ | |
| 26 | ||
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
27 | #include "blist.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5631
diff
changeset
|
28 | |
| 5228 | 29 | enum { |
| 30 | STATUS_ICON_COLUMN, | |
| 31 | STATUS_ICON_VISIBLE_COLUMN, | |
| 32 | NAME_COLUMN, | |
| 33 | WARNING_COLUMN, | |
| 34 | IDLE_COLUMN, | |
| 35 | BUDDY_ICON_COLUMN, | |
| 36 | NODE_COLUMN, | |
| 37 | BLIST_COLUMNS | |
| 38 | }; | |
| 39 | ||
| 40 | typedef enum { | |
| 41 | GAIM_STATUS_ICON_LARGE, | |
| 42 | GAIM_STATUS_ICON_SMALL | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
43 | |
| 5228 | 44 | } GaimStatusIconSize; |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
45 | |
| 5228 | 46 | /************************************************************************** |
| 47 | * @name Structures | |
| 48 | **************************************************************************/ | |
| 49 | /** | |
| 50 | * Like, everything you need to know about the gtk buddy list | |
| 51 | */ | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
52 | typedef struct { |
| 5228 | 53 | GtkWidget *window; |
| 54 | GtkWidget *vbox; /**< This is the vbox that everything gets packed into. Your plugin might | |
| 55 | want to pack something in it itself. Go, plugins! */ | |
| 56 | ||
| 57 | GtkWidget *treeview; /**< It's a treeview... d'uh. */ | |
| 58 | GtkTreeStore *treemodel; /**< This is the treemodel. */ | |
| 6695 | 59 | GtkTreeViewColumn *idle_column, |
| 60 | *warning_column, | |
| 5228 | 61 | *buddy_icon_column; |
| 62 | ||
|
5427
a45fa07ef20d
[gaim-migrate @ 5806]
Mark Doliner <markdoliner@pidgin.im>
parents:
5422
diff
changeset
|
63 | GtkItemFactory *ift; |
| 5228 | 64 | GtkWidget *bpmenu; /**< The buddy pounce menu. */ |
| 65 | ||
| 66 | GtkWidget *bbox; /**< A Button Box. */ | |
| 67 | GtkTooltips *tooltips; /**< Tooltips for the buttons. */ | |
| 68 | ||
| 69 | guint refresh_timer; /**< The timer for refreshing every 30 seconds */ | |
| 70 | ||
| 71 | guint timeout; /**< The timeout for the tooltip. */ | |
| 7636 | 72 | GdkRectangle tip_rect; /**< This is the bounding rectangle of the |
| 73 | cell we're currently hovering over. This is | |
| 74 | used for tooltips. */ | |
| 75 | GdkRectangle contact_rect; /**< This is the bounding rectangle of the contact node | |
| 76 | and its children. This is used for auto-expand on | |
| 77 | mouseover. */ | |
| 78 | GaimBlistNode *mouseover_contact; /**< This is the contact currently mouse-over expanded */ | |
| 79 | ||
| 5228 | 80 | GtkWidget *tipwindow; /**< The window used by the tooltip */ |
| 81 | ||
| 82 | GaimBlistNode *selected_node; /**< The currently selected node */ | |
| 83 | ||
| 7304 | 84 | GdkPixbuf *east, *south; /**< Drop shadow stuff */ |
| 85 | GdkWindow *east_shadow, *south_shadow; /**< Drop shadow stuff */ | |
| 86 | ||
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
87 | } GaimGtkBuddyList; |
|
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
88 | |
|
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
89 | #define GAIM_GTK_BLIST(list) ((GaimGtkBuddyList *)(list)->ui_data) |
| 5228 | 90 | #define GAIM_IS_GTK_BLIST(list) \ |
|
7035
76bca80cd91d
[gaim-migrate @ 7598]
Christian Hammond <chipx86@chipx86.com>
parents:
6695
diff
changeset
|
91 | ((list)->ui_ops == gaim_gtk_blist_get_ui_ops()) |
| 5228 | 92 | |
| 93 | /************************************************************************** | |
| 5422 | 94 | * @name GTK+ Buddy List API |
| 5228 | 95 | **************************************************************************/ |
| 5906 | 96 | |
| 97 | /** | |
| 98 | * Initializes the GTK+ blist system. | |
| 99 | */ | |
| 100 | void gaim_gtk_blist_init(void); | |
| 101 | ||
| 5228 | 102 | /** |
| 103 | * Returns the UI operations structure for the buddy list. | |
| 104 | * | |
| 105 | * @return The GTK list operations structure. | |
| 106 | */ | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
107 | GaimBlistUiOps *gaim_gtk_blist_get_ui_ops(void); |
| 5228 | 108 | |
| 109 | /** | |
| 110 | * Returns the base image to represent the account, based on the currently selected theme | |
| 111 | * | |
| 112 | * @param account The account. | |
| 6695 | 113 | * |
| 5228 | 114 | * @return The icon |
| 115 | */ | |
|
5563
d5a7852aa0cb
[gaim-migrate @ 5965]
Christian Hammond <chipx86@chipx86.com>
parents:
5427
diff
changeset
|
116 | GdkPixbuf *create_prpl_icon(GaimAccount *account); |
| 5228 | 117 | |
| 118 | /** | |
| 119 | * Refreshes all the nodes of the buddy list. | |
| 120 | * This should only be called when something changes to affect most of the nodes (such as a ui preference changing) | |
| 121 | * | |
| 122 | * @param list This is the core list that gets updated from | |
| 123 | */ | |
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
124 | void gaim_gtk_blist_refresh(GaimBuddyList *list); |
| 5228 | 125 | |
| 126 | /** | |
| 127 | * Tells the buddy list to update its toolbar based on the preferences | |
| 128 | * | |
| 129 | */ | |
| 130 | void gaim_gtk_blist_update_toolbar(); | |
| 131 | ||
| 132 | /** | |
| 133 | * Useful for the docklet plugin and also for the win32 tray icon | |
| 6695 | 134 | * This is called when one of those is clicked--it will show/hide the |
| 135 | * buddy list/login window--depending on which is active | |
| 5228 | 136 | */ |
| 137 | void gaim_gtk_blist_docklet_toggle(); | |
| 138 | void gaim_gtk_blist_docklet_add(); | |
| 139 | void gaim_gtk_blist_docklet_remove(); | |
| 140 | void gaim_gtk_blist_update_columns(); | |
|
5411
b3683d2acbb4
[gaim-migrate @ 5787]
Mark Doliner <markdoliner@pidgin.im>
parents:
5248
diff
changeset
|
141 | void gaim_gtk_blist_update_refresh_timeout(); |
| 5228 | 142 | |
| 143 | /** | |
| 144 | * Useful for the buddy ticker | |
| 145 | */ | |
| 5234 | 146 | GdkPixbuf *gaim_gtk_blist_get_status_icon(GaimBlistNode *node, |
| 5228 | 147 | GaimStatusIconSize size); |
| 148 | ||
| 5422 | 149 | /************************************************************************** |
| 150 | * @name GTK+ Buddy List sorting functions | |
| 151 | **************************************************************************/ | |
| 152 | ||
|
7098
22eabd4f5ed4
[gaim-migrate @ 7663]
Christian Hammond <chipx86@chipx86.com>
parents:
7035
diff
changeset
|
153 | typedef GtkTreeIter (*gaim_gtk_blist_sort_function)(GaimBlistNode *new, GaimBuddyList *blist, GtkTreeIter group, GtkTreeIter *cur); |
| 5422 | 154 | |
| 155 | extern GSList *gaim_gtk_blist_sort_methods; | |
| 156 | ||
| 157 | struct gaim_gtk_blist_sort_method { | |
| 5631 | 158 | char *id; |
| 5422 | 159 | char *name; |
| 160 | gaim_gtk_blist_sort_function func; | |
| 161 | }; | |
| 162 | ||
| 163 | /** | |
| 164 | * Registers a buddy list sorting method. | |
| 165 | * | |
| 5631 | 166 | * @param id The unique ID of the sorting method |
| 5422 | 167 | * @param name The method's name. |
| 168 | * @param func A pointer to the function. | |
| 169 | * | |
| 170 | */ | |
| 5631 | 171 | void gaim_gtk_blist_sort_method_reg(const char *id, const char *name, gaim_gtk_blist_sort_function func); |
| 5422 | 172 | |
| 173 | /** | |
| 174 | * Unregisters a buddy list sorting method. | |
| 175 | * | |
| 5631 | 176 | * @param id The method's id |
| 5422 | 177 | */ |
| 5631 | 178 | void gaim_gtk_blist_sort_method_unreg(const char *id); |
| 5422 | 179 | |
| 180 | /** | |
| 181 | * Sets a buddy list sorting method. | |
| 182 | * | |
| 5631 | 183 | * @param id The method's id. |
| 5422 | 184 | */ |
| 5631 | 185 | void gaim_gtk_blist_sort_method_set(const char *id); |
| 5422 | 186 | |
| 187 | /** | |
| 188 | * Sets up the programs default sort methods | |
| 189 | */ | |
| 190 | void gaim_gtk_blist_setup_sort_methods(); | |
| 191 | ||
|
5936
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
192 | /** |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
193 | * Updates the protocol actions menu on the GTK+ buddy list window. |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
194 | */ |
|
4bac764cc792
[gaim-migrate @ 6376]
Christian Hammond <chipx86@chipx86.com>
parents:
5906
diff
changeset
|
195 | void gaim_gtk_blist_update_protocol_actions(); |
| 5422 | 196 | |
| 197 | ||
| 5228 | 198 | #endif /* _GAIM_GTK_LIST_H_ */ |