gtkconv.h

Go to the documentation of this file.
00001 
00006 /* pidgin
00007  *
00008  * Pidgin is the legal property of its developers, whose names are too numerous
00009  * to list here.  Please refer to the COPYRIGHT file distributed with this
00010  * source distribution.
00011  *
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02111-1301  USA
00025  */
00026 #ifndef _PIDGIN_CONVERSATION_H_
00027 #define _PIDGIN_CONVERSATION_H_
00028 
00029 typedef struct _PidginImPane       PidginImPane;
00030 typedef struct _PidginChatPane     PidginChatPane;
00031 typedef struct _PidginConversation PidginConversation;
00032 
00036 typedef enum
00037 {
00038     PIDGIN_UNSEEN_NONE,   
00039     PIDGIN_UNSEEN_EVENT,  
00040     PIDGIN_UNSEEN_NO_LOG, 
00041     PIDGIN_UNSEEN_TEXT,   
00042     PIDGIN_UNSEEN_NICK    
00043 } PidginUnseenState;
00044 
00045 enum {
00046     CHAT_USERS_ICON_COLUMN,
00047     CHAT_USERS_ALIAS_COLUMN,
00048     CHAT_USERS_ALIAS_KEY_COLUMN,
00049     CHAT_USERS_NAME_COLUMN,
00050     CHAT_USERS_FLAGS_COLUMN,
00051     CHAT_USERS_COLOR_COLUMN,
00052     CHAT_USERS_WEIGHT_COLUMN,
00053     CHAT_USERS_COLUMNS
00054 };
00055 
00056 #define PIDGIN_CONVERSATION(conv) \
00057     ((PidginConversation *)(conv)->ui_data)
00058 
00059 #define PIDGIN_IS_PIDGIN_CONVERSATION(conv) \
00060     (purple_conversation_get_ui_ops(conv) == \
00061      pidgin_conversations_get_conv_ui_ops())
00062 
00063 #include "pidgin.h"
00064 #include "conversation.h"
00065 #include "gtkconvwin.h"
00066 
00067 /**************************************************************************
00068  * @name Structures
00069  **************************************************************************/
00080 struct _PidginImPane
00081 {
00082     GtkWidget *block;
00083     GtkWidget *send_file;
00084     GtkWidget *sep1;
00085     GtkWidget *sep2;
00086     GtkWidget *check;
00087     GtkWidget *progress;
00088     guint32 typing_timer;
00089 
00090     /* Buddy icon stuff */
00091     GtkWidget *icon_container;
00092     GtkWidget *icon;
00093     gboolean show_icon;
00094     gboolean animate;
00095     GdkPixbufAnimation *anim;
00096     GdkPixbufAnimationIter *iter;
00097     guint32 icon_timer;
00098 };
00099 
00103 struct _PidginChatPane
00104 {
00105     GtkWidget *count;
00106     GtkWidget *list;
00107     GtkWidget *topic_text;
00108 };
00109 
00113 struct _PidginConversation
00114 {
00115     PurpleConversation *active_conv;
00116     GList *convs;
00117     GList *send_history;
00118 
00119     PidginWindow *win;
00120 
00121     gboolean make_sound;
00122 
00123     GtkTooltips *tooltips;
00124 
00125     GtkWidget *tab_cont;
00126     GtkWidget *tabby;
00127     GtkWidget *menu_tabby;
00128 
00129     GtkWidget *imhtml;
00130     GtkTextBuffer *entry_buffer;
00131     GtkWidget *entry;
00132     gboolean auto_resize;   /* this is set to TRUE if the conversation
00133                  * is being resized by a non-user-initiated
00134                  * event, such as the buddy icon appearing
00135                  */
00136     gboolean entry_growing; /* True if the size of the entry was set
00137                  * automatically by typing too much to fit
00138                  * in one line */
00139 
00140     GtkWidget *close; /* "x" on the tab */
00141     GtkWidget *icon;
00142     GtkWidget *tab_label;
00143     GtkWidget *menu_icon;
00144     GtkWidget *menu_label;
00145     GtkSizeGroup *sg;
00146 
00147     GtkWidget *lower_hbox;
00148 
00149     GtkWidget *toolbar;
00150 
00151     PidginUnseenState unseen_state;
00152     guint unseen_count;
00153 
00154     union
00155     {
00156         PidginImPane   *im;
00157         PidginChatPane *chat;
00158 
00159     } u;
00160 
00161     time_t newday;
00162     GtkWidget *infopane_hbox;
00163     GtkWidget *infopane;
00164     GtkListStore *infopane_model;
00165     GtkTreeIter infopane_iter;
00166 
00167     /* Used when attaching a PidginConversation to a PurpleConversation
00168      * with message history */
00169     struct {
00170         int timer;
00171         GList *current;
00172     } attach;
00173 };
00174 
00177 /**************************************************************************
00178  * @name GTK+ Conversation API
00179  **************************************************************************/
00187 PurpleConversationUiOps *pidgin_conversations_get_conv_ui_ops(void);
00188 
00194 void pidgin_conv_update_buddy_icon(PurpleConversation *conv);
00195 
00201 void pidgin_conv_switch_active_conversation(PurpleConversation *conv);
00202 
00208 void pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv);
00209 
00225 GList *
00226 pidgin_conversations_find_unseen_list(PurpleConversationType type,
00227                                         PidginUnseenState min_state,
00228                                         gboolean hidden_only,
00229                                         guint max_count);
00230 
00239 guint
00240 pidgin_conversations_fill_menu(GtkWidget *menu, GList *convs);
00241 
00247 void pidgin_conv_present_conversation(PurpleConversation *conv);
00248 
00256 gboolean pidgin_conv_attach_to_conversation(PurpleConversation *conv);
00257 
00258 PidginWindow *pidgin_conv_get_window(PidginConversation *gtkconv);
00259 GdkPixbuf *pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon);
00260 void pidgin_conv_new(PurpleConversation *conv);
00261 int pidgin_conv_get_tab_at_xy(PidginWindow *win, int x, int y, gboolean *to_right);
00262 gboolean pidgin_conv_is_hidden(PidginConversation *gtkconv);
00265 /**************************************************************************/
00267 /**************************************************************************/
00275 void *pidgin_conversations_get_handle(void);
00276 
00280 void pidgin_conversations_init(void);
00281 
00285 void pidgin_conversations_uninit(void);
00286 
00289 #endif /* _PIDGIN_CONVERSATION_H_ */