changeset 3374:3cd2fbddf95a

[gaim-migrate @ 3393] I had terrible days today and yesterday--a really terrible weekend. No cool stuff from me--the prefs away message page works a bit better. Ari and Chip both sent some patches to make things work a bit better in GTK 2, and Etan rewrote the notify plugin so it's really cool now! Thanks, guys! committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Mon, 05 Aug 2002 07:33:09 +0000
parents 0e79bf1d79ea
children fb1a0caadb9f
files ChangeLog plugins/notify.c src/buddy.c src/conversation.c src/dialogs.c src/gtkimhtml.c src/plugins.c src/prefs.c
diffstat 8 files changed, 721 insertions(+), 89 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Aug 02 21:25:34 2002 +0000
+++ b/ChangeLog	Mon Aug 05 07:33:09 2002 +0000
@@ -22,6 +22,12 @@
 	* Optionally uniquely colorize nicks in chats
 	* Changed some default options
 	* Updated desktop icon.
+	* GTK2 Goodness:
+		- Preferences dialog
+		- Plugins dialog (Ari Pollak)
+		- GtkIMHtml, sorta (Ari Pollak, Christian Hammond)
+	* Notify.c plugin rewritten; check its configure dialog (Thanks,
+	  Etan Reisner)
 
 version 0.59 (06/24/2002):
 	* Hungarian translation added (Thanks, Sutto Zoltan)
--- a/plugins/notify.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/plugins/notify.c	Mon Aug 05 07:33:09 2002 +0000
@@ -1,57 +1,295 @@
+/* Reworked by Etan Reisner
+ *
+ * Added config dialog
+ * Added control over notification method
+ * Added control over when to release notification
+ */
+
 #define GAIM_PLUGINS
 #include "gaim.h"
 
 #include <gtk/gtk.h>
 #include <string.h>
+#include <X11/Xutil.h>
+#include <X11/Xatom.h>	
+#include <gdk/gdkx.h>
+
+guint choice;
+#define REMOVE_FOCUS	0x00000001
+#define REMOVE_TYPE		0x00000002
+
+guint method;
+#define METHOD_STRING	0x00000001
+#define METHOD_QUOTE	0x00000002
+#define METHOD_URGENT	0x00000004
 
 void *handle;
+GtkWidget *Dialog = NULL;
+GtkWidget *Click, *Focus, *Type;
+GtkWidget *String, *Quote, *Urgent, *Entry;
+gchar *title_string;
 
-void received_im(struct gaim_connection *gc, char **who, char **what, void *m) {
+/* predefine some functions, less warnings */
+void options(GtkWidget *widget, gpointer data);
+void un_star(GtkWidget *widget, gpointer data);
+void un_star_window(GtkWidget *widget, gpointer data);
+void string_remove(GtkWidget *widget);
+void quote_remove(GtkWidget *widget);
+void urgent_remove(struct conversation *c);
+
+int received_im(struct gaim_connection *gc, char **who, char **what, void *m) {
 	char buf[256];
 	struct conversation *cnv = find_conversation(*who);
 	GtkWindow *win;
 	char *me = g_strdup(normalize(gc->username));
+	int revert_to_return;
+	Window focus_return;
 
 	if (!strcmp(me, normalize(*who))) {
 		g_free(me);
-		return;
+		return 0;
 	}
 	g_free(me);
 
 	if (cnv == NULL)
-	{
-		if (away_options & OPT_AWAY_QUEUE)
-			return;
+		{
+			if (away_options & OPT_AWAY_QUEUE)
+				return 0;
 
-		cnv = new_conversation(*who);
-	}
+			cnv = new_conversation(*who);
+		}
 
 	win = (GtkWindow *)cnv->window;
 
-	g_snprintf(buf, sizeof(buf), "%s", win->title);
-	if (!strstr(buf, "(*) ")) {
-		g_snprintf(buf, sizeof(buf), "(*) %s", win->title);
-		gtk_window_set_title(win, buf);
+	XGetInputFocus(GDK_WINDOW_XDISPLAY(cnv->window->window), &focus_return, &revert_to_return);
+
+	if (focus_return != GDK_WINDOW_XWINDOW(cnv->window->window)) {
+		if (method & METHOD_STRING) {
+			g_snprintf(buf, sizeof(buf), "%s", win->title);
+			if (!strstr(buf, title_string)) {
+				g_snprintf(buf, sizeof(buf), "%s %s", title_string, win->title);
+				gtk_window_set_title(win, buf);
+			}
+		}
+		if (method & METHOD_QUOTE) {
+			g_snprintf(buf, sizeof(buf), "%s", win->title);
+			if (g_strncasecmp(buf, "\"", 1)) {
+				g_snprintf(buf, sizeof(buf), "\"%s\"", win->title);
+				gtk_window_set_title(win, buf);
+			}
+		}
+		if (method & METHOD_URGENT) {
+		/* do it the gdk way for windows compatibility(?) if I can figure it out */
+/*  		gdk_property_change(win->window, WM_HINTS, WM_HINTS, 32, GDK_PROP_MODE_REPLACE, XUrgencyHint, 1); */
+			XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window));
+			hints->flags |= XUrgencyHint;
+			XSetWMHints(GDK_WINDOW_XDISPLAY(cnv->window->window), GDK_WINDOW_XWINDOW(cnv->window->window), hints);
+		}
+	}
+
+	return 0;
+}
+
+int sent_im(struct gaim_connection *gc, char *who, char **what, void *m) {
+	char buf[256];
+	struct conversation *c = find_conversation(who);
+
+	if (method & METHOD_QUOTE)
+		string_remove(c->window);
+	if (method & METHOD_STRING)
+		quote_remove(c->window);
+	if (method & METHOD_URGENT)
+		urgent_remove(c);
+	return 0;
+}
+
+int new_conv(char *who) {
+	struct conversation *c = find_conversation(who);
+
+	if (choice & REMOVE_FOCUS) {
+		gtk_signal_connect(GTK_OBJECT(c->window), "focus-in-event", GTK_SIGNAL_FUNC(un_star), NULL);
+		gtk_object_set_user_data(GTK_OBJECT(c->window), c);
+	}
+	else {
+		gtk_signal_connect(GTK_OBJECT(c->window), "button_press_event", GTK_SIGNAL_FUNC(un_star), NULL);
+		gtk_object_set_user_data(GTK_OBJECT(c->window), c);
+		gtk_signal_connect(GTK_OBJECT(c->text), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL);
+		gtk_object_set_user_data(GTK_OBJECT(c->text), c);
+		gtk_signal_connect(GTK_OBJECT(c->entry), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), NULL);
+		gtk_object_set_user_data(GTK_OBJECT(c->entry), c);
+/*  		gtk_signal_connect(GTK_OBJECT(c->text), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), c); */
+/*  		gtk_signal_connect(GTK_OBJECT(c->entry), "button_press_event", GTK_SIGNAL_FUNC(un_star_window), c); */
+	}
+
+	if (choice & REMOVE_TYPE) {
+		gtk_signal_connect(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), NULL);
+		gtk_object_set_user_data(GTK_OBJECT(c->entry), (gpointer) c);
+/*  		gtk_signal_connect(GTK_OBJECT(c->entry), "key-press-event", GTK_SIGNAL_FUNC(un_star_window), c); */
 	}
 }
 
