4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 #include <applet-widget.h>
32 #endif /* USE_APPLET */
37 #include <gdk-pixbuf/gdk-pixbuf.h>
40 #if GTK_CHECK_VERSION(1,3,0)
41 #define GAIM_DIALOG(x) x = gtk_window_new(GTK_WINDOW_TOPLEVEL); \
42 gtk_window_set_type_hint(GTK_WINDOW(x), GDK_WINDOW_TYPE_HINT_DIALOG)
43 #define GdkWindowPrivate GdkWindowObject
44 #define gtk_toolbar_new(x,y) gtk_toolbar_new()
45 #define gtk_accel_group_attach(x, y) _gtk_accel_group_attach(x, y)
46 #define gtk_widget_lock_accelerators(x)
48 #define GAIM_DIALOG(x) x = gtk_window_new(GTK_WINDOW_DIALOG)
49 #define GTK_OLD_EDITABLE(x) GTK_EDITABLE(x)
50 #define gtk_style_get_font(style) (style)->font
51 #define gtk_style_set_font(s, f) (s)->font = f
54 #define DEFAULT_FONT_XFLD "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1"
55 #define DEFAULT_FONT_FACE "helvetica"
57 #define BROWSER_NETSCAPE 0
59 #define BROWSER_MANUAL 2
60 /*#define BROWSER_INTERNAL 3*/
61 #define BROWSER_GNOME 4
62 #define BROWSER_OPERA 5
63 #define BROWSER_GALEON 6
66 #define FACE_BIGSMILE 1
68 #define FACE_CROSSEDLIPS 3
70 #define FACE_EMBARRASSED 5
72 #define FACE_MONEYMOUTH 7
76 #define FACE_SMILE8 11
78 #define FACE_TONGUE 13
88 /* XXX CUI: save_pos and window_size are used by gaimrc.c which is core.
89 * Need to figure out options saving. Same goes for several global variables as well. */
105 /* struct buddy_chat went away and got merged with this. */
106 struct conversation
{
107 struct gaim_connection
*gc
;
109 /* stuff used for both IM and chat */
116 GtkWidget
*underline
;
117 GtkWidget
*fgcolorbtn
;
118 GtkWidget
*bgcolorbtn
;
121 GtkWidget
*log_button
;
125 GtkWidget
*fg_color_dialog
;
126 GtkWidget
*bg_color_dialog
;
127 GtkWidget
*font_dialog
;
128 GtkWidget
*smiley_dialog
;
129 GtkWidget
*link_dialog
;
130 GtkWidget
*log_dialog
;
144 /* stuff used just for IM */
158 /* stuff used just for chat */
168 GtkWidget
*topic_text
;
170 /* something to distinguish */
174 /* buddy icon stuff. sigh. */
176 GdkPixbufAnimation
*anim
;
179 GtkWidget
*save_icon
;
183 struct log_conversation
{
186 struct log_conversation
*next
;
189 /* XXX CUI: away messages aren't really anything more than char* but we need two char*'s
190 * for the UI so that people can name their away messages when they save them. So these
191 * are really a UI function and struct away_message should be removed from the core. */
192 struct away_message
{
197 /* this is used for queuing messages received while away. This is really a UI function
198 * which is why the struct is here. */
199 struct queued_message
{
203 struct gaim_connection
*gc
;
209 struct aim_user
*user
;
211 /* these are temporary */
214 char proto_opt
[7][256];
216 /* stuff for modify window */
223 GtkWidget
*user_frame
;
224 GtkWidget
*proto_frame
;
227 /* stuff for icon selection */
230 GtkWidget
*iconentry
;
233 /* stuff for mail check prompt */
234 GtkWidget
*checkmail
;
236 /* stuff for register with server */
237 GtkWidget
*register_user
;
244 /* Globals in aim.c */
245 extern GList
*log_conversations
; /* this should be moved to conversations.c */
246 extern GSList
*away_messages
; /* this should be moved to away.c */
247 extern GtkWidget
*mainwindow
;
249 /* Globals in away.c */
250 extern struct away_message
*awaymessage
;
251 extern struct away_message
*default_away
;
252 extern int auto_away
;
253 extern GtkWidget
*awaymenu
;
254 extern GtkWidget
*clistqueue
;
256 /* Globals in buddy.c */
257 extern GtkWidget
*buddies
;
258 extern GtkWidget
*bpmenu
;
259 extern GtkWidget
*blist
;
261 /* Globals in buddy_chat.c */
262 extern GList
*chats
; /* list of all chats (only use for tabbing!) */
263 extern GtkWidget
*all_chats
;
264 extern GtkWidget
*joinchat
;
266 /* Globals in conversation.c */
267 extern GtkWidget
*all_convos
;
269 /* Globals in dialog.c */
270 extern char fontface
[128];
271 extern char fontxfld
[256];
273 extern GdkColor bgcolor
;
274 extern GdkColor fgcolor
;
275 extern int smiley_array
[FACE_TOTAL
];
277 /* Globals in prefs.c */
278 extern struct debug_window
*dw
;
280 /* Globals in prpl.c */
281 extern GtkWidget
*protomenu
;
283 /* Functions in about.c */
284 extern void show_about(GtkWidget
*, void *);
285 extern void gaim_help(GtkWidget
*, void *);
287 /* Functions in aim.c */
288 extern void show_login();
289 extern void gaim_setup(struct gaim_connection
*gc
);
291 /* Functions in away.c */
292 extern void rem_away_mess(GtkWidget
*, struct away_message
*);
293 extern void do_away_message(GtkWidget
*, struct away_message
*);
294 extern void do_away_menu();
295 extern void away_list_unclicked(GtkWidget
*, struct away_message
*);
296 extern void away_list_clicked(GtkWidget
*, struct away_message
*);
297 extern void toggle_away_queue();
298 extern void purge_away_queue();
300 /* Functions in browser.c */
301 extern void open_url(GtkWidget
*, char *);
302 extern void add_bookmark(GtkWidget
*, char *);
304 /* Functions in buddy.c */
305 extern void handle_group_rename(struct group
*, char *);
306 extern void handle_buddy_rename(struct buddy
*, char *);
307 extern void destroy_buddy();
308 extern void update_button_pix();
309 extern void toggle_show_empty_groups();
310 extern void update_all_buddies();
311 extern void update_num_groups(void);
312 extern void show_buddy_list();
313 extern void refresh_buddy_window();
314 extern void signoff_all();
315 extern void do_im_back();
316 extern void set_buddy(struct gaim_connection
*, struct buddy
*);
317 extern void build_edit_tree();
318 extern void do_bp_menu();
319 extern void ui_add_buddy(struct gaim_connection
*, struct group
*, struct buddy
*);
320 extern void ui_remove_buddy(struct gaim_connection
*, struct group
*, struct buddy
*);
321 extern void ui_add_group(struct gaim_connection
*, struct group
*);
322 extern void ui_remove_group(struct gaim_connection
*, struct group
*);
323 extern void toggle_buddy_pixmaps();
324 extern void gaim_separator(GtkWidget
*);
325 extern void redo_buddy_list(); /* you really shouldn't call this function */
327 /* Functions in buddy_chat.c */
328 extern void join_chat();
329 extern void chat_write(struct conversation
*, char *, int, char *, time_t);
330 extern void delete_chat(struct conversation
*);
331 extern void build_imchat_box(gboolean
);
332 extern void update_chat_button_pix();
333 extern void update_im_button_pix();
334 extern void update_chat_tabs();
335 extern void update_im_tabs();
336 extern void update_idle_times();
337 extern void do_join_chat();
339 /* Functions in conversation.c */
340 extern void gaim_setup_imhtml(GtkWidget
*);
341 extern void update_convo_add_button(struct conversation
*);
342 extern void raise_convo_tab(struct conversation
*);
343 extern void set_convo_title(struct conversation
*);
344 extern void show_conv(struct conversation
*);
345 void set_convo_name(struct conversation
*c
, const char *nname
);
346 extern struct conversation
*new_conversation(char *);
347 extern void delete_conversation(struct conversation
*);
348 extern void surround(GtkWidget
*, char *, char *);
349 extern int is_logging(char *);
350 extern void set_state_lock(int);
351 extern void rm_log(struct log_conversation
*);
352 extern struct log_conversation
*find_log_info(char *);
353 extern void remove_tags(GtkWidget
*, char *);
354 extern void update_log_convs();
355 extern void update_transparency();
356 extern void update_font_buttons();
357 extern void toggle_sensitive(GtkWidget
*widget
, GtkWidget
*to_toggle
);
358 extern void do_bold(GtkWidget
*, GtkWidget
*);
359 extern void do_italic(GtkWidget
*, GtkWidget
*);
360 extern void do_underline(GtkWidget
*, GtkWidget
*);
361 extern void do_strike(GtkWidget
*, GtkWidget
*);
362 extern void do_small(GtkWidget
*, GtkWidget
*);
363 extern void do_normal(GtkWidget
*, GtkWidget
*);
364 extern void do_big(GtkWidget
*, GtkWidget
*);
365 extern void set_font_face(char *, struct conversation
*);
366 extern void redo_convo_menus();
367 extern void convo_menu_remove(struct gaim_connection
*);
368 extern void remove_icon_data(struct gaim_connection
*);
369 extern void got_new_icon(struct gaim_connection
*, char *);
370 extern void toggle_spellchk();
371 extern void set_convo_gc(struct conversation
*, struct gaim_connection
*);
372 extern void update_buttons_by_protocol(struct conversation
*);
373 extern void toggle_smileys();
374 extern void toggle_timestamps();
375 extern void update_pixmaps();
376 extern void im_tabize();
377 extern void chat_tabize();
378 extern void convo_tabize();
379 extern void update_convo_color();
380 extern void update_convo_font();
381 extern void set_hide_icons();
382 extern void set_convo_titles();
384 /* Functions in dialogs.c */
385 extern void alias_dialog_bud(struct buddy
*);
386 extern void show_warn_dialog(struct gaim_connection
*, char *);
387 extern void show_im_dialog();
388 extern void show_info_dialog();
389 extern void show_add_buddy(struct gaim_connection
*, char *, char *, char *);
390 extern void show_add_group(struct gaim_connection
*);
391 extern void show_add_perm(struct gaim_connection
*, char *, gboolean
);
392 extern void destroy_all_dialogs();
393 extern void show_import_dialog();
394 extern void show_export_dialog();
395 extern void show_new_bp(char *, struct gaim_connection
*, int, int);
396 extern void show_log(char *);
397 extern void show_log_dialog(struct conversation
*);
398 extern void show_fgcolor_dialog(struct conversation
*c
, GtkWidget
*color
);
399 extern void show_bgcolor_dialog(struct conversation
*c
, GtkWidget
*color
);
400 extern void cancel_fgcolor(GtkWidget
*widget
, struct conversation
*c
);
401 extern void cancel_bgcolor(GtkWidget
*widget
, struct conversation
*c
);
402 extern void create_away_mess(GtkWidget
*, void *);
403 extern void show_ee_dialog(int);
404 extern void show_add_link(GtkWidget
*,struct conversation
*);
405 extern void show_smiley_dialog(struct conversation
*, GtkWidget
*);
406 extern void close_smiley_dialog(GtkWidget
*widget
, struct conversation
*c
);
407 extern void set_smiley_array(GtkWidget
*widget
, int smiley_type
);
408 extern void insert_smiley_text(GtkWidget
*widget
, struct conversation
*c
);
409 extern void cancel_log(GtkWidget
*, struct conversation
*);
410 extern void cancel_link(GtkWidget
*, struct conversation
*);
411 extern void show_font_dialog(struct conversation
*c
, GtkWidget
*font
);
412 extern void cancel_font(GtkWidget
*widget
, struct conversation
*c
);
413 extern void apply_font(GtkWidget
*widget
, GtkFontSelection
*fontsel
);
414 extern void set_color_selection(GtkWidget
*selection
, GdkColor color
);
415 extern void show_rename_group(GtkWidget
*, struct group
*);
416 extern void show_rename_buddy(GtkWidget
*, struct buddy
*);
417 extern void load_perl_script();
418 extern void aol_icon(GdkWindow
*);
419 extern GtkWidget
*picture_button(GtkWidget
*, char *, char **);
420 extern GtkWidget
*picture_button2(GtkWidget
*, char *, char **, short);
421 extern int file_is_dir(const char *, GtkWidget
*);
423 /* Functions in multi.c */
424 extern void account_editor(GtkWidget
*, GtkWidget
*);
426 /* Functions in plugins.c */
428 extern void show_plugins(GtkWidget
*, gpointer
);
429 extern void update_show_plugins(); /* this is a hack and will be removed */
432 /* Functions in prefs.c */
433 extern void set_option(GtkWidget
*, int *);
434 extern void show_prefs();
435 extern void show_debug();
436 extern void update_color(GtkWidget
*, GtkWidget
*);
437 extern void set_default_away(GtkWidget
*, gpointer
);
438 extern void default_away_menu_init(GtkWidget
*);
439 extern void update_connection_dependent_prefs();
440 extern void build_allow_list();
441 extern void build_block_list();
442 extern GtkWidget
*prefs_away_list
;
443 extern GtkWidget
*prefs_away_menu
;
444 extern GtkWidget
*pref_fg_picture
;
445 extern GtkWidget
*pref_bg_picture
;
447 /* Functions in prpl.c */
448 extern void register_dialog();
450 /* Functions in server.c */
451 /* server.c is in desperate need need of a split */
452 extern int find_queue_total_by_name(char *);
454 /* Functions in sound.c */
455 extern void play_sound(int);
456 extern void play_file(char *);
458 /* Fucntions in ticker.c */
459 void SetTickerPrefs();
460 void BuddyTickerSignOff();
461 void BuddyTickerAddUser(char *, GdkPixmap
*, GdkBitmap
*);
462 void BuddyTickerSetPixmap(char *, GdkPixmap
*, GdkBitmap
*);
463 void BuddyTickerSignoff();