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
;
126 GtkWidget
*fg_color_dialog
;
127 GtkWidget
*bg_color_dialog
;
128 GtkWidget
*font_dialog
;
129 GtkWidget
*smiley_dialog
;
130 GtkWidget
*link_dialog
;
131 GtkWidget
*log_dialog
;
145 /* stuff used just for IM */
158 GSList
*images
; /* A list of filenames to embed */
160 guint typing_timeout
;
163 /* stuff used just for chat */
173 GtkWidget
*topic_text
;
175 /* something to distinguish */
179 /* buddy icon stuff. sigh. */
181 GdkPixbufAnimation
*anim
;
184 GtkWidget
*save_icon
;
188 struct log_conversation
{
191 struct log_conversation
*next
;
194 /* XXX CUI: away messages aren't really anything more than char* but we need two char*'s
195 * for the UI so that people can name their away messages when they save them. So these
196 * are really a UI function and struct away_message should be removed from the core. */
197 struct away_message
{
202 /****************************
203 * I thought I'd place these here by the same reasoning used above (for away_message)
204 * This helps aleviate warnings from dialogs.c where the show_new_bp function references
205 * buddy_pounce in the parameter list when ui.h doesn't know about buddy_pounce
206 * **************************
208 struct buddy_pounce
{
221 /* this is used for queuing messages received while away. This is really a UI function
222 * which is why the struct is here. */
223 struct queued_message
{
227 struct gaim_connection
*gc
;
233 struct aim_user
*user
;
235 /* these are temporary */
238 char proto_opt
[7][256];
240 /* stuff for modify window */
247 GtkWidget
*user_frame
;
248 GtkWidget
*proto_frame
;
251 /* stuff for icon selection */
254 GtkWidget
*iconentry
;
257 /* stuff for mail check prompt */
258 GtkWidget
*checkmail
;
260 /* stuff for register with server */
261 GtkWidget
*register_user
;
268 /* Globals in aim.c */
269 extern GList
*log_conversations
; /* this should be moved to conversations.c */
270 extern GSList
*away_messages
; /* this should be moved to away.c */
271 extern GtkWidget
*mainwindow
;
273 /* Globals in away.c */
274 extern struct away_message
*awaymessage
;
275 extern struct away_message
*default_away
;
276 extern int auto_away
;
277 extern GtkWidget
*awaymenu
;
278 extern GtkWidget
*clistqueue
;
280 /* Globals in buddy.c */
281 extern GtkWidget
*buddies
;
282 extern GtkWidget
*bpmenu
;
283 extern GtkWidget
*blist
;
285 /* Globals in buddy_chat.c */
286 extern GList
*chats
; /* list of all chats (only use for tabbing!) */
287 extern GtkWidget
*all_chats
;
288 extern GtkWidget
*joinchat
;
290 /* Globals in conversation.c */
291 extern GtkWidget
*all_convos
;
293 /* Globals in dialog.c */
294 extern char fontface
[128];
295 extern char fontxfld
[256];
297 extern GdkColor bgcolor
;
298 extern GdkColor fgcolor
;
299 extern int smiley_array
[FACE_TOTAL
];
301 /* Globals in prefs.c */
302 extern struct debug_window
*dw
;
304 /* Globals in prpl.c */
305 extern GtkWidget
*protomenu
;
307 /* Functions in about.c */
308 extern void show_about(GtkWidget
*, void *);
309 extern void gaim_help(GtkWidget
*, void *);
311 /* Functions in aim.c */
312 extern void show_login();
313 extern void gaim_setup(struct gaim_connection
*gc
);
315 /* Functions in away.c */
316 extern void rem_away_mess(GtkWidget
*, struct away_message
*);
317 extern void do_away_message(GtkWidget
*, struct away_message
*);
318 extern void do_away_menu();
319 extern void away_list_unclicked(GtkWidget
*, struct away_message
*);
320 extern void away_list_clicked(GtkWidget
*, struct away_message
*);
321 extern void toggle_away_queue();
322 extern void purge_away_queue();
324 /* Functions in browser.c */
325 extern void open_url(GtkWidget
*, char *);
326 extern void add_bookmark(GtkWidget
*, char *);
328 /* Functions in buddy.c */
329 extern void handle_group_rename(struct group
*, char *);
330 extern void handle_buddy_rename(struct buddy
*, char *);
331 extern void destroy_buddy();
332 extern void update_button_pix();
333 extern void toggle_show_empty_groups();
334 extern void update_all_buddies();
335 extern void update_num_groups(void);
336 extern void show_buddy_list();
337 extern void refresh_buddy_window();
338 extern void signoff_all();
339 extern void do_im_back();
340 extern void set_buddy(struct gaim_connection
*, struct buddy
*);
341 extern void build_edit_tree();
342 extern void do_bp_menu();
343 extern void ui_add_buddy(struct gaim_connection
*, struct group
*, struct buddy
*);
344 extern void ui_remove_buddy(struct gaim_connection
*, struct group
*, struct buddy
*);
345 extern void ui_add_group(struct gaim_connection
*, struct group
*);
346 extern void ui_remove_group(struct gaim_connection
*, struct group
*);
347 extern void toggle_buddy_pixmaps();
348 extern void gaim_separator(GtkWidget
*);
349 extern void redo_buddy_list(); /* you really shouldn't call this function */
351 /* Functions in buddy_chat.c */
352 extern void join_chat();
353 extern void chat_write(struct conversation
*, char *, int, char *, time_t);
354 extern void delete_chat(struct conversation
*);
355 extern void build_imchat_box(gboolean
);
356 extern void update_chat_button_pix();
357 extern void update_im_button_pix();
358 extern void update_chat_tabs();
359 extern void update_im_tabs();
360 extern void update_idle_times();
361 extern void do_join_chat();
363 /* Functions in conversation.c */
364 extern void gaim_setup_imhtml(GtkWidget
*);
365 extern void update_convo_add_button(struct conversation
*);
366 extern void raise_convo_tab(struct conversation
*);
367 extern void set_convo_title(struct conversation
*);
368 extern void show_conv(struct conversation
*);
369 void set_convo_name(struct conversation
*c
, const char *nname
);
370 extern struct conversation
*new_conversation(char *);
371 extern void delete_conversation(struct conversation
*);
372 extern void surround(GtkWidget
*, char *, char *);
373 extern int is_logging(char *);
374 extern void set_state_lock(int);
375 extern void rm_log(struct log_conversation
*);
376 extern struct log_conversation
*find_log_info(char *);
377 extern void remove_tags(GtkWidget
*, char *);
378 extern void update_log_convs();
379 extern void update_transparency();
380 extern void update_font_buttons();
381 extern void toggle_sensitive(GtkWidget
*widget
, GtkWidget
*to_toggle
);
382 extern void do_bold(GtkWidget
*, GtkWidget
*);
383 extern void do_italic(GtkWidget
*, GtkWidget
*);
384 extern void do_underline(GtkWidget
*, GtkWidget
*);
385 extern void do_strike(GtkWidget
*, GtkWidget
*);
386 extern void do_small(GtkWidget
*, GtkWidget
*);
387 extern void do_normal(GtkWidget
*, GtkWidget
*);
388 extern void do_big(GtkWidget
*, GtkWidget
*);
389 extern void set_font_face(char *, struct conversation
*);
390 extern void redo_convo_menus();
391 extern void convo_menu_remove(struct gaim_connection
*);
392 extern void remove_icon_data(struct gaim_connection
*);
393 extern void got_new_icon(struct gaim_connection
*, char *);
394 extern void toggle_spellchk();
395 extern void set_convo_gc(struct conversation
*, struct gaim_connection
*);
396 extern void update_buttons_by_protocol(struct conversation
*);
397 extern void toggle_smileys();
398 extern void toggle_timestamps();
399 extern void update_pixmaps();
400 extern void im_tabize();
401 extern void chat_tabize();
402 extern void convo_tabize();
403 extern void update_convo_color();
404 extern void update_convo_font();
405 extern void set_hide_icons();
406 extern void set_convo_titles();
407 extern void update_progress(struct conversation
*, float);
408 extern void show_typing(struct conversation
*);
409 extern gboolean
reset_typing(char *);
411 /* Functions in dialogs.c */
412 extern void alias_dialog_bud(struct buddy
*);
413 extern void show_warn_dialog(struct gaim_connection
*, char *);
414 extern void show_im_dialog();
415 extern void show_info_dialog();
416 extern void show_add_buddy(struct gaim_connection
*, char *, char *, char *);
417 extern void show_add_group(struct gaim_connection
*);
418 extern void show_add_perm(struct gaim_connection
*, char *, gboolean
);
419 extern void destroy_all_dialogs();
420 extern void show_import_dialog();
421 extern void show_export_dialog();
422 extern void show_new_bp(char *, struct gaim_connection
*, int, int, struct buddy_pounce
*);
423 extern void show_log(char *);
424 extern void show_log_dialog(struct conversation
*);
425 extern void show_fgcolor_dialog(struct conversation
*c
, GtkWidget
*color
);
426 extern void show_bgcolor_dialog(struct conversation
*c
, GtkWidget
*color
);
427 extern void cancel_fgcolor(GtkWidget
*widget
, struct conversation
*c
);
428 extern void cancel_bgcolor(GtkWidget
*widget
, struct conversation
*c
);
429 extern void create_away_mess(GtkWidget
*, void *);
430 extern void show_ee_dialog(int);
431 extern void show_add_link(GtkWidget
*,struct conversation
*);
432 extern void show_smiley_dialog(struct conversation
*, GtkWidget
*);
433 extern void close_smiley_dialog(GtkWidget
*widget
, struct conversation
*c
);
434 extern void set_smiley_array(GtkWidget
*widget
, int smiley_type
);
435 extern void insert_smiley_text(GtkWidget
*widget
, struct conversation
*c
);
436 extern void cancel_log(GtkWidget
*, struct conversation
*);
437 extern void cancel_link(GtkWidget
*, struct conversation
*);
438 extern void show_font_dialog(struct conversation
*c
, GtkWidget
*font
);
439 extern void cancel_font(GtkWidget
*widget
, struct conversation
*c
);
440 extern void apply_font(GtkWidget
*widget
, GtkFontSelection
*fontsel
);
441 extern void set_color_selection(GtkWidget
*selection
, GdkColor color
);
442 extern void show_rename_group(GtkWidget
*, struct group
*);
443 extern void show_rename_buddy(GtkWidget
*, struct buddy
*);
444 extern void load_perl_script();
445 extern void aol_icon(GdkWindow
*);
446 extern GtkWidget
*picture_button(GtkWidget
*, char *, char **);
447 extern GtkWidget
*picture_button2(GtkWidget
*, char *, char **, short);
448 extern int file_is_dir(const char *, GtkWidget
*);
450 /* Functions in multi.c */
451 extern void account_editor(GtkWidget
*, GtkWidget
*);
453 /* Functions in plugins.c */
455 extern void show_plugins(GtkWidget
*, gpointer
);
456 extern void update_show_plugins(); /* this is a hack and will be removed */
459 /* Functions in prefs.c */
460 extern void set_option(GtkWidget
*, int *);
461 extern void show_prefs();
462 extern void show_debug();
463 extern void update_color(GtkWidget
*, GtkWidget
*);
464 extern void set_default_away(GtkWidget
*, gpointer
);
465 extern void default_away_menu_init(GtkWidget
*);
466 extern void update_connection_dependent_prefs();
467 extern void build_allow_list();
468 extern void build_block_list();
469 extern GtkWidget
*prefs_away_list
;
470 extern GtkWidget
*prefs_away_menu
;
471 extern GtkWidget
*pref_fg_picture
;
472 extern GtkWidget
*pref_bg_picture
;
474 /* Functions in prpl.c */
475 extern void register_dialog();
477 /* Functions in server.c */
478 /* server.c is in desperate need need of a split */
479 extern int find_queue_total_by_name(char *);
481 /* Functions in sound.c */
482 extern void play_sound(int);
483 extern void play_file(char *);
485 /* Fucntions in ticker.c */
486 void SetTickerPrefs();
487 void BuddyTickerSignOff();
488 void BuddyTickerAddUser(char *, GdkPixmap
*, GdkBitmap
*);
489 void BuddyTickerSetPixmap(char *, GdkPixmap
*, GdkBitmap
*);
490 void BuddyTickerSignoff();