-void sent_im(struct gaim_connection *gc, char *who, char **what, void *m) {
+void un_star(GtkWidget *widget, gpointer data) {
+	struct conversation *c = gtk_object_get_user_data(GTK_OBJECT(widget));
+/*  	struct conversation *c = data; */
+
+	if (method & METHOD_QUOTE)
+		quote_remove(widget);
+	if (method & METHOD_STRING)
+		string_remove(widget);
+	if (method & METHOD_URGENT)
+		urgent_remove(c);
+	return;
+}
+
+void un_star_window(GtkWidget *widget, gpointer data) {
+	GtkWidget *parent = gtk_widget_get_ancestor(widget, GTK_TYPE_WINDOW);
+	gtk_object_set_user_data(GTK_OBJECT(parent), gtk_object_get_user_data(GTK_OBJECT(widget)));
+	un_star(parent, data);
+}
+
+void string_remove(GtkWidget *widget) {
 	char buf[256];
-	struct conversation *c = find_conversation(who);
-	GtkWindow *win = (GtkWindow *)c->window;
+	GtkWindow *win = GTK_WINDOW(widget);
+
+	g_snprintf(buf, sizeof(buf), "%s", win->title);
+	if (strstr(buf, title_string)) {
+		g_snprintf(buf, sizeof(buf), "%s", &win->title[strlen(title_string)]);
+		gtk_window_set_title(win, buf);
+	}
+	return;
+}
+
+void quote_remove(GtkWidget *widget) {
+	char buf[256];
+	GtkWindow *win = GTK_WINDOW(widget);
 
 	g_snprintf(buf, sizeof(buf), "%s", win->title);
-	if (strstr(buf, "(*) ")) {
-		g_snprintf(buf, sizeof(buf), "%s", &win->title[4]);
+	if (!g_strncasecmp(buf, "\"", 1)) {
+		g_snprintf(buf, strlen(buf) - 1, "%s", &win->title[1]);
 		gtk_window_set_title(win, buf);
 	}
+	return;
+}
+
+void urgent_remove(struct conversation *c) {
+	char buf[256];
+	GdkWindow *win = c->window->window;
+
+	XWMHints *hints = XGetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window));
+	hints->flags &= ~XUrgencyHint;
+	XSetWMHints(GDK_WINDOW_XDISPLAY(c->window->window), GDK_WINDOW_XWINDOW(c->window->window), hints);
+	return;
+}
+
+void save_notify_prefs() {
+	char *buf;
+	FILE *fp;
+
+	buf = malloc(1000);
+	snprintf(buf, 1000, "%s/.gaim/.notify", getenv("HOME"));
+	if (!(fp = fopen(buf, "w"))) {
+		do_error_dialog(_("Unable to write to config file"), _("Notify plugin"));
+		return;
+	}
+	free(buf);
+
+	fprintf(fp, "CHOICE=%d\n", choice);
+	fprintf(fp, "METHOD=%d\n", method);
+	fprintf(fp, "STRING=%s\n", title_string);
+	fclose(fp);
+}
+
+void load_notify_prefs() {
+	gchar buf[1000];
+	gchar **parsed;
+	FILE *fp;
+
+	g_snprintf(buf, sizeof(buf), "%s/.gaim/.notify", getenv("HOME"));
+	if (!(fp = fopen(buf, "r")))
+		return;
+
+	while (fgets(buf, 1000, fp) != NULL) {
+		parsed = g_strsplit(g_strchomp(buf), "=", 2);
+		if (parsed[0] && parsed[1]) {
+			if (!strcmp(parsed[0], "CHOICE"))
+				choice = atoi(parsed[1]);
+			if (!strcmp(parsed[0], "METHOD"))
+				method = atoi(parsed[1]);
+			if (!strcmp(parsed[0], "STRING"))
+				title_string = parsed[1];
+		}
+	}
+	fclose(fp);
+	return;
+}
+
+void options(GtkWidget *widget, gpointer data) {
+	gint option = GPOINTER_TO_INT(data);
+
+	if (option == 0)
+		choice ^= REMOVE_FOCUS;
+	else if (option == 1)
+		choice ^= REMOVE_TYPE;
+	else if (option == 2) {
+		method ^= METHOD_STRING;
+		if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)))
+			gtk_widget_set_sensitive(Entry, TRUE);
+		else
+			gtk_widget_set_sensitive(Entry, FALSE);
+	}
+	else if (option == 3)
+		method ^= METHOD_QUOTE;
+	else if (option == 4)
+		method ^= METHOD_URGENT;
+}
+
+void setup_buttons() {
+	if (choice & REMOVE_FOCUS)
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Focus), TRUE);
+	else
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Click), TRUE);
+	if (choice & REMOVE_TYPE)
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Type), TRUE);
+	else
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Type), FALSE);
+
+	if (method & METHOD_STRING)
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(String), TRUE);
+	else
+		gtk_widget_set_sensitive(Entry, FALSE);
+
+	if (method & METHOD_QUOTE)
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Quote), TRUE);
+
+	if (method & METHOD_URGENT)
+		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(Urgent), TRUE);
+
+	return;
+}
+
+void close_dialog(GtkWidget *widget, gpointer data) {
+	gint option = GPOINTER_TO_INT(data);
+
+	if (option > 0) {
+		title_string = g_strdup(gtk_entry_get_text(GTK_ENTRY(Entry)));
+		save_notify_prefs();
+	}
+	else if (option < 0)
+		load_notify_prefs();
+
+	if (Dialog)
+		gtk_widget_destroy(Dialog);
+	Dialog = NULL;
 }
 
 char *gaim_plugin_init(GModule *hndl) {
 	handle = hndl;
 
+	load_notify_prefs();
+
 	gaim_signal_connect(handle, event_im_recv, received_im, NULL);
 	gaim_signal_connect(handle, event_im_send, sent_im, NULL);
+	gaim_signal_connect(handle, event_new_conversation, new_conv, NULL);
 
 	return NULL;
 }
