Mercurial > pidgin
changeset 3367:3b00d97d59aa
[gaim-migrate @ 3386]
There'll be more tommorow! Thanks for coming to the party.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Fri, 02 Aug 2002 04:52:48 +0000 |
parents | 120e08ea5aee |
children | 1a3394b2e1f1 |
files | src/buddy.c src/buddy_chat.c src/conversation.c src/core.h src/dialogs.c src/gaim.h src/gaimrc.c src/multi.c src/sound.c src/ui.h |
diffstat | 10 files changed, 566 insertions(+), 106 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/buddy.c Fri Aug 02 04:52:48 2002 +0000 @@ -51,6 +51,8 @@ #include "pixmaps/away_small.xpm" #include "pixmaps/away_big.xpm" +#include "pixmaps/block_small.xpm" + #include "pixmaps/add_small.xpm" #include "pixmaps/import_small.xpm" /*#include "pixmaps/export_small.xpm"*/ @@ -2746,6 +2748,8 @@ gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), protomenu); do_proto_menu(); + gaim_new_item_with_pixmap(menu, _("Privacy"), block_small_xpm, + GTK_SIGNAL_FUNC(show_privacy_options), NULL, 0, 0, 0); gaim_new_item_with_pixmap(menu, _("Preferences"), prefs_small_xpm, GTK_SIGNAL_FUNC(show_prefs), NULL, 'p', GDK_CONTROL_MASK, "Ctl+P"); gaim_new_item_with_pixmap(menu, _("View System Log"), prefs_small_xpm,
--- a/src/buddy_chat.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/buddy_chat.c Fri Aug 02 04:52:48 2002 +0000 @@ -728,7 +728,10 @@ play_sound(SND_CHAT_SAY); } } - write_to_conv(b, message, flag, who, mtime, -1); + + if (chat_options & OPT_CHAT_COLORIZE) + flag |= WFLAG_COLORIZE; + write_to_conv(b, message, flag, who, mtime, -1); }
--- a/src/conversation.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/conversation.c Fri Aug 02 04:52:48 2002 +0000 @@ -271,7 +271,7 @@ gtk_widget_destroy(c->link_dialog); if (c->log_dialog) gtk_widget_destroy(c->log_dialog); -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) if (c->save_icon) gtk_widget_destroy(c->save_icon); #endif @@ -1751,6 +1751,10 @@ /* Takin care of the window.. */ /*------------------------------------------------------------------------*/ +static char* nick_colors[] = {"#ff0000", "#ff00ff", "#00ffff", "#04a241", + "#ffae00", "#bd008a", "#4c9f9c", "#7f0000", + "#6477a2"}; +#define NUM_NICK_COLORS 9 /* this is going to be interesting since the conversation could either be a * normal IM conversation or a chat window. but hopefully it won't matter */ @@ -1897,7 +1901,20 @@ g_snprintf(str, 1024, "%s:", who); if (flags & WFLAG_NICK) strcpy(colour, "#af7f00"); - else if (flags & WFLAG_RECV) + else if (flags & WFLAG_RECV) { + if (flags & WFLAG_COLORIZE) { + char *u = who; + int m = 0; + while (*u) { + m = m + *u; + u++; + } + m = m % NUM_NICK_COLORS; + strcpy(colour, nick_colors[m]); + } else { + strcpy(colour, "#ff0000"); + } + } else if (flags & WFLAG_RECV) strcpy(colour, "#ff0000"); else if (flags & WFLAG_SEND) strcpy(colour, "#0000ff"); @@ -3291,7 +3308,7 @@ } } -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) #include <gdk-pixbuf/gdk-pixbuf.h> #define SCALE(x) ((gdk_pixbuf_animation_get_width(x) <= 48 && gdk_pixbuf_animation_get_height(x) <= 48) \ @@ -3308,6 +3325,9 @@ GdkPixmap *src; GdkPixmap *pm; GdkBitmap *bm; +#if GTK_CHECK_VERSION(1,3,0) + GdkPixbufAnimationIter *iter; +#endif GdkGC *gc; gint delay; @@ -3316,6 +3336,23 @@ return FALSE; } +#if GTK_CHECK_VERSION(1,3,0) + gdk_pixbuf_animation_iter_advance(c->iter, NULL); + buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); + scale = gdk_pixbuf_scale_simple(buf, + MAX(gdk_pixbuf_get_width(buf) * SCALE(c->anim) / + gdk_pixbuf_animation_get_width(c->anim), 1), + MAX(gdk_pixbuf_get_height(buf) * SCALE(c->anim) / + gdk_pixbuf_animation_get_height(c->anim), 1), + GDK_INTERP_NEAREST); + gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); + gdk_pixbuf_unref(scale); + gtk_pixmap_set(GTK_PIXMAP(c->icon), pm, bm); + gdk_pixmap_unref(pm); + if (bm) + gdk_bitmap_unref(bm); + delay = MAX(gdk_pixbuf_animation_iter_get_delay_time(c->iter), 13); +#else frames = gdk_pixbuf_animation_get_frames(c->anim); frame = g_list_nth_data(frames, c->frame); switch (gdk_pixbuf_frame_get_action(frame)) { @@ -3383,8 +3420,9 @@ c->frame = (c->frame + 1) % g_list_length(frames); delay = MAX(gdk_pixbuf_frame_get_delay_time(frame), 13); +#endif + c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); - return FALSE; } @@ -3400,10 +3438,13 @@ GList *frames; GdkPixbufFrame *frame; int delay; - +#if GTK_CHECK_VERSION(1,3,0) + delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter); +#else frames = gdk_pixbuf_animation_get_frames(c->anim); frame = g_list_nth_data(frames, c->frame); delay = MAX(gdk_pixbuf_frame_get_delay_time(frame), 13); +#endif if (c->anim) c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); } @@ -3490,7 +3531,13 @@ gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(stop_anim), c); gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); - } else if (c->anim && (gdk_pixbuf_animation_get_num_frames(c->anim) > 1)) { + } +#if GTK_CHECK_VERSION(1,3,0) + else if (c->anim && !(gdk_pixbuf_animation_is_static_image(c->anim))) +#else + else if (c->anim && (gdk_pixbuf_animation_get_num_frames(c->anim) > 1)) +#endif + { button = gtk_menu_item_new_with_label(_("Enable Animation")); gtk_signal_connect(GTK_OBJECT(button), "activate", GTK_SIGNAL_FUNC(start_anim), c); gtk_menu_append(GTK_MENU(menu), button); @@ -3516,7 +3563,7 @@ void remove_icon(struct conversation *c) { -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) if (c->icon) gtk_container_remove(GTK_CONTAINER(c->bbox), c->icon->parent->parent); c->icon = NULL; @@ -3526,8 +3573,12 @@ if (c->icon_timer) gtk_timeout_remove(c->icon_timer); c->icon_timer = 0; +#if GTK_CHECK_VERSION(1,3,0) + g_object_unref(c->iter); +#else c->frame = 0; #endif +#endif } void update_smilies(struct conversation *c) @@ -3558,12 +3609,14 @@ void update_icon(struct conversation *c) { -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) char filename[256]; FILE *file; - +#if GTK_CHECK_VERSION(1,3,0) + GError *err; +#endif void *data; - int len; + int len, delay; GList *frames; GdkPixbuf *buf; @@ -3599,28 +3652,47 @@ fwrite(data, 1, len, file); fclose(file); +#if GTK_CHECK_VERSION(1,3,0) + c->anim = gdk_pixbuf_animation_new_from_file(filename, &err); +#else c->anim = gdk_pixbuf_animation_new_from_file(filename); +#endif /* make sure we remove the file as soon as possible */ unlink(filename); if (!c->anim) return; - frames = gdk_pixbuf_animation_get_frames(c->anim); - buf = gdk_pixbuf_frame_get_pixbuf(frames->data); - sf = SCALE(c->anim); - scale = gdk_pixbuf_scale_simple(buf, - MAX(gdk_pixbuf_get_width(buf) * sf / - gdk_pixbuf_animation_get_width(c->anim), 1), - MAX(gdk_pixbuf_get_height(buf) * sf / - gdk_pixbuf_animation_get_height(c->anim), 1), - GDK_INTERP_NEAREST); - - if (gdk_pixbuf_animation_get_num_frames(c->anim) > 1) { - int delay = MAX(gdk_pixbuf_frame_get_delay_time(frames->data), 13); +#if GTK_CHECK_VERSION(1,3,0) + c->iter = gdk_pixbuf_animation_get_iter(c->anim, NULL); + buf = gdk_pixbuf_animation_iter_get_pixbuf(c->iter); + scale = gdk_pixbuf_scale_simple(buf, + MAX(gdk_pixbuf_get_width(buf) * sf / + gdk_pixbuf_animation_get_width(c->anim), 1), + MAX(gdk_pixbuf_get_height(buf) * sf / + gdk_pixbuf_animation_get_height(c->anim), 1), + GDK_INTERP_NEAREST); + delay = gdk_pixbuf_animation_iter_get_delay_time(c->iter); +#else c->frame = 1; - c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); - } + frames = gdk_pixbuf_animation_get_frames(c->anim); + buf = gdk_pixbuf_frame_get_pixbuf(frames->data); + sf = SCALE(c->anim); + scale = gdk_pixbuf_scale_simple(buf, + MAX(gdk_pixbuf_get_width(buf) * sf / + gdk_pixbuf_animation_get_width(c->anim), 1), + MAX(gdk_pixbuf_get_height(buf) * sf / + gdk_pixbuf_animation_get_height(c->anim), 1), + GDK_INTERP_NEAREST); + if (gdk_pixbuf_animation_get_num_frames(c->anim) > 1) { + delay = MAX(gdk_pixbuf_frame_get_delay_time(frames->data), 13); + } else { + delay = 0; + } +#endif + if (delay) + c->icon_timer = gtk_timeout_add(delay * 10, redraw_icon, c); + gdk_pixbuf_render_pixmap_and_mask(scale, &pm, &bm, 100); gdk_pixbuf_unref(scale); @@ -3645,6 +3717,7 @@ if (bm) gdk_bitmap_unref(bm); #endif + } void got_new_icon(struct gaim_connection *gc, char *who) @@ -3665,7 +3738,7 @@ void set_anim() { -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) GList *c = conversations; if (im_options & OPT_IM_HIDE_ICONS) return;
--- a/src/core.h Fri Aug 02 04:49:23 2002 +0000 +++ b/src/core.h Fri Aug 02 04:52:48 2002 +0000 @@ -26,6 +26,8 @@ #include <config.h> #endif +#include <iconv.h> +#include <langinfo.h> #include <stdio.h> #include <time.h> #include <glib.h>
--- a/src/dialogs.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/dialogs.c Fri Aug 02 04:52:48 2002 +0000 @@ -54,6 +54,8 @@ #include "pixmaps/add.xpm" #include "pixmaps/warn.xpm" #include "pixmaps/close.xpm" +#include "pixmaps/gnome_add.xpm" +#include "pixmaps/gnome_remove.xpm" #include "pixmaps/angel.xpm" #include "pixmaps/bigsmile.xpm" @@ -1121,6 +1123,393 @@ } +/*------------------------------------------------------------------------* + * Privacy Settings * + *------------------------------------------------------------------------*/ +static GtkWidget *deny_type = NULL; +static GtkWidget *deny_conn_hbox = NULL; +static GtkWidget *deny_opt_menu = NULL; +static struct gaim_connection *current_deny_gc = NULL; +static gboolean current_is_deny = FALSE; +static GtkWidget *allow_list = NULL; +static GtkWidget *block_list = NULL; + +static void set_deny_mode(GtkWidget *w, int data) +{ + if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))) + return; + debug_printf("setting deny mode %d\n", data); + current_deny_gc->permdeny = data; + serv_set_permit_deny(current_deny_gc); + do_export(current_deny_gc); +} + +static GtkWidget *deny_opt(char *label, int which, GtkWidget *box, GtkWidget *set) +{ + GtkWidget *opt; + + if (!set) + opt = gtk_radio_button_new_with_label(NULL, label); + else + opt = + gtk_radio_button_new_with_label(gtk_radio_button_group(GTK_RADIO_BUTTON(set)), + label); + gtk_box_pack_start(GTK_BOX(box), opt, FALSE, FALSE, 0); + gtk_signal_connect(GTK_OBJECT(opt), "toggled", GTK_SIGNAL_FUNC(set_deny_mode), (void *)which); + gtk_widget_show(opt); + if (current_deny_gc->permdeny == which) + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(opt), TRUE); + + return opt; +} + +static void des_deny_opt(GtkWidget *d, gpointer e) +{ + gtk_widget_destroy(d); + current_deny_gc = NULL; + deny_conn_hbox = NULL; + deny_type = NULL; + deny_opt_menu = NULL; + current_is_deny = FALSE; + allow_list = NULL; + block_list = NULL; +} + +static void set_deny_type() +{ + GSList *bg = gtk_radio_button_group(GTK_RADIO_BUTTON(deny_type)); + + switch (current_deny_gc->permdeny) { + case 4: + break; + case 3: + bg = bg->next->next; + break; + case 2: + bg = bg->next; + break; + case 1: + bg = bg->next->next->next; + break; + } + + gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(bg->data), TRUE); +} + +void build_allow_list() +{ + GtkWidget *label; + GtkWidget *list_item; + GSList *p; + + if (!current_is_deny) + return; + + p = current_deny_gc->permit; + + gtk_list_remove_items(GTK_LIST(allow_list), GTK_LIST(allow_list)->children); + + while (p) { + label = gtk_label_new(p->data); + list_item = gtk_list_item_new(); + gtk_container_add(GTK_CONTAINER(list_item), label); + gtk_object_set_user_data(GTK_OBJECT(list_item), p->data); + gtk_widget_show(label); + gtk_container_add(GTK_CONTAINER(allow_list), list_item); + gtk_widget_show(list_item); + p = p->next; + } +} + +void build_block_list() +{ + GtkWidget *label; + GtkWidget *list_item; + GSList *d; + + if (!current_is_deny) + return; + + d = current_deny_gc->deny; + + gtk_list_remove_items(GTK_LIST(block_list), GTK_LIST(block_list)->children); + + while (d) { + label = gtk_label_new(d->data); + list_item = gtk_list_item_new(); + gtk_container_add(GTK_CONTAINER(list_item), label); + gtk_object_set_user_data(GTK_OBJECT(list_item), d->data); + gtk_widget_show(label); + gtk_container_add(GTK_CONTAINER(block_list), list_item); + gtk_widget_show(list_item); + d = d->next; + } +} + +static void deny_gc_opt(GtkWidget *opt, struct gaim_connection *gc) +{ + current_deny_gc = gc; + set_deny_type(); + build_allow_list(); + build_block_list(); +} + +static void build_deny_menu() +{ + GtkWidget *menu; + GtkWidget *opt; + GSList *c = connections; + struct gaim_connection *gc; + int count = 0; + gboolean found = FALSE; + char buf[2048]; + + if (g_slist_length(connections) == 1) { + gtk_widget_hide(deny_conn_hbox); + return; + } else + gtk_widget_show(deny_conn_hbox); + + menu = gtk_menu_new(); + + while (c) { + gc = (struct gaim_connection *)c->data; + c = c->next; + if (!gc->prpl->set_permit_deny) + continue; + g_snprintf(buf, sizeof buf, "%s (%s)", gc->username, gc->prpl->name()); + opt = gtk_menu_item_new_with_label(buf); + gtk_signal_connect(GTK_OBJECT(opt), "activate", GTK_SIGNAL_FUNC(deny_gc_opt), gc); + gtk_widget_show(opt); + gtk_menu_append(GTK_MENU(menu), opt); + if (gc == current_deny_gc) + found = TRUE; + else if (!found) + count++; + } + + if (!found) { + current_deny_gc = connections->data; + count = 0; + } + + gtk_option_menu_remove_menu(GTK_OPTION_MENU(deny_opt_menu)); + gtk_option_menu_set_menu(GTK_OPTION_MENU(deny_opt_menu), menu); + gtk_option_menu_set_history(GTK_OPTION_MENU(deny_opt_menu), count); + + gtk_widget_show(menu); + gtk_widget_show(deny_opt_menu); +} + +static void pref_deny_add(GtkWidget *button, gboolean permit) +{ + show_add_perm(current_deny_gc, NULL, permit); +} + +static void pref_deny_rem(GtkWidget *button, gboolean permit) +{ + GList *i; + char *who; + + if (permit && !allow_list) + return; + if (!permit && !block_list) + return; + + if (permit) + i = GTK_LIST(allow_list)->selection; + else + i = GTK_LIST(block_list)->selection; + + if (!i) + return; + who = gtk_object_get_user_data(GTK_OBJECT(i->data)); + if (permit) { + current_deny_gc->permit = g_slist_remove(current_deny_gc->permit, who); + serv_rem_permit(current_deny_gc, who); + build_allow_list(); + } else { + current_deny_gc->deny = g_slist_remove(current_deny_gc->deny, who); + serv_rem_deny(current_deny_gc, who); + build_block_list(); + } + + do_export(current_deny_gc); +} + +GtkWidget *privacy_win; +void update_privacy_connections() { /* This is a slightly better name */ + gboolean needdeny = FALSE; + GSList *c = connections; + struct gaim_connection *gc = NULL; + + if (!privacy_win) + return; + + while (c) { + gc = c->data; + if (gc->prpl->set_permit_deny) + break; + gc = NULL; + c = c->next; + } + needdeny = (gc != NULL); + + + if (needdeny) { + gtk_widget_set_sensitive(privacy_win, TRUE); + build_deny_menu(); + build_allow_list(); + build_block_list(); + } else { + gtk_widget_set_sensitive(privacy_win, FALSE); + } +} +static void destroy_privacy() { + current_deny_gc = NULL; + privacy_win = NULL; +} + +void show_privacy_options() +{ + GtkWidget *pwin; + GtkWidget *box; + GtkWidget *hbox; + GtkWidget *label; + GtkWidget *vbox; + GtkWidget *sw; + GtkWidget *bbox; + GtkWidget *button; + GtkWidget *sep; + GtkWidget *close_button; + + current_deny_gc = connections->data; /* this is safe because this screen will only be + available when there are connections */ + current_is_deny = TRUE; + + + privacy_win = pwin = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_window_set_policy(GTK_WINDOW(pwin), FALSE, TRUE, TRUE); + gtk_window_set_wmclass(GTK_WINDOW(pwin), "privacy", "Gaim"); + gtk_window_set_title(GTK_WINDOW(pwin), _("Gaim - Privacy")); + gtk_signal_connect(GTK_OBJECT(pwin), "destroy", GTK_SIGNAL_FUNC(destroy_privacy), NULL); + gtk_widget_realize(pwin); + aol_icon(pwin->window); + + gtk_widget_set_usize(pwin, 0, 400); + + box = gtk_vbox_new(FALSE, 5); + gtk_container_set_border_width(GTK_CONTAINER(box), 5); + gtk_container_add(GTK_CONTAINER(pwin), box); + gtk_widget_show(box); + + label = gtk_label_new(_("Privacy settings are affected immediately.")); + gtk_box_pack_start(GTK_BOX(box), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + deny_conn_hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(box), deny_conn_hbox, FALSE, FALSE, 0); + gtk_widget_show(deny_conn_hbox); + + label = gtk_label_new(_("Set privacy for:")); + gtk_box_pack_start(GTK_BOX(deny_conn_hbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + deny_opt_menu = gtk_option_menu_new(); + gtk_box_pack_start(GTK_BOX(deny_conn_hbox), deny_opt_menu, FALSE, FALSE, 5); + gtk_signal_connect(GTK_OBJECT(deny_opt_menu), "destroy", GTK_SIGNAL_FUNC(des_deny_opt), NULL); + gtk_widget_show(deny_opt_menu); + + build_deny_menu(); + + hbox = gtk_hbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(box), hbox, TRUE, TRUE, 5); + gtk_widget_show(hbox); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); + gtk_widget_show(vbox); + + deny_type = deny_opt(_("Allow all users to contact me"), 1, vbox, NULL); + deny_type = deny_opt(_("Allow only the users below"), 3, vbox, deny_type); + + label = gtk_label_new(_("Allow List")); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); + gtk_widget_show(sw); + + allow_list = gtk_list_new(); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), allow_list); + gtk_widget_show(allow_list); + + build_allow_list(); + + bbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); + gtk_widget_show(bbox); + + button = picture_button(pwin, _("Add"), gnome_add_xpm); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_add), (void *)TRUE); + gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); + + button = picture_button(pwin, _("Remove"), gnome_remove_xpm); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_rem), (void *)TRUE); + gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); + + vbox = gtk_vbox_new(FALSE, 5); + gtk_box_pack_start(GTK_BOX(hbox), vbox, TRUE, TRUE, 5); + gtk_widget_show(vbox); + + deny_type = deny_opt(_("Deny all users"), 2, vbox, deny_type); + deny_type = deny_opt(_("Block the users below"), 4, vbox, deny_type); + + label = gtk_label_new(_("Block List")); + gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 5); + gtk_widget_show(label); + + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); + gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 5); + gtk_widget_show(sw); + + block_list = gtk_list_new(); + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(sw), block_list); + gtk_widget_show(block_list); + + build_block_list(); + + bbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_end(GTK_BOX(vbox), bbox, FALSE, FALSE, 5); + gtk_widget_show(bbox); + + button = picture_button(pwin, _("Add"), gnome_add_xpm); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_add), FALSE); + gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); + + button = picture_button(pwin, _("Remove"), gnome_remove_xpm); + gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(pref_deny_rem), FALSE); + gtk_box_pack_start(GTK_BOX(bbox), button, FALSE, FALSE, 5); + + sep = gtk_hseparator_new(); + gtk_box_pack_start(GTK_BOX(box), sep, FALSE, FALSE, 5); + gtk_widget_show(sep); + + hbox = gtk_hbox_new(TRUE, 5); + gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 5); + gtk_widget_show(hbox); + close_button = picture_button(pwin, _("Close"), cancel_xpm); + gtk_box_pack_end(GTK_BOX(hbox), close_button, FALSE, FALSE, 5); + gtk_signal_connect_object(GTK_OBJECT(close_button), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), pwin); + + gtk_widget_show(pwin); +} + + + /*------------------------------------------------------------------------*/ /* The dialog for new buddy pounces */ /*------------------------------------------------------------------------*/ @@ -2573,8 +2962,8 @@ /* Color Selection Dialog */ /*------------------------------------------------------*/ -static GtkWidget *fgcseld = NULL; -static GtkWidget *bgcseld = NULL; +GtkWidget *fgcseld = NULL; +GtkWidget *bgcseld = NULL; void cancel_fgcolor(GtkWidget *widget, struct conversation *c) { @@ -2656,43 +3045,6 @@ cancel_bgcolor(NULL, c); } -static void destroy_colorsel(GtkWidget *w, gpointer d) -{ - if (d) { - gtk_widget_destroy(fgcseld); - fgcseld = NULL; - } else { - gtk_widget_destroy(bgcseld); - bgcseld = NULL; - } -} - -static void apply_color_dlg(GtkWidget *w, gpointer d) -{ - gdouble color[3]; - if ((int)d == 1) { - gtk_color_selection_get_color(GTK_COLOR_SELECTION - (GTK_COLOR_SELECTION_DIALOG(fgcseld)->colorsel), color); - destroy_colorsel(NULL, (void *)1); - - fgcolor.red = ((guint16)(color[0] * 65535)) >> 8; - fgcolor.green = ((guint16)(color[1] * 65535)) >> 8; - fgcolor.blue = ((guint16)(color[2] * 65535)) >> 8; - update_color(NULL, pref_fg_picture); - update_convo_color(TRUE); - } else { - gtk_color_selection_get_color(GTK_COLOR_SELECTION - (GTK_COLOR_SELECTION_DIALOG(bgcseld)->colorsel), color); - destroy_colorsel(NULL, (void *)0); - - bgcolor.red = ((guint16)(color[0] * 65535)) >> 8; - bgcolor.green = ((guint16)(color[1] * 65535)) >> 8; - bgcolor.blue = ((guint16)(color[2] * 65535)) >> 8; - update_color(NULL, pref_bg_picture); - update_convo_color(FALSE); - } -} - void show_fgcolor_dialog(struct conversation *c, GtkWidget *color) { GtkWidget *colorsel; @@ -2855,25 +3207,6 @@ fontseld = NULL; } -void apply_font_dlg(GtkWidget *w, GtkWidget *f) -{ - int i, j = 0, k = 0; - char *fontname; - - fontname = gtk_font_selection_dialog_get_font_name(GTK_FONT_SELECTION_DIALOG(fontseld)); - destroy_fontsel(0, 0); - for (i = 0; i < strlen(fontname); i++) { - if (fontname[i] == '-') { - if (++j > 2) - break; - } else if (j == 2) - fontface[k++] = fontname[i]; - } - fontface[k] = '\0'; - g_snprintf(fontxfld, sizeof(fontxfld), "%s", fontname); - update_convo_font(); -} - void show_font_dialog(struct conversation *c, GtkWidget *font) { @@ -4226,6 +4559,32 @@ #endif } +#if GTK_CHECK_VERSION(1,3,0) +GtkWidget *pixbuf_button(char *text, char *iconfile) +{ + GtkWidget *button, *image, *label, *bbox; + button = gtk_button_new(); + bbox = gtk_hbox_new(FALSE, 5); + gtk_container_add (GTK_CONTAINER(button), bbox); + if (iconfile) { + char *filename; + filename = g_build_filename (DATADIR, "pixmaps", "gaim", "buttons", iconfile, NULL); + debug_printf("Loading: %s\n", filename); + image = gtk_image_new_from_file(filename); + gtk_box_pack_start(GTK_BOX(bbox), image, FALSE, FALSE, 0); + g_free(filename); + } + if (text) { + label = gtk_label_new(NULL); + gtk_label_set_text_with_mnemonic(GTK_LABEL(label), text); + gtk_label_set_mnemonic_widget(GTK_LABEL(label), button); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + } + gtk_widget_show_all(bbox); + return button; +} +#endif + GtkWidget *picture_button(GtkWidget *window, char *text, char **xpm) { GtkWidget *button;
--- a/src/gaim.h Fri Aug 02 04:49:23 2002 +0000 +++ b/src/gaim.h Fri Aug 02 04:52:48 2002 +0000 @@ -84,13 +84,6 @@ #define CUI_CHAT_SEND 5 #define CUI_CHAT_RECV 6 - -#define BROWSER_NETSCAPE 0 -#define BROWSER_KFM 1 -#define BROWSER_MANUAL 2 -/*#define BROWSER_INTERNAL 3*/ -#define BROWSER_GNOME 4 - #define IM_FLAG_AWAY 0x01 #define IM_FLAG_CHECKBOX 0x02 #define IM_FLAG_GAIMUSER 0x04 @@ -112,6 +105,7 @@ #define WFLAG_SYSTEM 0x20 #define WFLAG_NICK 0x40 #define WFLAG_NOLOG 0x80 +#define WFLAG_COLORIZE 0x100 #define AUTO_RESPONSE "<AUTO-REPLY> : " @@ -253,6 +247,7 @@ #define OPT_CHAT_BR_TAB 0x00000040 #define OPT_CHAT_TAB_COMPLETE 0x00000080 #define OPT_CHAT_OLD_STYLE_TAB 0x00000100 +#define OPT_CHAT_COLORIZE 0x00000200 extern guint font_options; #define OPT_FONT_BOLD 0x00000001 @@ -285,6 +280,7 @@ #define OPT_SOUND_CMD 0x00020000 #define OPT_SOUND_CHAT_NICK 0x00040000 /* remember to also change the struct in sound.c */ + #define SND_BUDDY_ARRIVE 0 #define SND_BUDDY_LEAVE 1 #define SND_RECEIVE 2 @@ -297,10 +293,9 @@ #define SND_POUNCE_DEFAULT 9 #define SND_CHAT_NICK 10 #define NUM_SOUNDS 11 -/* these two for the sound_order list in prefs.c */ -#define SND_SEPARATOR -1 -#define SND_END -2 + extern char *sound_file[NUM_SOUNDS]; +extern int sound_order[]; /* global sound struct */ struct sound_struct { @@ -433,12 +428,13 @@ extern gchar *strdup_withhtml(const gchar *); extern void away_on_login(char *); extern void system_log(enum log_event, struct gaim_connection *, struct buddy *, int); -extern unsigned char *utf8_to_str(unsigned char *); -extern char *str_to_utf8(unsigned char *); extern char *add_cr(char *); extern void strip_linefeed(char *); extern time_t get_time(int, int, int, int, int, int); extern FILE *gaim_mkstemp(gchar **); +extern char *convert_string(char *, const char *, const char *); +#define utf8_to_str(in) convert_string(in, nl_langinfo(CODESET), "UTF-8"); +#define str_to_utf8(in) convert_string(in, "UTF-8", nl_langinfo(CODESET)); /*------------------------------------------------------------------------*/ /* Multi-Entry dialog and vCard dialog support */
--- a/src/gaimrc.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/gaimrc.c Fri Aug 02 04:52:48 2002 +0000 @@ -993,9 +993,7 @@ int i; struct away_message *a; - misc_options = - OPT_MISC_BUDDY_TICKER | - OPT_MISC_COOL_LOOK; + misc_options = OPT_MISC_COOL_LOOK; logging_options = 0; @@ -1006,6 +1004,7 @@ OPT_BLIST_SHOW_GRPNUM | OPT_BLIST_SHOW_PIXMAPS | OPT_BLIST_SHOW_IDLETIME | + OPT_BLIST_GREY_IDLERS | OPT_BLIST_SHOW_BUTTON_XPM; convo_options = @@ -1019,13 +1018,15 @@ im_options = OPT_IM_POPUP | OPT_IM_LOGON | - OPT_IM_BUTTON_XPM; + OPT_IM_BUTTON_XPM | + OPT_IM_ONE_WINDOW ; chat_options = OPT_CHAT_LOGON | OPT_CHAT_POPUP | OPT_CHAT_BUTTON_XPM | - OPT_CHAT_TAB_COMPLETE; + OPT_CHAT_TAB_COMPLETE | + OPT_CHAT_ONE_WINDOW; font_options = 0;
--- a/src/multi.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/multi.c Fri Aug 02 04:52:48 2002 +0000 @@ -1155,7 +1155,7 @@ refresh_buddy_window(); #endif - update_connection_dependent_prefs(); + update_privacy_connections(); do_away_menu(); do_proto_menu(); redo_convo_menus(); @@ -1454,7 +1454,7 @@ if (connections) set_user_state(online); #endif - update_connection_dependent_prefs(); + update_privacy_connections(); if (connections) return;
--- a/src/sound.c Fri Aug 02 04:49:23 2002 +0000 +++ b/src/sound.c Fri Aug 02 04:52:48 2002 +0000 @@ -73,6 +73,12 @@ {NULL, 0, RedAlert, sizeof(RedAlert)}, {N_("Someone says your name in chat"), OPT_SOUND_CHAT_NICK, Receive, sizeof(Receive)} }; +int sound_order[] = { + SND_BUDDY_ARRIVE, SND_BUDDY_LEAVE, + SND_FIRST_RECEIVE, SND_RECEIVE, SND_SEND, + SND_CHAT_JOIN, SND_CHAT_LEAVE, + SND_CHAT_YOU_SAY, SND_CHAT_SAY, SND_CHAT_NICK, 0 +}; static int check_dev(char *dev) {
--- a/src/ui.h Fri Aug 02 04:49:23 2002 +0000 +++ b/src/ui.h Fri Aug 02 04:52:48 2002 +0000 @@ -33,7 +33,7 @@ #ifdef USE_GNOME #include <gnome.h> #endif -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) #include <gdk-pixbuf/gdk-pixbuf.h> #endif @@ -180,12 +180,16 @@ /* something to distinguish */ gboolean is_chat; -#if USE_PIXBUF +#if USE_PIXBUF || GTK_CHECK_VERSION(1,3,0) /* buddy icon stuff. sigh. */ GtkWidget *icon; GdkPixbufAnimation *anim; guint32 icon_timer; + #if GTK_CHECK_VERSION(1,3,0) + GdkPixbufAnimationIter *iter; + #else int frame; + #endif GtkWidget *save_icon; #endif }; @@ -303,6 +307,8 @@ extern GdkColor bgcolor; extern GdkColor fgcolor; extern int smiley_array[FACE_TOTAL]; +extern GtkWidget *fgcseld; +extern GtkWidget *bgcseld; /* Globals in prefs.c */ extern struct debug_window *dw; @@ -458,7 +464,14 @@ extern void aol_icon(GdkWindow *); extern GtkWidget *picture_button(GtkWidget *, char *, char **); extern GtkWidget *picture_button2(GtkWidget *, char *, char **, short); +#if GTK_CHECK_VERSION(1,3,0) || GTK_CHECK_VERSION(1,3,0) +extern GtkWidget *pixbuf_button(char *, char *); +#endif extern int file_is_dir(const char *, GtkWidget *); +extern void update_privacy_connections(); +extern void show_privacy_options(); +extern void build_allow_list(); +extern void build_block_list(); /* Functions in multi.c */ extern void account_editor(GtkWidget *, GtkWidget *); @@ -476,13 +489,16 @@ extern void update_color(GtkWidget *, GtkWidget *); extern void set_default_away(GtkWidget *, gpointer); extern void default_away_menu_init(GtkWidget *); -extern void update_connection_dependent_prefs(); extern void build_allow_list(); extern void build_block_list(); extern GtkWidget *prefs_away_list; extern GtkWidget *prefs_away_menu; extern GtkWidget *pref_fg_picture; extern GtkWidget *pref_bg_picture; +extern void apply_font_dlg(GtkWidget *, GtkWidget *); +extern void apply_color_dlg(GtkWidget *, gpointer); +extern void destroy_colorsel(GtkWidget *, gpointer); + /* Functions in prpl.c */ extern void register_dialog();