Migrate certificates, icons, logs to XDG dirs
[pidgin-git.git] / pidgin / gtkconv.h
blob76df96fb6c7a0f97b3670412e21b1bc921f45618
1 /* pidgin
3 * Pidgin is the legal property of its developers, whose names are too numerous
4 * to list here. Please refer to the COPYRIGHT file distributed with this
5 * source distribution.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
22 #ifndef _PIDGIN_CONVERSATION_H_
23 #define _PIDGIN_CONVERSATION_H_
24 /**
25 * SECTION:gtkconv
26 * @section_id: pidgin-gtkconv
27 * @short_description: <filename>gtkconv.h</filename>
28 * @title: Conversation API
29 * @see_also: <link linkend="chapter-signals-gtkconv">Conversation signals</link>
32 #define PIDGIN_TYPE_CONVERSATION (pidgin_conversation_get_type())
34 typedef struct _PidginImPane PidginImPane;
35 typedef struct _PidginChatPane PidginChatPane;
36 typedef struct _PidginConversation PidginConversation;
38 /**
39 * PidginUnseenState:
40 * @PIDGIN_UNSEEN_NONE: No unseen text in the conversation.
41 * @PIDGIN_UNSEEN_EVENT: Unseen events in the conversation.
42 * @PIDGIN_UNSEEN_NO_LOG: Unseen text with NO_LOG flag.
43 * @PIDGIN_UNSEEN_TEXT: Unseen text in the conversation.
44 * @PIDGIN_UNSEEN_NICK: Unseen text and the nick was said.
46 * Unseen text states.
48 typedef enum
50 PIDGIN_UNSEEN_NONE,
51 PIDGIN_UNSEEN_EVENT,
52 PIDGIN_UNSEEN_NO_LOG,
53 PIDGIN_UNSEEN_TEXT,
54 PIDGIN_UNSEEN_NICK
55 } PidginUnseenState;
57 enum {
58 CHAT_USERS_ICON_COLUMN,
59 CHAT_USERS_ALIAS_COLUMN,
60 CHAT_USERS_ALIAS_KEY_COLUMN,
61 CHAT_USERS_NAME_COLUMN,
62 CHAT_USERS_FLAGS_COLUMN,
63 CHAT_USERS_COLOR_COLUMN,
64 CHAT_USERS_WEIGHT_COLUMN,
65 CHAT_USERS_ICON_STOCK_COLUMN,
66 CHAT_USERS_COLUMNS
69 #define PIDGIN_CONVERSATION(conv) \
70 ((PidginConversation *)purple_conversation_get_ui_data(conv))
72 #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
73 (purple_conversation_get_ui_ops(conv) == \
74 pidgin_conversations_get_conv_ui_ops())
76 #include "pidgin.h"
77 #include "conversation.h"
78 #include "gtkconvwin.h"
79 #include "gtkconv-theme.h"
81 /**************************************************************************
82 * Structures
83 **************************************************************************/
85 /**
86 * PidginConversation:
88 * A GTK+ conversation pane.
90 struct _PidginConversation
92 gint box_count;
94 PurpleConversation *active_conv;
95 PurpleConversation *last_conversed;
96 GList *convs;
97 GList *send_history;
99 PidginConvWindow *win;
101 gboolean make_sound;
103 GtkWidget *tab_cont;
104 GtkWidget *tabby;
105 GtkWidget *menu_tabby;
107 PidginConvTheme *theme;
108 GArray *nick_colors;
109 PurpleMessageFlags last_flags;
110 GtkWidget *webview;
111 GtkWidget *entry;
112 gboolean auto_resize; /* this is set to TRUE if the conversation
113 * is being resized by a non-user-initiated
114 * event, such as the buddy icon appearing
116 gboolean entry_growing; /* True if the size of the entry was set
117 * automatically by typing too much to fit
118 * in one line */
120 GtkWidget *close; /* "x" on the tab */
121 GtkWidget *icon;
122 GtkWidget *tab_label;
123 GtkWidget *menu_icon;
124 GtkWidget *menu_label;
126 GtkWidget *lower_hbox;
128 PidginUnseenState unseen_state;
129 guint unseen_count;
131 union
133 PidginImPane *im;
134 PidginChatPane *chat;
136 } u;
138 time_t newday;
139 GtkWidget *infopane_hbox;
140 GtkWidget *infopane;
141 GtkListStore *infopane_model;
142 GtkTreeIter infopane_iter;
144 /* Used when attaching a PidginConversation to a PurpleConversation
145 * with message history */
146 int attach_timer;
147 GList *attach_current;
150 * Quick Find.
152 GtkWidget *quickfind_entry;
153 GtkWidget *quickfind_container;
156 G_BEGIN_DECLS
158 /**************************************************************************
159 * GTK+ Conversation API
160 **************************************************************************/
163 * pidgin_conversation_get_type:
165 * Returns: The #GType for the #PidginConversation boxed structure.
167 GType pidgin_conversation_get_type(void);
170 * pidgin_conversations_get_conv_ui_ops:
172 * Returns the UI operations structure for GTK+ conversations.
174 * Returns: The GTK+ conversation operations structure.
176 PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void);
179 * pidgin_conversations_get_default_theme:
181 * Returns the default theme for GTK+ conversations.
183 * Returns: The default GTK+ conversation theme.
185 PurpleTheme *pidgin_conversations_get_default_theme(void);
188 * pidgin_conv_update_buddy_icon:
189 * @im: The IM conversation.
191 * Updates the buddy icon on a conversation.
193 void pidgin_conv_update_buddy_icon(PurpleIMConversation *im);
196 * pidgin_conv_switch_active_conversation:
197 * @conv: The conversation
199 * Sets the active conversation within a GTK-conversation.
201 void pidgin_conv_switch_active_conversation(PurpleConversation *conv);
204 * pidgin_conv_update_buttons_by_protocol:
205 * @conv: The conversation.
207 * Updates conversation buttons by protocol.
209 void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv);
212 * pidgin_conversations_get_unseen_all:
213 * @min_state: The minimum unseen state.
214 * @hidden_only: If %TRUE, only consider hidden conversations.
215 * @max_count: Maximum number of conversations to return, or 0 for
216 * no maximum.
218 * Returns a list of conversations of any type which have an unseen
219 * state greater than or equal to the specified minimum state. Using the
220 * hidden_only parameter, this search can be limited to hidden
221 * conversations. The max_count parameter will limit the total number of
222 * converations returned if greater than zero. The returned list should
223 * be freed by the caller.
225 * Returns: List of PurpleConversation matching criteria, or %NULL.
227 GList *
228 pidgin_conversations_get_unseen_all(PidginUnseenState min_state,
229 gboolean hidden_only,
230 guint max_count);
233 * pidgin_conversations_get_unseen_ims:
234 * @min_state: The minimum unseen state.
235 * @hidden_only: If %TRUE, only consider hidden conversations.
236 * @max_count: Maximum number of conversations to return, or 0 for
237 * no maximum.
239 * Returns a list of IM conversations which have an unseen state greater
240 * than or equal to the specified minimum state. Using the hidden_only
241 * parameter, this search can be limited to hidden IM conversations. The
242 * max_count parameter will limit the total number of IM converations
243 * returned if greater than zero. The returned list should be freed by the
244 * caller.
246 * Returns: List of PurpleIMConversation matching criteria, or %NULL.
248 GList *
249 pidgin_conversations_get_unseen_ims(PidginUnseenState min_state,
250 gboolean hidden_only,
251 guint max_count);
254 * pidgin_conversations_get_unseen_chats:
255 * @min_state: The minimum unseen state.
256 * @hidden_only: If %TRUE, only consider hidden conversations.
257 * @max_count: Maximum number of conversations to return, or 0 for
258 * no maximum.
260 * Returns a list of chat conversations which have an unseen state greater
261 * than or equal to the specified minimum state. Using the hidden_only
262 * parameter, this search can be limited to hidden chat conversations. The
263 * max_count parameter will limit the total number of chat converations
264 * returned if greater than zero. The returned list should be freed by the
265 * caller.
267 * Returns: List of PurpleChatConversation matching criteria, or %NULL.
269 GList *
270 pidgin_conversations_get_unseen_chats(PidginUnseenState min_state,
271 gboolean hidden_only,
272 guint max_count);
275 * pidgin_conversations_fill_menu:
276 * @menu: Menu widget to add items to.
277 * @convs: List of PurpleConversation to add to menu.
279 * Fill a menu with a list of conversations. Clicking the conversation
280 * menu item will present that conversation to the user.
282 * Returns: Number of conversations added to menu.
284 guint
285 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs);
288 * pidgin_conv_present_conversation:
289 * @conv: The conversation.
291 * Presents a purple conversation to the user.
293 void pidgin_conv_present_conversation(PurpleConversation *conv);
296 * pidgin_conv_attach_to_conversation:
297 * @conv: The conversation.
299 * Reattach Pidgin UI to a conversation.
301 * Returns: Wheter Pidgin UI was successfully attached.
303 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv);
306 * pidgin_conv_get_window:
307 * @gtkconv: The GTK+ conversation.
309 * Returns: The window the conversation belongs to.
311 PidginConvWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
314 * pidgin_conv_get_tab_icon:
315 * @conv: The conversation.
316 * @small_icon: Whether to get the small icon.
318 * Returns: The tab icon.
320 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
323 * pidgin_conv_new:
324 * @conv: The conversation.
326 * Creates a new GTK+ conversation for a given #PurpleConversation.
328 void pidgin_conv_new(PurpleConversation *conv);
331 * pidgin_conv_get_tab_at_xy:
332 * @win: The conversation window.
333 * @x: X-coordinate to look up.
334 * @y: Y-coordinate to look up.
335 * @to_right: (out): Return address for a boolean which will be %TRUE if the
336 * coordinates are on the right side of the tab (or bottom in case of
337 * a vertical notebook), %FALSE otherwise.
339 * Returns: The tab index of a conversation in @win at (@x, @y).
341 int pidgin_conv_get_tab_at_xy(PidginConvWindow *win, int x, int y, gboolean *to_right);
344 * pidgin_conv_is_hidden:
345 * @gtkconv: The GTK+ conversation.
347 * Returns: %TRUE if the conversation is hidden, %FALSE otherwise.
349 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
351 /**************************************************************************/
352 /* GTK+ Conversations Subsystem */
353 /**************************************************************************/
356 * pidgin_conversations_get_handle:
358 * Returns the gtk conversations subsystem handle.
360 * Returns: The conversations subsystem handle.
362 void *pidgin_conversations_get_handle(void);
365 * pidgin_conversations_init:
367 * Initializes the GTK+ conversations subsystem.
369 void pidgin_conversations_init(void);
372 * pidgin_conversations_uninit:
374 * Uninitialized the GTK+ conversation subsystem.
376 void pidgin_conversations_uninit(void);
378 G_END_DECLS
380 #endif /* _PIDGIN_CONVERSATION_H_ */