@@ -64,3 +302,92 @@
 	return "Puts an asterisk in the title bar of all conversations"
 		" where you have not responded to a message yet.";
 }
+
+void gaim_plugin_config() {
+	GtkWidget *dialog_vbox;
+	GtkWidget *button, *label;
+	GtkWidget *box, *box2, *box3, *frame;
+
+	if (Dialog)
+		return;
+
+	/* main config dialog */
+	Dialog = gtk_dialog_new();
+/*  	gtk_widget_set_usize(Dialog, 275, -1); */
+	gtk_window_set_title(GTK_WINDOW(Dialog), "Notify plugin configuration");
+	gtk_window_set_policy(GTK_WINDOW(Dialog), FALSE, FALSE, TRUE);
+	gtk_signal_connect(GTK_OBJECT(Dialog), "destroy", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(-1));
+
+	dialog_vbox = GTK_DIALOG(Dialog)->vbox;
+
+	/* Ok and Cancel buttons */
+	box = gtk_hbox_new(FALSE, 8);
+	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(Dialog)->action_area), box);
+
+  button = gtk_button_new_with_label(_("Cancel"));
+  gtk_box_pack_end(GTK_BOX(box), button, FALSE, FALSE, 0);
+  gtk_widget_set_usize(button, 80, -2);
+  gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(0));
+
+  button = gtk_button_new_with_label(_("Ok"));
+  gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0);
+  gtk_widget_set_usize(button, 80, -2);
+  gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(close_dialog), GINT_TO_POINTER(1));
+
+	/* main hbox */
+	box = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(dialog_vbox), box, FALSE, FALSE, 0);
+
+	/* un-notify choices */
+	frame = gtk_frame_new(_("Remove notification when:"));
+	gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0);
+
+	box2 = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(frame), box2);
+
+	Focus = gtk_radio_button_new_with_label(NULL, _("Conversation window gains focus."));
+	gtk_box_pack_start(GTK_BOX(box2), Focus, FALSE, FALSE, 2);
+
+	Click = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(Focus), _("Conversation window gets clicked."));
+	gtk_box_pack_start(GTK_BOX(box2), Click, FALSE, FALSE, 2);
+
+	Type = gtk_check_button_new_with_label(_("Type in conversation window"));
+	gtk_box_pack_start(GTK_BOX(box2), Type, FALSE, FALSE, 2);
+
+	/* notification method choices */
+	/* do I need/want any other notification methods? */
+	frame = gtk_frame_new(_("Notification method:"));
+	gtk_box_pack_start(GTK_BOX(box), frame, FALSE, FALSE, 0);
+
+	box2 = gtk_vbox_new(FALSE, 0);
+	gtk_container_add(GTK_CONTAINER(frame), box2);
+
+	box3 = gtk_hbox_new(FALSE, 0);
+	gtk_box_pack_start(GTK_BOX(box2), box3, FALSE, FALSE, 0);
+
+	String = gtk_check_button_new_with_label(_("Insert string into window title:"));
+	gtk_box_pack_start(GTK_BOX(box3), String, FALSE, FALSE, 0);
+
+	Entry = gtk_entry_new_with_max_length(7);
+	gtk_box_pack_start(GTK_BOX(box3), Entry, FALSE, FALSE, 0);
+	if (!title_string)
+		gtk_entry_set_text(GTK_ENTRY(Entry), "(*) ");
+	else
+		gtk_entry_set_text(GTK_ENTRY(Entry), title_string);
+
+	Quote = gtk_check_button_new_with_label(_("Quote window title."));
+	gtk_box_pack_start(GTK_BOX(box2), Quote, FALSE, FALSE, 0);
+
+	Urgent = gtk_check_button_new_with_label(_("Send URGENT to window manager."));
+	gtk_box_pack_start(GTK_BOX(box2), Urgent, FALSE, FALSE, 0);
+
+	/* setup buttons, then attach signals */
+	setup_buttons();
+	gtk_signal_connect(GTK_OBJECT(Focus), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(0));
+	gtk_signal_connect(GTK_OBJECT(Type), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(1));
+	gtk_signal_connect(GTK_OBJECT(String), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(2));
+	gtk_signal_connect(GTK_OBJECT(Quote), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(3));
+	gtk_signal_connect(GTK_OBJECT(Urgent), "toggled", GTK_SIGNAL_FUNC(options), GINT_TO_POINTER(4));
+
+	gtk_widget_show_all(Dialog);
+}
--- a/src/buddy.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/buddy.c	Mon Aug 05 07:33:09 2002 +0000
@@ -2233,7 +2233,9 @@
 		gtk_widget_show(bs->idle);
 
 	style = gtk_style_new();
+#if !GTK_CHECK_VERSION(1,3,0)
 	gdk_font_unref(gtk_style_get_font(style));
+#endif
 	gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(bs->label->style)));
 	for (i = 0; i < 5; i++)
 		style->fg[i] = bs->idle->style->fg[i];
--- a/src/conversation.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/conversation.c	Mon Aug 05 07:33:09 2002 +0000
@@ -2601,7 +2601,9 @@
 		return;
 	if (c->unseen == -1) return;
 	style = gtk_style_new();
+#if !GTK_CHECK_VERSION(1,3,0)
 	gdk_font_unref(gtk_style_get_font(style));
+#endif
 	gtk_style_set_font(style, gdk_font_ref(gtk_style_get_font(label->style)));
 	gtk_widget_set_style(label, style);
 	gtk_style_unref(style);
@@ -3574,7 +3576,8 @@
 		gtk_timeout_remove(c->icon_timer);
 	c->icon_timer = 0;
 #if GTK_CHECK_VERSION(1,3,0)
-	g_object_unref(c->iter);
+	if(c->iter)
+		g_object_unref(c->iter);
 #else
 	c->frame = 0;
 #endif
--- a/src/dialogs.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/dialogs.c	Mon Aug 05 07:33:09 2002 +0000
@@ -556,7 +556,30 @@
 	GtkWidget *d;
 	GtkWidget *label;
 	GtkWidget *close;
