| 1 /* |
|
| 2 * finch |
|
| 3 * |
|
| 4 * Finch is the legal property of its developers, whose names are too numerous |
|
| 5 * to list here. Please refer to the COPYRIGHT file distributed with this |
|
| 6 * source distribution. |
|
| 7 * |
|
| 8 * This program is free software; you can redistribute it and/or modify |
|
| 9 * it under the terms of the GNU General Public License as published by |
|
| 10 * the Free Software Foundation; either version 2 of the License, or |
|
| 11 * (at your option) any later version. |
|
| 12 * |
|
| 13 * This program is distributed in the hope that it will be useful, |
|
| 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
| 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
| 16 * GNU General Public License for more details. |
|
| 17 * |
|
| 18 * You should have received a copy of the GNU General Public License |
|
| 19 * along with this program; if not, write to the Free Software |
|
| 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
|
| 21 */ |
|
| 22 |
|
| 23 #if !defined(FINCH_GLOBAL_HEADER_INSIDE) && !defined(FINCH_COMPILATION) |
|
| 24 # error "only <finch.h> may be included directly" |
|
| 25 #endif |
|
| 26 |
|
| 27 #ifndef FINCH_BLIST_H |
|
| 28 #define FINCH_BLIST_H |
|
| 29 |
|
| 30 #include <purple.h> |
|
| 31 |
|
| 32 #include <gnt.h> |
|
| 33 |
|
| 34 #define FINCH_TYPE_BUDDY_LIST (finch_buddy_list_get_type()) |
|
| 35 #define FINCH_TYPE_BLIST_MANAGER (finch_blist_manager_get_type()) |
|
| 36 |
|
| 37 /********************************************************************** |
|
| 38 * GNT BuddyList API |
|
| 39 **********************************************************************/ |
|
| 40 |
|
| 41 typedef struct _FinchBlistManager FinchBlistManager; |
|
| 42 |
|
| 43 /** |
|
| 44 * FinchBlistManager: |
|
| 45 * @id: An identifier for the manager. |
|
| 46 * @name: Displayable name for the manager. |
|
| 47 * @init: Called right before it's being used. |
|
| 48 * @uninit: Called right after it's not being used any more. |
|
| 49 * @can_add_node: Whether a node should be added to the view. |
|
| 50 * @find_parent: Find the parent row for a node. |
|
| 51 * @create_tooltip: Create tooltip for a selected row. |
|
| 52 * |
|
| 53 * Buddylist manager for finch. This decides the visility, ordering and hierarchy |
|
| 54 * of the buddylist nodes. This also manages the creation of tooltips. |
|
| 55 */ |
|
| 56 struct _FinchBlistManager |
|
| 57 { |
|
| 58 const char *id; |
|
| 59 const char *name; |
|
| 60 gboolean (*init)(void); |
|
| 61 gboolean (*uninit)(void); |
|
| 62 gboolean (*can_add_node)(PurpleBlistNode *node); |
|
| 63 gpointer (*find_parent)(PurpleBlistNode *node); |
|
| 64 gboolean (*create_tooltip)(gpointer selected_row, GString **body, char **title); |
|
| 65 |
|
| 66 /*< private >*/ |
|
| 67 gpointer reserved[4]; |
|
| 68 }; |
|
| 69 |
|
| 70 GType finch_blist_manager_get_type(void); |
|
| 71 |
|
| 72 G_DECLARE_FINAL_TYPE(FinchBuddyList, finch_buddy_list, FINCH, BUDDY_LIST, |
|
| 73 PurpleBuddyList) |
|
| 74 |
|
| 75 /** |
|
| 76 * finch_blist_init: |
|
| 77 * |
|
| 78 * Perform necessary initializations. |
|
| 79 */ |
|
| 80 void finch_blist_init(void); |
|
| 81 |
|
| 82 /** |
|
| 83 * finch_blist_uninit: |
|
| 84 * |
|
| 85 * Perform necessary uninitializations. |
|
| 86 */ |
|
| 87 void finch_blist_uninit(void); |
|
| 88 |
|
| 89 /** |
|
| 90 * finch_blist_show: |
|
| 91 * |
|
| 92 * Show the buddy list. |
|
| 93 */ |
|
| 94 void finch_blist_show(void); |
|
| 95 |
|
| 96 /** |
|
| 97 * finch_blist_get_position: |
|
| 98 * @x: The x-coordinate is set here if not %NULL. |
|
| 99 * @y: The y-coordinate is set here if not %NULL. |
|
| 100 * |
|
| 101 * Get the position of the buddy list. |
|
| 102 * |
|
| 103 * Returns: Returns %TRUE if the values were set, %FALSE otherwise. |
|
| 104 */ |
|
| 105 gboolean finch_blist_get_position(int *x, int *y); |
|
| 106 |
|
| 107 /** |
|
| 108 * finch_blist_set_position: |
|
| 109 * @x: The x-coordinate of the buddy list. |
|
| 110 * @y: The y-coordinate of the buddy list. |
|
| 111 * |
|
| 112 * Set the position of the buddy list. |
|
| 113 */ |
|
| 114 void finch_blist_set_position(int x, int y); |
|
| 115 |
|
| 116 /** |
|
| 117 * finch_blist_get_size: |
|
| 118 * @width: The width is set here if not %NULL. |
|
| 119 * @height: The height is set here if not %NULL. |
|
| 120 * |
|
| 121 * Get the size of the buddy list. |
|
| 122 * |
|
| 123 * Returns: Returns %TRUE if the values were set, %FALSE otherwise. |
|
| 124 */ |
|
| 125 gboolean finch_blist_get_size(int *width, int *height); |
|
| 126 |
|
| 127 /** |
|
| 128 * finch_blist_set_size: |
|
| 129 * @width: The width of the buddy list. |
|
| 130 * @height: The height of the buddy list. |
|
| 131 * |
|
| 132 * Set the size of the buddy list. |
|
| 133 */ |
|
| 134 void finch_blist_set_size(int width, int height); |
|
| 135 |
|
| 136 /** |
|
| 137 * finch_retrieve_user_info: |
|
| 138 * @conn: The connection to get information from |
|
| 139 * @name: The user to get information about. |
|
| 140 * |
|
| 141 * Get information about a user. Show immediate feedback. |
|
| 142 * |
|
| 143 * Returns: (transfer none): Returns the ui-handle for the userinfo |
|
| 144 * notification. |
|
| 145 */ |
|
| 146 gpointer finch_retrieve_user_info(PurpleConnection *conn, const char *name); |
|
| 147 |
|
| 148 /** |
|
| 149 * finch_blist_get_tree: |
|
| 150 * |
|
| 151 * Get the tree list of the buddy list. |
|
| 152 * |
|
| 153 * Returns: (transfer none): The GntTree widget. |
|
| 154 */ |
|
| 155 GntTree * finch_blist_get_tree(void); |
|
| 156 |
|
| 157 /** |
|
| 158 * finch_blist_install_manager: |
|
| 159 * @manager: The alternate buddylist manager. |
|
| 160 * |
|
| 161 * Add an alternate buddy list manager. |
|
| 162 */ |
|
| 163 void finch_blist_install_manager(const FinchBlistManager *manager); |
|
| 164 |
|
| 165 /** |
|
| 166 * finch_blist_uninstall_manager: |
|
| 167 * @manager: The buddy list manager to remove. |
|
| 168 * |
|
| 169 * Remove an alternate buddy list manager. |
|
| 170 */ |
|
| 171 void finch_blist_uninstall_manager(const FinchBlistManager *manager); |
|
| 172 |
|
| 173 /** |
|
| 174 * finch_blist_manager_find: |
|
| 175 * @id: The identifier for the desired buddy list manager. |
|
| 176 * |
|
| 177 * Find a buddy list manager. |
|
| 178 * |
|
| 179 * Returns: The manager with the requested identifier, if available. %NULL |
|
| 180 * otherwise. |
|
| 181 */ |
|
| 182 FinchBlistManager * finch_blist_manager_find(const char *id); |
|
| 183 |
|
| 184 /** |
|
| 185 * finch_blist_manager_add_node: |
|
| 186 * @node: The node to add |
|
| 187 * |
|
| 188 * Request the active buddy list manager to add a node. |
|
| 189 */ |
|
| 190 void finch_blist_manager_add_node(PurpleBlistNode *node); |
|
| 191 |
|
| 192 #endif /* FINCH_BLIST_H */ |
|
| 193 |
|