-
+	GtkWidget *img = NULL;
+	/*
+#if GTK_CHECK_VERSION(1,3,0)
+	char *filename;
+	switch (type){
+	case GAIM_LOGO:
+		filename = g_build_filename(DATADIR, "pixmaps", "gaim", "gaim.png", NULL);
+		break;
+	case GAIM_INFO:
+		filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_info.png", NULL);
+		break;
+	case GAIM_WARNING:
+		filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_warning.png", NULL);
+		break;
+	case GAIM_ERROR:
+		filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_error.png", NULL);
+		break;
+	case GAIM_QUESTION:
+		filename = g_build_filename(DATADIR, "pixmaps", "gaim", "dialogs", "gaim_question.png", NULL);
+		break;
+	}
+	img = gtk_image_new_from_file(filename);
+#endif
+	*/
 
 	d = gtk_dialog_new();
 	gtk_window_set_policy(GTK_WINDOW(d), FALSE, FALSE, TRUE);
@@ -3524,7 +3547,27 @@
 	gtk_container_add(GTK_CONTAINER(sw), ca->text);
 	gtk_widget_show(ca->text);
 
-	if (dummy && GTK_LIST(prefs_away_list)->selection) {
+       
+#if GTK_CHECK_VERSION(1,3,0)
+	if (dummy) {
+		struct away_message *amt;
+		GtkTreeIter iter;
+		int pos = 0;
+		GtkListStore *ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(dummy)));
+		GtkTreeSelection *sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dummy));
+		GValue val = { 0, };
+
+		if (! gtk_tree_selection_get_selected (sel, &ls, &iter))
+			return;
+		gtk_tree_model_get_value (ls, &iter, 1, &val);
+		amt = g_value_get_pointer (&val);
+		gtk_entry_set_text(GTK_ENTRY(ca->entry), amt->name);
+		gtk_editable_insert_text(GTK_EDITABLE(ca->text), amt->message,
+					 strlen(amt->message), &pos);
+		ca->mess = amt;
+	}
+#else
+	if (dummy && GTK_LIST(prefs_away_list)->selection) {	
 		GtkWidget *item = GTK_LIST(prefs_away_list)->selection->data;
 		struct away_message *amt = gtk_object_get_user_data(GTK_OBJECT(item));
 		int pos = 0;
@@ -3533,6 +3576,8 @@
 					 strlen(amt->message), &pos);
 		ca->mess = amt;
 	}
+#endif	
+	
 
 	hbox = gtk_hbox_new(FALSE, 5);
 	gtk_box_pack_start(GTK_BOX(tbox), hbox, FALSE, FALSE, 0);
--- a/src/gtkimhtml.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/gtkimhtml.c	Mon Aug 05 07:33:09 2002 +0000
@@ -1660,7 +1660,7 @@
 {
 	struct imgsv *is = data;
 	struct im_image *img = is->img;
-	gchar *filename;
+	const gchar *filename;
 	FILE *f;
 	filename = gtk_file_selection_get_filename(GTK_FILE_SELECTION(is->savedialog));
 	g_print("Saving %s\n", filename);
@@ -2076,11 +2076,11 @@
 #define RGSTRY 13
 #define ENCDNG 14
 
-static gchar*
+static const gchar*
 gtk_imhtml_get_font_name (GdkFont *font)
 {
 #if GTK_CHECK_VERSION(1,3,0)
-	return "--*-helvetica-medium-r-normal--10-*-*-*-*-*-*-*";
+	return gdk_x11_font_get_name(font);
 #else
 	GdkFontPrivate *fontpriv = (GdkFontPrivate *) font;
 	return fontpriv->names->data;
@@ -2095,7 +2095,7 @@
 		      gint       fontsize)
 {
 	GdkFont *default_font = imhtml->default_font;
-	gchar *default_name;
+	const gchar *default_name;
 	gchar **xnames;
 	gchar **pos;
 	gchar *tmp = NULL;
--- a/src/plugins.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/plugins.c	Mon Aug 05 07:33:09 2002 +0000
@@ -87,9 +87,16 @@
 static void destroy_plugins(GtkWidget *, gpointer);
 static void load_file(GtkWidget *, gpointer);
 static void load_which_plugin(GtkWidget *, gpointer);
-static void list_clicked(GtkWidget *, struct gaim_plugin *);
 void update_show_plugins();
 static void hide_plugins(GtkWidget *, gpointer);
+static void clear_plugin_display();
+#if GTK_CHECK_VERSION(1,3,0)
+static struct gaim_plugin *get_selected_plugin(GtkWidget *);
+static void select_plugin(GtkWidget *w, struct gaim_plugin *p);
+static void list_clicked(GtkWidget *, gpointer);
+#else
+static void list_clicked(GtkWidget *, struct gaim_plugin *);
+#endif
 
 /* ------------------ Code Below ---------------------------- */
 
@@ -138,20 +145,31 @@
 static void load_which_plugin(GtkWidget *w, gpointer data)
 {
 	char *file;
-
-	file = gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog));
+	struct gaim_plugin *p;
+	
+	file = (char *)gtk_file_selection_get_filename(GTK_FILE_SELECTION(plugin_dialog));
 	if (file_is_dir(file, plugin_dialog)) {
 		return;
 	}
 
 	if (file)
-		load_plugin(file);
+		p = load_plugin(file);
+	else
+		p = NULL;
 
 	if (plugin_dialog)
 		gtk_widget_destroy(plugin_dialog);
 	plugin_dialog = NULL;
 
 	update_show_plugins();
+	/* Select newly loaded plugin */
+	if(p == NULL)
+		return;
+#if GTK_CHECK_VERSION(1,3,0)
+	select_plugin(pluglist, p);
+#else
+	gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, p));
+#endif
 }
 
 void show_plugins(GtkWidget *w, gpointer data)
@@ -167,7 +185,16 @@
 	GtkWidget *label;
 	GtkWidget *add;
 	GtkWidget *close;
-
+#if GTK_CHECK_VERSION(1,3,0)
+	/* stuff needed for GtkTreeView *pluglist */
+	GtkListStore *store;
+	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *column;
+	GtkTreeSelection *selection;
+	/* needed for GtkTextView *plugtext */
+	GtkTextBuffer *buffer;
+#endif
+	
 	if (plugwindow)
 		return;
 
@@ -176,7 +203,9 @@
 	gtk_widget_realize(plugwindow);
 	aol_icon(plugwindow->window);
 	gtk_window_set_title(GTK_WINDOW(plugwindow), _("Gaim - Plugins"));
+#if !GTK_CHECK_VERSION(1,3,0)
 	gtk_widget_set_usize(plugwindow, 515, 300);
+#endif
 	gtk_signal_connect(GTK_OBJECT(plugwindow), "destroy", GTK_SIGNAL_FUNC(hide_plugins), NULL);
 
 	mainvbox = gtk_vbox_new(FALSE, 0);
@@ -191,7 +220,9 @@
 	/* Left side: frame with list of plugin file names */
 	frame = gtk_frame_new(_("Loaded Plugins"));
 	gtk_box_pack_start(GTK_BOX(tophbox), frame, FALSE, FALSE, 0);
+#if !GTK_CHECK_VERSION(1,3,0)
 	gtk_widget_set_usize(frame, 140, -1);
+#endif
 	gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
 	gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5);
 	gtk_widget_show(frame);
@@ -201,14 +232,37 @@
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
 					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_widget_show(scrolledwindow);
+#if GTK_CHECK_VERSION(1,3,0)
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
+					GTK_SHADOW_IN);
 
+	/* Create & show plugin list */
+	store = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT);
+	pluglist = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
+	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(pluglist), FALSE);
+	renderer = gtk_cell_renderer_text_new();
+	column = gtk_tree_view_column_new_with_attributes("text", 
+				renderer, "text", 0, NULL);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(pluglist), column);
+	gtk_container_add(GTK_CONTAINER(scrolledwindow), pluglist);
+
+	g_object_unref(G_OBJECT(store));
+
+	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist));
+	g_signal_connect(G_OBJECT(selection), "changed", 
+			G_CALLBACK(list_clicked),
+			NULL);
+#else
 	pluglist = gtk_list_new();
 	gtk_list_set_selection_mode(GTK_LIST(pluglist), GTK_SELECTION_BROWSE);
-	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), pluglist);
+	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), 
+			pluglist);
+#endif /* GTK_CHECK_VERSION */
+
 	gtk_widget_show(pluglist);
 
 	/* Right side: frame with description and the filepath of plugin */
-	frame = gtk_frame_new(_("Description"));
+	frame = gtk_frame_new(_("Selected Plugin"));
 	gtk_box_pack_start(GTK_BOX(tophbox), frame, TRUE, TRUE, 0);
 	gtk_container_set_border_width(GTK_CONTAINER(frame), 6);
 	gtk_frame_set_label_align(GTK_FRAME(frame), 0.05, 0.5);
@@ -223,11 +277,27 @@
 	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwindow),
 					GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
 	gtk_widget_show(scrolledwindow);
-
+#if GTK_CHECK_VERSION(1,3,0)
+	gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwindow),
+					GTK_SHADOW_IN);		
+	
+	/* Create & show the plugin description widget */
+	plugtext = gtk_text_view_new();
+	gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(plugtext), GTK_WRAP_WORD);
+	gtk_text_view_set_editable(GTK_TEXT_VIEW(plugtext), FALSE);
+	gtk_container_add(GTK_CONTAINER(scrolledwindow), plugtext);
+	gtk_widget_set_size_request(GTK_WIDGET(plugtext), -1, 200);
+	
+	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
+	gtk_text_buffer_create_tag(buffer, "bold", "weight", 
+			PANGO_WEIGHT_BOLD, NULL);
+#else
 	plugtext = gtk_text_new(NULL, NULL);
-	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), plugtext);
+	gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrolledwindow), 
+				plugtext);
 	gtk_text_set_word_wrap(GTK_TEXT(plugtext), TRUE);
 	gtk_text_set_editable(GTK_TEXT(plugtext), FALSE);
+#endif
 	gtk_widget_show(plugtext);
 
 	hbox = gtk_hbox_new(FALSE, 5);
@@ -245,7 +315,7 @@
 	gtk_widget_show(plugentry);
 
 	/* Build the bottom button bar */
-	bothbox = gtk_hbox_new(TRUE, 10);
+	bothbox = gtk_hbox_new(TRUE, 3);
 	gtk_box_pack_start(GTK_BOX(mainvbox), bothbox, FALSE, FALSE, 0);
 	gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
 	gtk_widget_show(bothbox);
@@ -255,28 +325,28 @@
 
 	add = picture_button(plugwindow, _("Load"), gnome_add_xpm);
 	gtk_signal_connect(GTK_OBJECT(add), "clicked", GTK_SIGNAL_FUNC(load_file), NULL);
-	gtk_box_pack_start(GTK_BOX(bothbox), add, TRUE, TRUE, 0);
+	gtk_box_pack_start_defaults(GTK_BOX(bothbox), add);
 	gtk_tooltips_set_tip(tooltips, add, _("Load a plugin from a file"), "");
 
 	config = picture_button(plugwindow, _("Configure"), gnome_preferences_xpm);
 	gtk_widget_set_sensitive(config, FALSE);
-	gtk_box_pack_start(GTK_BOX(bothbox), config, TRUE, TRUE, 0);
+	gtk_box_pack_start_defaults(GTK_BOX(bothbox), config);
 	gtk_tooltips_set_tip(tooltips, config, _("Configure settings of the selected plugin"), "");
 
 	reload = picture_button(plugwindow, _("Reload"), refresh_xpm);
 	gtk_widget_set_sensitive(reload, FALSE);
 	gtk_signal_connect(GTK_OBJECT(reload), "clicked", GTK_SIGNAL_FUNC(plugin_reload_cb), NULL);
-	gtk_box_pack_start(GTK_BOX(bothbox), reload, TRUE, TRUE, 0);
+	gtk_box_pack_start_defaults(GTK_BOX(bothbox), reload);
 	gtk_tooltips_set_tip(tooltips, reload, _("Reload the selected plugin"), "");
 
 	unload = picture_button(plugwindow, _("Unload"), gnome_remove_xpm);
 	gtk_signal_connect(GTK_OBJECT(unload), "clicked", GTK_SIGNAL_FUNC(unload_plugin_cb), pluglist);
-	gtk_box_pack_start(GTK_BOX(bothbox), unload, TRUE, TRUE, 0);
+	gtk_box_pack_start_defaults(GTK_BOX(bothbox), unload);
 	gtk_tooltips_set_tip(tooltips, unload, _("Unload the selected plugin"), "");
 
 	close = picture_button(plugwindow, _("Close"), cancel_xpm);
 	gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(hide_plugins), NULL);
-	gtk_box_pack_start(GTK_BOX(bothbox), close, TRUE, TRUE, 0);
+	gtk_box_pack_start_defaults(GTK_BOX(bothbox), close);
 	gtk_tooltips_set_tip(tooltips, close, _("Close this window"), "");
 
 	update_show_plugins();
@@ -287,66 +357,84 @@
 {
 	GList *plugs = plugins;
 	struct gaim_plugin *p;
+#if GTK_CHECK_VERSION(1,3,0)
+	int pnum = 0;
+	GtkListStore *store;
+	GtkTreeIter iter;
+#else
 	GtkWidget *label;
 	GtkWidget *list_item;
 	GtkWidget *hbox;
-
+#endif
+	
 	if (plugwindow == NULL)
 		return;
 
+#if GTK_CHECK_VERSION(1,3,0)
+	store = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(pluglist)));
+	gtk_list_store_clear(store);
+#else
 	gtk_list_clear_items(GTK_LIST(pluglist), 0, -1);
+#endif
 	while (plugs) {
 		p = (struct gaim_plugin *)plugs->data;
+#if GTK_CHECK_VERSION(1,3,0)
+		gtk_list_store_append(store, &iter);
+		gtk_list_store_set(store, &iter, 0, plugin_makelistname(p->handle), -1);
+		gtk_list_store_set(store, &iter, 1, pnum++, -1);
+#else
 		label = gtk_label_new(plugin_makelistname(p->handle));
-		hbox = gtk_hbox_new(FALSE, 0);	/* for left justification */
+		hbox = gtk_hbox_new(FALSE, 0);  /* for left justification */
 		gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0);
 
 		list_item = gtk_list_item_new();
 		gtk_container_add(GTK_CONTAINER(list_item), hbox);
-		gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(list_clicked), p);
+		gtk_signal_connect(GTK_OBJECT(list_item), "select", 
+				GTK_SIGNAL_FUNC(list_clicked), p);
 		gtk_object_set_user_data(GTK_OBJECT(list_item), p);
-
+		
 		gtk_widget_show(hbox);
 		gtk_widget_show(label);
 		gtk_container_add(GTK_CONTAINER(pluglist), list_item);
 		gtk_widget_show(list_item);
-
+#endif
 		plugs = g_list_next(plugs);
 	}
 
-	/* Clear the display if nothing's selected */
-	if (GTK_LIST(pluglist)->selection == NULL) {
-		guint text_len = gtk_text_get_length(GTK_TEXT(plugtext));
-		gtk_text_set_point(GTK_TEXT(plugtext), 0);
-		gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
-		gtk_entry_set_text(GTK_ENTRY(plugentry), "");
-
-		gtk_widget_set_sensitive(config, FALSE);
-		gtk_widget_set_sensitive(reload, FALSE);
-		gtk_widget_set_sensitive(unload, FALSE);
-	}
+	clear_plugin_display();
 }
 
 static void unload_plugin_cb(GtkWidget *w, gpointer data)
 {
+	struct gaim_plugin *p;
+#if GTK_CHECK_VERSION(1,3,0)
+	p = get_selected_plugin(pluglist);
+	if(p == NULL)
+		return;
+#else
 	GList *i;
-	struct gaim_plugin *p;
-
+	
 	i = GTK_LIST(pluglist)->selection;
 
 	if (i == NULL)
 		return;
 
 	p = gtk_object_get_user_data(GTK_OBJECT(i->data));
-
+#endif
 	unload_plugin(p);
 	update_show_plugins();
 }
 
 static void plugin_reload_cb(GtkWidget *w, gpointer data)
 {
+	struct gaim_plugin *p;
+#if GTK_CHECK_VERSION(1,3,0)
+	p = get_selected_plugin(pluglist);
+	if(p == NULL)
+		return;
+	p = reload_plugin(p);
+#else
 	GList *i;
-	struct gaim_plugin *p;
 
 	i = GTK_LIST(pluglist)->selection;
 	if (i == NULL)
@@ -354,35 +442,77 @@
 
 	/* Just pass off plugin to the actual function */
 	p = reload_plugin(gtk_object_get_user_data(GTK_OBJECT(i->data)));
-
+#endif
 	update_show_plugins();
 
 	/* Try and reselect the plugin in list */
 	if (!pluglist)
 		return;
+#if GTK_CHECK_VERSION(1,3,0)
+	select_plugin(pluglist, p);
+#else
 	gtk_list_select_item(GTK_LIST(pluglist), g_list_index(plugins, p));
+#endif
 }
 
+
+#if GTK_CHECK_VERSION(1,3,0)
+static void list_clicked(GtkWidget *w, gpointer data)
+#else
 static void list_clicked(GtkWidget *w, struct gaim_plugin *p)
+#endif
 {
+	void (*gaim_plugin_config)();
+#if GTK_CHECK_VERSION(1,3,0)
+	struct gaim_plugin *p;
+	GtkTextBuffer *buffer;
+	GtkTextIter iter;
+#else
 	gchar *temp;
 	guint text_len;
-	void (*gaim_plugin_config)();
+#endif
+
+	if (confighandle != 0) {
+		gtk_signal_disconnect(GTK_OBJECT(config), confighandle);
+		confighandle = 0;
+	}
+
+#if GTK_CHECK_VERSION(1,3,0)
+	p = get_selected_plugin(pluglist);
+	if(p == NULL) { /* No selected plugin */
+		clear_plugin_display();
+		return;
+	}
 
-	if (confighandle != 0)
-		gtk_signal_disconnect(GTK_OBJECT(config), confighandle);
+	/* Set text and filepath widgets */
+	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
+	gtk_text_buffer_set_text(buffer, "", -1);
+	gtk_text_buffer_get_start_iter(buffer, &iter);
 
+	gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Name:", -1, 
+					"bold", NULL);
+	gtk_text_buffer_insert(buffer, &iter, "   ", -1); 
+	gtk_text_buffer_insert(buffer, &iter, (p->name != NULL) ? p->name : "", -1);
+	gtk_text_buffer_insert(buffer, &iter, "\n\n", -1);
+	gtk_text_buffer_insert_with_tags_by_name(buffer, &iter, "Description:", -1,
+					"bold", NULL);
+	gtk_text_buffer_insert(buffer, &iter, "\n", -1);
+	gtk_text_buffer_insert(buffer, &iter, 
+					(p->description != NULL) ? p->description : "", -1);
+
+	gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle));
+#else
 	text_len = gtk_text_get_length(GTK_TEXT(plugtext));
 	gtk_text_set_point(GTK_TEXT(plugtext), 0);
 	gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
 
 	temp = g_strdup_printf("Name:   %s\n\nDescription:\n%s",
-			       (p->name != NULL) ? p->name : "",
-			       (p->description != NULL) ? p->description : "");
+				(p->name != NULL) ? p->name : "",
+				(p->description != NULL) ? p->description : "");
 	gtk_text_insert(GTK_TEXT(plugtext), NULL, NULL, NULL, temp, -1);
 	g_free(temp);
 	gtk_entry_set_text(GTK_ENTRY(plugentry), g_module_name(p->handle));
-
+#endif
 	/* Find out if this plug-in has a configuration function */
 	if (g_module_symbol(p->handle, "gaim_plugin_config", (gpointer *)&gaim_plugin_config)) {
 		confighandle = gtk_signal_connect(GTK_OBJECT(config), "clicked",
@@ -409,7 +539,7 @@
 static const gchar *plugin_makelistname(GModule *module)
 {
 	static gchar filename[PATHSIZE];
-	gchar *filepath = g_module_name(module);
+	gchar *filepath = (char *)g_module_name(module);
 	char *cp;
 
 	if (filepath == NULL || strlen(filepath) == 0)
@@ -429,4 +559,78 @@
 	return filename;
 }		
 
+#if GTK_CHECK_VERSION(1,3,0)
+static struct gaim_plugin *get_selected_plugin(GtkWidget *w) {
+	/* Given the pluglist widget, this will return a pointer to the plugin
+	 * currently selected in the list, and NULL if none is selected. */
+	gint index;
+	GList *plugs = plugins;
+	GtkTreeSelection *sel;
+	GtkTreeIter iter;
+	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w));
+
+	/* Get list index of selected plugin */
+	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
+	if(!gtk_tree_selection_get_selected(sel, &model, &iter))
+		return NULL;
+	gtk_tree_model_get(model, &iter, 1, &index, -1);
+				
+	/* Get plugin entry from index */
+	plugs = g_list_nth(plugins, index);
+	if(plugs == NULL)
+		return NULL;
+	else
+		return (struct gaim_plugin *)plugs->data;
+}
+
+static void select_plugin(GtkWidget *w, struct gaim_plugin *p) {
+	/* Given the pluglist widget and a plugin, this will try to select
+	 * entry in the list which corresponds with the plugin. */
+	GtkTreeSelection *sel;
+	GtkTreeIter iter;
+	GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(w));
+	gchar temp[10];
+	
+	if(g_list_index(plugins, p) == -1)
+		return;
+
+	snprintf(temp, 10, "%d", g_list_index(plugins, p));
+	gtk_tree_model_get_iter_from_string(model, 
+			&iter, temp);
+	sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(w));
+	gtk_tree_selection_select_iter(sel, &iter);
+}
+#endif /* GTK_CHECK_VERSION */
+
+static void clear_plugin_display() {
+#if GTK_CHECK_VERSION(1,3,0)
+	GtkTreeSelection *selection;
+	GtkTextBuffer *buffer;
+	
+	/* Clear the plugin display if nothing's selected */
+	selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(pluglist));
+	if(gtk_tree_selection_get_selected(selection, NULL, NULL) == FALSE) {
+		buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(plugtext));
+		gtk_text_buffer_set_text(buffer, "", -1);
+		gtk_entry_set_text(GTK_ENTRY(plugentry), "");
+
+		gtk_widget_set_sensitive(config, FALSE);
+		gtk_widget_set_sensitive(reload, FALSE);
+		gtk_widget_set_sensitive(unload, FALSE);
+	}
+#else
+	/* Clear the display if nothing's selected */
+	if (GTK_LIST(pluglist)->selection == NULL) {
+		guint text_len = gtk_text_get_length(GTK_TEXT(plugtext));
+		gtk_text_set_point(GTK_TEXT(plugtext), 0);
+		gtk_text_forward_delete(GTK_TEXT(plugtext), text_len);
+		gtk_entry_set_text(GTK_ENTRY(plugentry), "");
+
+		gtk_widget_set_sensitive(config, FALSE);
+		gtk_widget_set_sensitive(reload, FALSE);
+		gtk_widget_set_sensitive(unload, FALSE);
+	}
 #endif
+}
+
+#endif
--- a/src/prefs.c	Fri Aug 02 21:25:34 2002 +0000
+++ b/src/prefs.c	Mon Aug 05 07:33:09 2002 +0000
@@ -843,7 +843,7 @@
 	gtk_widget_show (frame);
 	vbox = gtk_vbox_new(FALSE, 5);
 	gtk_container_add (GTK_CONTAINER (frame), vbox);
-	gaim_dropdown(vbox, "Broswer", &web_browser_new, -1, 
+	gaim_dropdown(vbox, "Browser", &web_browser_new, -1, 
 		      "Netscape", BROWSER_NETSCAPE,
 		      "Konqueror", BROWSER_KONQ,
 		      "Mozilla", BROWSER_MOZILLA,
@@ -1035,7 +1035,6 @@
 	gaim_button(_("Sending messages removes away status"), &away_options_new, OPT_AWAY_BACK_ON_IM, vbox);
 	gaim_button(_("Queue new messages when away"), &away_options_new, OPT_AWAY_QUEUE, vbox);
 	gaim_button(_("Ignore new conversations when away"), &away_options_new, OPT_AWAY_DISCARD, vbox);
-	gaim_button(_("Sounds while away"), &sound_options_new, OPT_SOUND_WHEN_AWAY, vbox);
 	gtk_widget_show (vbox);
 
 
@@ -1221,7 +1220,7 @@
 	gtk_tree_model_get_value (model, &iter, 2, &val);
 	sound_row_sel = g_value_get_uint(&val);
 	if (sound_entry)
-		gtk_entry_set_text(sound_entry, sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)");
+		gtk_entry_set_text(GTK_ENTRY(sound_entry), sound_file_new[sound_row_sel] ? sound_file_new[sound_row_sel] : "(default)");
 	g_value_unset (&val);
 	if (sounddialog)
 		gtk_widget_destroy(sounddialog);
@@ -1363,13 +1362,14 @@
 	gchar *message;
 	gchar buffer[BUF_LONG];
 	char *tmp;
+	struct away_message *am;
 
 	if (! gtk_tree_selection_get_selected (sel, &model, &iter))
 		return;
 	gtk_tree_model_get_value (model, &iter, 1, &val);
-	message = g_value_get_string(&val);
+	am = g_value_get_pointer(&val);
 	gtk_imhtml_clear(GTK_IMHTML(away_text));
-	strcpy(buffer, message);
+	strncpy(buffer, am->message, BUF_LONG);
 	tmp = stylize(buffer, BUF_LONG);
 	gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE |
 			       GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
@@ -1390,7 +1390,7 @@
 	
 	if (! gtk_tree_selection_get_selected (sel, &prefs_away_store, &iter))
 		return;
-	gtk_tree_model_get_value (prefs_away_store, &iter, 2, &val);
+	gtk_tree_model_get_value (prefs_away_store, &iter, 1, &val);
 	am = g_value_get_pointer (&val);
 	gtk_imhtml_clear(GTK_IMHTML(away_text));
 	rem_away_mess(NULL, am);
@@ -1400,8 +1400,41 @@
 }
 
 #else
-void away_message_sel(GtkWidget *w, GtkWidget *list) {}
-void remove_away_message(GtkWidget *widget, GtkWidget *list) {}
+static struct away_message *cur_message;
+void away_message_sel(GtkWidget *w, struct away_message *a) {
+	gchar buffer[BUF_LONG];
+	char *tmp;
+
+	cur_message = a;
+
+	/* Clear the Box */
+	gtk_imhtml_clear(GTK_IMHTML(away_text));
+
+	/* Fill the text box with new message */
+	strncpy(buffer, a->message, BUF_LONG);
+	tmp = stylize(buffer, BUF_LONG);
+
+	debug_printf("FSD: %s\n", tmp);
+	gtk_imhtml_append_text(GTK_IMHTML(away_text), tmp, -1, GTK_IMHTML_NO_TITLE |
+			       GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
+	gtk_imhtml_append_text(GTK_IMHTML(away_text), "<BR>", -1, GTK_IMHTML_NO_TITLE |
+			       GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_SCROLL);
+	g_free(tmp);
+}
+void remove_away_message(GtkWidget *widget, GtkWidget *list) {
+	GList *i;
+	struct away_message *a;
+
+	i = GTK_LIST(prefs_away_list)->selection;
+
+	if (!i)
+		return;
+	if (!i->next) {
+		gtk_imhtml_clear(GTK_IMHTML(away_text));
+	}
+	a = gtk_object_get_user_data(GTK_OBJECT(i->data));
+	rem_away_mess(NULL, a);
+}
 #endif
 
 GtkWidget *away_message_page() {
@@ -1418,8 +1451,6 @@
 	GtkTreeViewColumn *col;
 	GtkTreeSelection *sel;
 	GtkTreePath *path;
-#else
-	GtkWidget *list;
 #endif
 	GSList *awy = away_messages;
 	struct away_message *a;
@@ -1439,14 +1470,13 @@
 	gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0);
       
 #if GTK_CHECK_VERSION(1,3,0)
-	prefs_away_store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
+	prefs_away_store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
 	while (awy) {
 		a = (struct away_message *)awy->data;
 		gtk_list_store_append (prefs_away_store, &iter);
 		gtk_list_store_set(prefs_away_store, &iter,
-				   0, a->name, 
-				   1, a->message,
-				   2, a, -1);
+				   0, a->name,
+				   1, a, -1);
 		awy = awy->next;
 	}
 	event_view = gtk_tree_view_new_with_model (GTK_TREE_MODEL(prefs_away_store));
@@ -1462,16 +1492,32 @@
 	gtk_widget_show(event_view);
 	gtk_container_add(GTK_CONTAINER(sw), event_view);
 #else
-	list = gtk_clist_new(1);
+	prefs_away_list = gtk_list_new();
 	while (awy) {
-		char *msg;
+		GtkWidget *ambox = gtk_hbox_new(FALSE, 5);
+		GtkWidget *list_item =gtk_list_item_new();
+		GtkWidget *label;
 		a = (struct away_message *)awy->data;
-		msg = a->name;
-		gtk_clist_append(GTK_CLIST(list), &msg);
+		gtk_container_add(GTK_CONTAINER(prefs_away_list), list_item);
+		gtk_signal_connect(GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(away_message_sel),
+				   a);
+		gtk_object_set_user_data(GTK_OBJECT(list_item), a);
+
+		gtk_widget_show(list_item);
+
+		ambox = gtk_hbox_new(FALSE, 5);
+		gtk_container_add(GTK_CONTAINER(list_item), ambox);
+		gtk_widget_show(ambox);
+
+		label = gtk_label_new(a->name);
+		gtk_box_pack_start(GTK_BOX(ambox), label, FALSE, FALSE, 5);
+		gtk_widget_show(label);
+
 		awy = awy->next;
+		
 	}
-	gtk_widget_show(list);
-	gtk_container_add(GTK_CONTAINER(sw), list);
+	gtk_widget_show(prefs_away_list);
+	gtk_container_add(GTK_CONTAINER(sw), prefs_away_list);
 #endif
 
 	gtk_widget_show (vbox);
@@ -1504,8 +1550,6 @@
 	g_signal_connect (G_OBJECT (sel), "changed",
 			  G_CALLBACK (away_message_sel),
 			  NULL);
-#else
-	gtk_signal_connect(GTK_OBJECT(list), "changed", GTK_SIGNAL_FUNC(away_message_sel), NULL);
 #endif	
 	hbox = gtk_hbox_new(TRUE, 5);
 	gtk_widget_show(hbox);
@@ -1526,7 +1570,7 @@
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), event_view);
 #else
 	button = picture_button(prefs, _("Remove"), gnome_remove_xpm);
-	//gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view);
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(remove_away_message), prefs_away_list);
 #endif	
 	gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0);
 	if (misc_options & OPT_MISC_COOL_LOOK)
@@ -1535,6 +1579,7 @@
 	
 #if GTK_CHECK_VERSION (1,3,0)
 	button = pixbuf_button(_("_Edit"), "edit.png");
+	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), event_view);
 #else
 	button = picture_button(prefs, _("Edit"), save_xpm);
 	gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(create_away_mess), button);