summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
Diffstat (limited to 'src/fe-gtk')
-rw-r--r--src/fe-gtk/Makefile.am2
-rw-r--r--src/fe-gtk/about.c11
-rw-r--r--src/fe-gtk/about.h24
-rw-r--r--src/fe-gtk/ascii.c8
-rw-r--r--src/fe-gtk/ascii.h24
-rw-r--r--src/fe-gtk/banlist.c605
-rw-r--r--src/fe-gtk/banlist.h75
-rw-r--r--src/fe-gtk/chanlist.c17
-rw-r--r--src/fe-gtk/chanlist.h24
-rw-r--r--src/fe-gtk/chanview-tabs.c19
-rw-r--r--src/fe-gtk/chanview-tree.c43
-rw-r--r--src/fe-gtk/chanview.c25
-rw-r--r--src/fe-gtk/chanview.h24
-rw-r--r--src/fe-gtk/custom-list.c19
-rw-r--r--src/fe-gtk/custom-list.h27
-rw-r--r--src/fe-gtk/dccgui.c18
-rw-r--r--src/fe-gtk/editlist.c6
-rw-r--r--src/fe-gtk/editlist.h24
-rw-r--r--src/fe-gtk/fe-gtk-xp.vcxproj179
-rw-r--r--src/fe-gtk/fe-gtk-xp.vcxproj.filters219
-rw-r--r--src/fe-gtk/fe-gtk.c31
-rw-r--r--src/fe-gtk/fe-gtk.h34
-rw-r--r--src/fe-gtk/fkeys.c18
-rw-r--r--src/fe-gtk/fkeys.h24
-rw-r--r--src/fe-gtk/gtkutil.c34
-rw-r--r--src/fe-gtk/gtkutil.h27
-rw-r--r--src/fe-gtk/ignoregui.c36
-rw-r--r--src/fe-gtk/joind.c35
-rw-r--r--src/fe-gtk/joind.h24
-rw-r--r--src/fe-gtk/maingui.c39
-rw-r--r--src/fe-gtk/maingui.h24
-rw-r--r--src/fe-gtk/menu.c16
-rw-r--r--src/fe-gtk/menu.h24
-rw-r--r--src/fe-gtk/mmx_cmod.h24
-rw-r--r--src/fe-gtk/notifygui.c15
-rw-r--r--src/fe-gtk/notifygui.h24
-rw-r--r--src/fe-gtk/palette.h24
-rw-r--r--src/fe-gtk/pixmaps.c2
-rw-r--r--src/fe-gtk/pixmaps.h24
-rw-r--r--src/fe-gtk/plugin-tray.c23
-rw-r--r--src/fe-gtk/plugin-tray.h24
-rw-r--r--src/fe-gtk/plugingui.c12
-rw-r--r--src/fe-gtk/plugingui.h24
-rw-r--r--src/fe-gtk/rawlog.c16
-rw-r--r--src/fe-gtk/rawlog.h24
-rw-r--r--src/fe-gtk/search.c22
-rw-r--r--src/fe-gtk/search.h24
-rw-r--r--src/fe-gtk/servlistgui.c38
-rw-r--r--src/fe-gtk/servlistgui.h24
-rw-r--r--src/fe-gtk/setup.c110
-rw-r--r--src/fe-gtk/setup.h26
-rw-r--r--src/fe-gtk/sexy-marshal.c19
-rw-r--r--src/fe-gtk/sexy-marshal.h19
-rw-r--r--src/fe-gtk/sexy-spell-entry.h12
-rw-r--r--src/fe-gtk/textgui.c10
-rw-r--r--src/fe-gtk/textgui.h24
-rw-r--r--src/fe-gtk/urlgrab.c11
-rw-r--r--src/fe-gtk/urlgrab.h24
-rw-r--r--src/fe-gtk/userlistgui.c40
-rw-r--r--src/fe-gtk/userlistgui.h24
-rw-r--r--src/fe-gtk/xtext.c15
-rw-r--r--src/fe-gtk/xtext.h27
62 files changed, 1473 insertions, 991 deletions
diff --git a/src/fe-gtk/Makefile.am b/src/fe-gtk/Makefile.am
index 3928b413..8bbad35d 100644
--- a/src/fe-gtk/Makefile.am
+++ b/src/fe-gtk/Makefile.am
@@ -2,7 +2,7 @@ localedir = $(datadir)/locale
 
 bin_PROGRAMS = hexchat
 
-AM_CPPFLAGS = $(GUI_CFLAGS) -DG_DISABLE_CAST_CHECKS -DLOCALEDIR=\"$(localedir)\"
+AM_CPPFLAGS = $(GUI_CFLAGS) -DLOCALEDIR=\"$(localedir)\"
 
 hexchat_LDADD = ../common/libhexchatcommon.a $(GUI_LIBS)
 
diff --git a/src/fe-gtk/about.c b/src/fe-gtk/about.c
index 54b71053..c47fba4f 100644
--- a/src/fe-gtk/about.c
+++ b/src/fe-gtk/about.c
@@ -22,17 +22,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkwindow.h>
-
 #ifdef USE_XLIB
 #include <gdk/gdkx.h>
 #endif
diff --git a/src/fe-gtk/about.h b/src/fe-gtk/about.h
index 2bad159c..b4d5cb34 100644
--- a/src/fe-gtk/about.h
+++ b/src/fe-gtk/about.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_ABOUT_H
+#define HEXCHAT_ABOUT_H
+
 void menu_about (GtkWidget * wid, gpointer sess);
+
+#endif
diff --git a/src/fe-gtk/ascii.c b/src/fe-gtk/ascii.c
index 06621cd7..56b0198b 100644
--- a/src/fe-gtk/ascii.c
+++ b/src/fe-gtk/ascii.c
@@ -22,12 +22,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkeditable.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkbutton.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "gtkutil.h"
@@ -90,7 +84,6 @@ static const unsigned char table[]=
 0xd1,0x89,0xd1,0x8a,0xd1,0x8b,0xd1,0x8c,0xd1,0x8d,0xd1,0x8e,0xd1,0x8f,0
 };
 
-
 static gboolean
 ascii_enter (GtkWidget * wid, GdkEventCrossing *event, GtkWidget *label)
 {
@@ -133,6 +126,7 @@ ascii_open (void)
 	win = mg_create_generic_tab ("charmap", _("Character Chart"), TRUE, TRUE,
 										  NULL, NULL, 0, 0, &vbox, NULL);
 	gtk_container_set_border_width (GTK_CONTAINER (win), 5);
+	gtkutil_destroy_on_esc (win);
 
 	label = gtk_label_new (NULL);
 
diff --git a/src/fe-gtk/ascii.h b/src/fe-gtk/ascii.h
index afd3bd4f..18d63415 100644
--- a/src/fe-gtk/ascii.h
+++ b/src/fe-gtk/ascii.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_ASCII_H
+#define HEXCHAT_ASCII_H
+
 void ascii_open (void);
+
+#endif
diff --git a/src/fe-gtk/banlist.c b/src/fe-gtk/banlist.c
index a783ea07..8c396d14 100644
--- a/src/fe-gtk/banlist.c
+++ b/src/fe-gtk/banlist.c
@@ -28,15 +28,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-
 #include "../common/hexchat.h"
 #include "../common/fe.h"
 #include "../common/modes.h"
@@ -46,9 +37,56 @@
 #include "maingui.h"
 #include "banlist.h"
 
+/*
+ * These supports_* routines set capable, readable, writable bits */
+static void supports_bans (banlist_info *, int);
+static void supports_exempt (banlist_info *, int);
+static void supports_invite (banlist_info *, int);
+static void supports_quiet (banlist_info *, int);
+
+static mode_info modes[MODE_CT] = {
+	{
+		N_("Bans"),
+		N_("Ban"),
+		'b',
+		RPL_BANLIST,
+		RPL_ENDOFBANLIST,
+		1<<MODE_BAN,
+		supports_bans
+	}
+	,{
+		N_("Exempts"),
+		N_("Exempt"),
+		'e',
+		RPL_EXCEPTLIST,
+		RPL_ENDOFEXCEPTLIST,
+		1<<MODE_EXEMPT,
+		supports_exempt
+	}
+	,{
+		N_("Invites"),
+		N_("Invite"),
+		'I',
+		RPL_INVITELIST,
+		RPL_ENDOFINVITELIST,
+		1<<MODE_INVITE,
+		supports_invite
+	}
+	,{
+		N_("Quiets"),
+		N_("Quiet"),
+		'q',
+		RPL_QUIETLIST,
+		RPL_ENDOFQUIETLIST,
+		1<<MODE_QUIET,
+		supports_quiet
+	}
+};
+
 /* model for the banlist tree */
 enum
 {
+	TYPE_COLUMN,
 	MASK_COLUMN,
 	FROM_COLUMN,
 	DATE_COLUMN,
@@ -58,7 +96,7 @@ enum
 static GtkTreeView *
 get_view (struct session *sess)
 {
-	return GTK_TREE_VIEW (sess->res->banlist_treeview);
+	return GTK_TREE_VIEW (sess->res->banlist->treeview);
 }
 
 static GtkListStore *
@@ -67,91 +105,280 @@ get_store (struct session *sess)
 	return GTK_LIST_STORE (gtk_tree_view_get_model (get_view (sess)));
 }
 
-static gboolean
-supports_exempt (server *serv)
+static void
+supports_bans (banlist_info *banl, int i)
+{
+	int bit = 1<<i;
+
+	banl->capable |= bit;
+	banl->readable |= bit;
+	banl->writeable |= bit;
+	return;
+}
+
+static void
+supports_exempt (banlist_info *banl, int i)
 {
+	server *serv = banl->sess->server;
 	char *cm = serv->chanmodes;
+	int bit = 1<<i;
 
 	if (serv->have_except)
-		return TRUE;
+		goto yes;
 
 	if (!cm)
-		return FALSE;
+		return;
 
 	while (*cm)
 	{
 		if (*cm == ',')
 			break;
 		if (*cm == 'e')
-			return TRUE;
+			goto yes;
 		cm++;
 	}
+	return;
 
-	return FALSE;
+yes:
+	banl->capable |= bit;
+	banl->writeable |= bit;
 }
 
-void
-fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int is_exempt)
+static void
+supports_invite (banlist_info *banl, int i)
+{
+	server *serv = banl->sess->server;
+	char *cm = serv->chanmodes;
+	int bit = 1<<i;
+
+	if (serv->have_invite)
+		goto yes;
+
+	if (!cm)
+		return;
+
+	while (*cm)
+	{
+		if (*cm == ',')
+			break;
+		if (*cm == 'I')
+			goto yes;
+		cm++;
+	}
+	return;
+
+yes:
+	banl->capable |= bit;
+	banl->writeable |= bit;
+}
+
+static void
+supports_quiet (banlist_info *banl, int i)
+{
+	server *serv = banl->sess->server;
+	char *cm = serv->chanmodes;
+	int bit = 1<<i;
+
+	if (!cm)
+		return;
+
+	while (*cm)
+	{
+		if (*cm == ',')
+			break;
+		if (*cm == modes[i].letter)
+			goto yes;
+		cm++;
+	}
+	return;
+
+yes:
+	banl->capable |= bit;
+	banl->readable |= bit;
+	banl->writeable |= bit;
+}
+
+/* fe_add_ban_list() and fe_ban_list_end() return TRUE if consumed, FALSE otherwise */
+gboolean
+fe_add_ban_list (struct session *sess, char *mask, char *who, char *when, int rplcode)
 {
+	banlist_info *banl = sess->res->banlist;
+	int i;
 	GtkListStore *store;
 	GtkTreeIter iter;
-	char buf[512];
 
-	store = get_store (sess);
-	gtk_list_store_append (store, &iter);
+	if (!banl)
+		return FALSE;
 
-	if (is_exempt)
+	for (i = 0; i < MODE_CT; i++)
+		if (modes[i].code == rplcode)
+			break;
+	if (i == MODE_CT)
 	{
-		snprintf (buf, sizeof (buf), "(EX) %s", mask);
-		gtk_list_store_set (store, &iter, 0, buf, 1, who, 2, when, -1);
-	} else
+		/* printf ("Unexpected value in fe_add_ban_list:  %d\n", rplcode); */
+		return FALSE;
+	}
+	if (banl->pending & 1<<i)
 	{
-		gtk_list_store_set (store, &iter, 0, mask, 1, who, 2, when, -1);
+		store = get_store (sess);
+		gtk_list_store_append (store, &iter);
+
+		gtk_list_store_set (store, &iter, TYPE_COLUMN, _(modes[i].type), MASK_COLUMN, mask,
+						FROM_COLUMN, who, DATE_COLUMN, when, -1);
+
+		banl->line_ct++;
+		return TRUE;
 	}
+	else return FALSE;
 }
 
-void
-fe_ban_list_end (struct session *sess, int is_exemption)
+/* Sensitize checkboxes and buttons as appropriate for the moment  */
+static void
+banlist_sensitize (banlist_info *banl)
 {
-	gtk_widget_set_sensitive (sess->res->banlist_butRefresh, TRUE);
+	int checkable, i;
+
+	/* CHECKBOXES -- */
+	checkable = banl->sess->me->op? banl->writeable: banl->readable;
+	for (i = 0; i < MODE_CT; i++)
+	{
+		if (banl->checkboxes[i] == NULL)
+			continue;
+		if ((checkable & 1<<i) == 0)
+		/* Checkbox is not checkable.  Grey it and uncheck it. */
+		{
+			gtk_widget_set_sensitive (banl->checkboxes[i], FALSE);
+			gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (banl->checkboxes[i]), FALSE);
+		}
+		else
+		/* Checkbox is checkable.  Be sure it's sensitive. */
+		{
+			gtk_widget_set_sensitive (banl->checkboxes[i], TRUE);
+		}
+	}
+
+	/* BUTTONS --- */
+	if (banl->sess->me->op == 0 || banl->line_ct == 0)
+	{
+		/* If user is not op or list is empty, buttons should be all greyed */
+		gtk_widget_set_sensitive (banl->but_clear, FALSE);
+		gtk_widget_set_sensitive (banl->but_crop, FALSE);
+		gtk_widget_set_sensitive (banl->but_remove, FALSE);
+	}
+	else
+	{
+		/* If no lines are selected, only the CLEAR button should be sensitive */
+		if (banl->select_ct == 0)
+		{
+			gtk_widget_set_sensitive (banl->but_clear, TRUE);
+			gtk_widget_set_sensitive (banl->but_crop, FALSE);
+			gtk_widget_set_sensitive (banl->but_remove, FALSE);
+		}
+		/* If any lines are selected, only the REMOVE and CROP buttons should be sensitive */
+		else
+		{
+			gtk_widget_set_sensitive (banl->but_clear, FALSE);
+			gtk_widget_set_sensitive (banl->but_crop, TRUE);
+			gtk_widget_set_sensitive (banl->but_remove, TRUE);
+		}
+	}
+
+	/* Set "Refresh" sensitvity */
+	gtk_widget_set_sensitive (banl->but_refresh, banl->pending? FALSE: banl->checked? TRUE: FALSE);
+}
+/* fe_ban_list_end() returns TRUE if consumed, FALSE otherwise */
+gboolean
+fe_ban_list_end (struct session *sess, int rplcode)
+{
+	banlist_info *banl = sess->res->banlist;
+	int i;
+
+	if (!banl)
+		return FALSE;
+
+	for (i = 0; i < MODE_CT; i++)
+		if (modes[i].endcode == rplcode)
+			break;
+	if (i == MODE_CT)
+	{
+		/* printf ("Unexpected rplcode value in fe_ban_list_end:  %d\n", rplcode); */
+		return FALSE;
+	}
+	if (banl->pending & modes[i].bit)
+	{
+		banl->pending &= ~modes[i].bit;
+		if (!banl->pending)
+		{
+			gtk_widget_set_sensitive (banl->but_refresh, TRUE);
+			banlist_sensitize (banl);
+		}
+		return TRUE;
+	}
+	else return FALSE;
+}
+
+static void
+banlist_select_changed (GtkWidget *item, banlist_info *banl)
+{
+	GList *list;
+
+	if (banl->line_ct == 0)
+		banl->select_ct = 0;
+	else
+	{
+		list = gtk_tree_selection_get_selected_rows (GTK_TREE_SELECTION (item), NULL);
+		banl->select_ct = list? 1: 0;
+		g_list_foreach (list, (GFunc) gtk_tree_path_free, NULL);
+		g_list_free (list);
+	}
+	banlist_sensitize (banl);
 }
 
 /**
  *  * Performs the actual refresh operations.
  *  */
 static void
-banlist_do_refresh (struct session *sess)
+banlist_do_refresh (banlist_info *banl)
 {
+	session *sess = banl->sess;
 	char tbuf[256];
+	int i;
+	char *tbufp;
+
+	banlist_sensitize (banl);
+
 	if (sess->server->connected)
 	{
 		GtkListStore *store;
 
-		gtk_widget_set_sensitive (sess->res->banlist_butRefresh, FALSE);
-
-		snprintf (tbuf, sizeof tbuf, DISPLAY_NAME": Ban List (%s, %s)",
+		g_snprintf (tbuf, sizeof tbuf, DISPLAY_NAME": Ban List (%s, %s)",
 						sess->channel, sess->server->servername);
-		mg_set_title (sess->res->banlist_window, tbuf);
+		mg_set_title (banl->window, tbuf);
 
 		store = get_store (sess);
 		gtk_list_store_clear (store);
-
-		handle_command (sess, "ban", FALSE);
-
-		if (supports_exempt (sess->server))
+		banl->line_ct = 0;
+		banl->pending = banl->checked;
+		if (banl->pending)
 		{
-			snprintf (tbuf, sizeof (tbuf), "quote mode %s +e", sess->channel);
+			tbufp = tbuf + g_snprintf (tbuf, sizeof tbuf, "quote mode %s +", sess->channel);
+			for (i = 0; i < MODE_CT; i++)
+				if (banl->pending & 1<<i)
+				{
+					*tbufp++ = modes[i].letter;
+				}
+			*tbufp = 0;
 			handle_command (sess, tbuf, FALSE);
 		}
-
-	} else
+	}
+	else
 	{
 		fe_message (_("Not connected."), FE_MSG_ERROR);
 	}
 }
 
 static void
-banlist_refresh (GtkWidget * wid, struct session *sess)
+banlist_refresh (GtkWidget * wid, banlist_info *banl)
 {
 	/* JG NOTE: Didn't see actual use of wid here, so just forwarding
 	   *          * this to chanlist_do_refresh because I use it without any widget
@@ -159,123 +386,106 @@ banlist_refresh (GtkWidget * wid, struct session *sess)
 	   *          * or apply for the first time if the list has not yet been
 	   *          * received.
 	   *          */
-	banlist_do_refresh (sess);
+	banlist_do_refresh (banl);
 }
 
 static int
-banlist_unban_inner (gpointer none, struct session *sess, int do_exempts)
+banlist_unban_inner (gpointer none, banlist_info *banl, int mode_num)
 {
+	session *sess = banl->sess;
 	GtkTreeModel *model;
 	GtkTreeSelection *sel;
 	GtkTreeIter iter;
 	char tbuf[2048];
-	char **masks, *tmp, *space;
+	char **masks, *mask, *type;
 	int num_sel, i;
 
+
 	/* grab the list of selected items */
 	model = GTK_TREE_MODEL (get_store (sess));
 	sel = gtk_tree_view_get_selection (get_view (sess));
-	num_sel = 0;
-	if (gtk_tree_model_get_iter_first (model, &iter))
-	{
-		do
-		{
-			if (gtk_tree_selection_iter_is_selected (sel, &iter))
-				num_sel++;
-		}
-		while (gtk_tree_model_iter_next (model, &iter));
-	}
 
-	if (num_sel < 1)
+	if (!gtk_tree_model_get_iter_first (model, &iter))
 		return 0;
 
-	/* create an array of all the masks */
-	masks = calloc (1, num_sel * sizeof (char *));
-
-	i = 0;
-	gtk_tree_model_get_iter_first (model, &iter);
+	masks = g_malloc (sizeof (char *) * banl->line_ct);
+	num_sel = 0;
 	do
 	{
 		if (gtk_tree_selection_iter_is_selected (sel, &iter))
 		{
-			gtk_tree_model_get (model, &iter, MASK_COLUMN, &masks[i], -1);
-			space = strchr (masks[i], ' ');
+			/* Get the mask part of this selected line */
+			gtk_tree_model_get (model, &iter, TYPE_COLUMN, &type, MASK_COLUMN, &mask, -1);
 
-			if (do_exempts)
-			{
-				if (space)
-				{
-					/* remove the "(EX) " */
-					tmp = masks[i];
-					masks[i] = g_strdup (space + 1);
-					g_free (tmp);
-					i++;
-				}
-			} else
-			{
-				if (!space)
-					i++;
-			}
+			/* If it's the wrong type of mask, just continue */
+			if (strcmp (_(modes[mode_num].type), type) != 0)
+				continue;
+
+			/* Otherwise add it to our array of mask pointers */
+			masks[num_sel++] = g_strdup (mask);
+			g_free (mask);
+			g_free (type);
 		}
 	}
 	while (gtk_tree_model_iter_next (model, &iter));
 
 	/* and send to server */
-	if (do_exempts)
-		send_channel_modes (sess, tbuf, masks, 0, i, '-', 'e', 0);
-	else
-		send_channel_modes (sess, tbuf, masks, 0, i, '-', 'b', 0);
+	if (num_sel)
+		send_channel_modes (sess, tbuf, masks, 0, num_sel, '-', modes[mode_num].letter, 0);
 
-	/* now free everything, and refresh banlist */	
+	/* now free everything */
 	for (i=0; i < num_sel; i++)
 		g_free (masks[i]);
-	free (masks);
+	g_free (masks);
 
 	return num_sel;
 }
 
 static void
-banlist_unban (GtkWidget * wid, struct session *sess)
+banlist_unban (GtkWidget * wid, banlist_info *banl)
 {
-	int num = 0;
+	int i, num = 0;
 
-	num += banlist_unban_inner (wid, sess, FALSE);
-	num += banlist_unban_inner (wid, sess, TRUE);
+	for (i = 0; i < MODE_CT; i++)
+		num += banlist_unban_inner (wid, banl, i);
 
+	/* This really should not occur with the redesign */
 	if (num < 1)
 	{
 		fe_message (_("You must select some bans."), FE_MSG_ERROR);
 		return;
 	}
 
-	banlist_do_refresh (sess);
+	banlist_do_refresh (banl);
 }
 
 static void
-banlist_clear_cb (GtkDialog *dialog, gint response, gpointer sess)
+banlist_clear_cb (GtkDialog *dialog, gint response, gpointer data)
 {
+	banlist_info *banl = data;
 	GtkTreeSelection *sel;
 
 	gtk_widget_destroy (GTK_WIDGET (dialog));
 
 	if (response == GTK_RESPONSE_OK)
 	{
-		sel = gtk_tree_view_get_selection (get_view (sess));
+		sel = gtk_tree_view_get_selection (get_view (banl->sess));
 		gtk_tree_selection_select_all (sel);
-		banlist_unban (NULL, sess);
+		banlist_unban (NULL, banl);
 	}
 }
 
 static void
-banlist_clear (GtkWidget * wid, struct session *sess)
+banlist_clear (GtkWidget * wid, banlist_info *banl)
 {
 	GtkWidget *dialog;
 
 	dialog = gtk_message_dialog_new (NULL, 0,
 								GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
-					_("Are you sure you want to remove all bans in %s?"), sess->channel);
+					_("Are you sure you want to remove all listed items in %s?"), banl->sess->channel);
+
 	g_signal_connect (G_OBJECT (dialog), "response",
-							G_CALLBACK (banlist_clear_cb), sess);
+							G_CALLBACK (banlist_clear_cb), banl);
 	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
 	gtk_widget_show (dialog);
 }
@@ -298,8 +508,9 @@ banlist_add_selected_cb (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *it
 }
 
 static void
-banlist_crop (GtkWidget * wid, struct session *sess)
+banlist_crop (GtkWidget * wid, banlist_info *banl)
 {
+	session *sess = banl->sess;
 	GtkTreeSelection *select;
 	GSList *list = NULL, *node;
 	int num_sel;
@@ -318,44 +529,147 @@ banlist_crop (GtkWidget * wid, struct session *sess)
 
 		for (node = list; node; node = node->next)
 			gtk_tree_selection_unselect_iter (select, node->data);
-		
+
 		g_slist_foreach (list, (GFunc)g_free, NULL);
 		g_slist_free (list);
 
-		banlist_unban (NULL, sess);
+		banlist_unban (NULL, banl);
 	} else
 		fe_message (_("You must select some bans."), FE_MSG_ERROR);
 }
 
+static void
+banlist_toggle (GtkWidget *item, gpointer data)
+{
+	banlist_info *banl = data;
+	int i, bit = 0;
+
+	for (i = 0; i < MODE_CT; i++)
+		if (banl->checkboxes[i] == item)
+		{
+			bit = 1<<i;
+			break;
+		}
+
+	if (bit)		/* Should be gassert() */
+	{
+		banl->checked &= ~bit;
+		banl->checked |= (GTK_TOGGLE_BUTTON (item)->active)? bit: 0;
+		banlist_do_refresh (banl);
+	}
+}
+
+/* NOTICE:  The official strptime() is not available on all platforms so
+ * I've implemented a special version here.  The official version is
+ * vastly more general than this:  it uses locales for weekday and month
+ * names and its second arg is a format character-string.  This special
+ * version depends on the format returned by ctime(3) whose manpage
+ * says it returns:
+ *     "a null-terminated string of the form "Wed Jun 30 21:49:08 1993\n"
+ *
+ * If the real strpftime() comes available, use this format string:
+ *		#define DATE_FORMAT "%a %b %d %T %Y"
+ */
+static void
+banlist_strptime (char *ti, struct tm *tm)
+{
+	/* Expect something like "Sat Mar 16 21:24:27 2013" */
+	static char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+								  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", NULL };
+	int M = -1, d = -1, h = -1, m = -1, s = -1, y = -1;
+
+	if (*ti == 0)
+	{
+		memset (tm, 0, sizeof *tm);
+		return;
+	}
+	/* No need to supply tm->tm_wday; mktime() doesn't read it */
+	ti += 4;
+	while ((mon[++M]))
+		if (strncmp (ti, mon[M], 3) == 0)
+			break;
+	ti += 4;
+
+	d = strtol (ti, &ti, 10);
+	h = strtol (++ti, &ti, 10);
+	m = strtol (++ti, &ti, 10);
+	s = strtol (++ti, &ti, 10);
+	y = strtol (++ti, NULL, 10) - 1900;
+
+	tm->tm_sec = s;
+	tm->tm_min = m;
+	tm->tm_hour = h;
+	tm->tm_mday = d;
+	tm->tm_mon = M;
+	tm->tm_year = y;
+}
+
+gint
+banlist_date_sort (GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer user_data)
+{
+	struct tm tm1, tm2;
+	time_t t1, t2;
+	char *time1, *time2;
+
+	gtk_tree_model_get(model, a, DATE_COLUMN, &time1, -1);
+	gtk_tree_model_get(model, b, DATE_COLUMN, &time2, -1);
+	banlist_strptime (time1, &tm1);
+	banlist_strptime (time2, &tm2);
+	t1 = mktime (&tm1);
+	t2 = mktime (&tm2);
+
+	if (t1 < t2) return 1;
+	if (t1 == t2) return 0;
+	return -1;
+}
+
 static GtkWidget *
-banlist_treeview_new (GtkWidget *box)
+banlist_treeview_new (GtkWidget *box, banlist_info *banl)
 {
 	GtkListStore *store;
 	GtkWidget *view;
 	GtkTreeSelection *select;
 	GtkTreeViewColumn *col;
+	GtkTreeSortable *sortable;
 
 	store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING,
-	                            G_TYPE_STRING);
+										 G_TYPE_STRING, G_TYPE_STRING);
 	g_return_val_if_fail (store != NULL, NULL);
+
+	sortable = GTK_TREE_SORTABLE (store);
+	gtk_tree_sortable_set_sort_func (sortable, DATE_COLUMN, banlist_date_sort, GINT_TO_POINTER (DATE_COLUMN), NULL);
+
 	view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), NULL,
-	                             MASK_COLUMN, _("Mask"),
-	                             FROM_COLUMN, _("From"),
-	                             DATE_COLUMN, _("Date"), -1);
+										  TYPE_COLUMN, _("Type"),
+										  MASK_COLUMN, _("Mask"),
+										  FROM_COLUMN, _("From"),
+										  DATE_COLUMN, _("Date"), -1);
 
 	col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), MASK_COLUMN);
 	gtk_tree_view_column_set_alignment (col, 0.5);
-	gtk_tree_view_column_set_min_width (col, 300);
+	gtk_tree_view_column_set_min_width (col, 100);
 	gtk_tree_view_column_set_sort_column_id (col, MASK_COLUMN);
+	gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_column_set_resizable (col, TRUE);
+
+	col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), TYPE_COLUMN);
+	gtk_tree_view_column_set_alignment (col, 0.5);
+	gtk_tree_view_column_set_sort_column_id (col, TYPE_COLUMN);
 
 	col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), FROM_COLUMN);
 	gtk_tree_view_column_set_alignment (col, 0.5);
 	gtk_tree_view_column_set_sort_column_id (col, FROM_COLUMN);
+	gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_column_set_resizable (col, TRUE);
 
 	col = gtk_tree_view_get_column (GTK_TREE_VIEW (view), DATE_COLUMN);
 	gtk_tree_view_column_set_alignment (col, 0.5);
+	gtk_tree_view_column_set_sort_column_id (col, DATE_COLUMN);
+	gtk_tree_view_column_set_sizing (col, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
+	gtk_tree_view_column_set_resizable (col, TRUE);
 
 	select = gtk_tree_view_get_selection (GTK_TREE_VIEW (view));
+	g_signal_connect (G_OBJECT (select), "changed", G_CALLBACK (banlist_select_changed), banl);
 	gtk_tree_selection_set_mode (select, GTK_SELECTION_MULTIPLE);
 
 	gtk_widget_show (view);
@@ -363,56 +677,99 @@ banlist_treeview_new (GtkWidget *box)
 }
 
 static void
-banlist_closegui (GtkWidget *wid, session *sess)
+banlist_closegui (GtkWidget *wid, banlist_info *banl)
 {
-	if (is_session (sess))
-		sess->res->banlist_window = 0;
+	session *sess = banl->sess;
+
+	if (sess->res->banlist == banl)
+	{
+		g_free (banl);
+		sess->res->banlist = NULL;
+	}
 }
 
 void
 banlist_opengui (struct session *sess)
 {
-	GtkWidget *vbox1;
-	GtkWidget *bbox;
+	banlist_info *banl;
+	int i;
+	GtkWidget *table, *vbox, *bbox;
 	char tbuf[256];
 
-	if (sess->res->banlist_window)
+	if (sess->type != SESS_CHANNEL)
 	{
-		mg_bring_tofront (sess->res->banlist_window);
+		fe_message (_("You can only open the Ban List window while in a channel tab."), FE_MSG_ERROR);
 		return;
 	}
 
-	if (sess->type != SESS_CHANNEL)
+	if (!sess->res->banlist)
 	{
-		fe_message (_("You can only open the Ban List window while in a channel tab."), FE_MSG_ERROR);
+		sess->res->banlist = g_malloc0 (sizeof (banlist_info));
+		if (!sess->res->banlist)
+		{
+			fe_message (_("Banlist initialization failed."), FE_MSG_ERROR);
+			return;
+		}
+	}
+	banl = sess->res->banlist;
+	if (banl->window)
+	{
+		mg_bring_tofront (banl->window);
 		return;
 	}
 
-	snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Ban List (%s)"),
+	/* New banlist for this session -- Initialize it */
+	banl->sess = sess;
+	/* For each mode set its bit in capable/readable/writeable */
+	for (i = 0; i < MODE_CT; i++)
+		modes[i].tester (banl, i);
+	/* Force on the checkmark in the "Bans" box */
+	banl->checked = 1<<MODE_BAN;
+
+	g_snprintf (tbuf, sizeof tbuf, _(DISPLAY_NAME": Ban List (%s)"),
 					sess->server->servername);
 
-	sess->res->banlist_window = mg_create_generic_tab ("BanList", tbuf, FALSE,
-					TRUE, banlist_closegui, sess, 550, 200, &vbox1, sess->server);
+	banl->window = mg_create_generic_tab ("BanList", tbuf, FALSE,
+					TRUE, banlist_closegui, banl, 550, 200, &vbox, sess->server);
+	gtkutil_destroy_on_esc (banl->window);
+
+	gtk_container_set_border_width (GTK_CONTAINER (banl->window), 3);
+	gtk_box_set_spacing (GTK_BOX (vbox), 3);
 
 	/* create banlist view */
-	sess->res->banlist_treeview = banlist_treeview_new (vbox1);
+	banl->treeview = banlist_treeview_new (vbox, banl);
+
+	table = gtk_table_new (1, MODE_CT, FALSE);
+	gtk_table_set_col_spacings (GTK_TABLE (table), 16);
+	gtk_box_pack_start (GTK_BOX (vbox), table, 0, 0, 0);
+
+	for (i = 0; i < MODE_CT; i++)
+	{
+		if (!(banl->capable & 1<<i))
+			continue;
+		banl->checkboxes[i] = gtk_check_button_new_with_label (_(modes[i].name));
+		gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (banl->checkboxes[i]), (banl->checked & 1<<i? TRUE: FALSE));
+		g_signal_connect (G_OBJECT (banl->checkboxes[i]), "toggled",
+								G_CALLBACK (banlist_toggle), banl);
+		gtk_table_attach (GTK_TABLE (table), banl->checkboxes[i], i+1, i+2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+	}
 
 	bbox = gtk_hbutton_box_new ();
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_SPREAD);
 	gtk_container_set_border_width (GTK_CONTAINER (bbox), 5);
-	gtk_box_pack_end (GTK_BOX (vbox1), bbox, 0, 0, 0);
+	gtk_box_pack_end (GTK_BOX (vbox), bbox, 0, 0, 0);
 	gtk_widget_show (bbox);
 
-	gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_unban, sess,
+	banl->but_remove = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_unban, banl,
 	                _("Remove"));
-	gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_crop, sess,
+	banl->but_crop = gtkutil_button (bbox, GTK_STOCK_REMOVE, 0, banlist_crop, banl,
 	                _("Crop"));
-	gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, banlist_clear, sess,
+	banl->but_clear = gtkutil_button (bbox, GTK_STOCK_CLEAR, 0, banlist_clear, banl,
 	                _("Clear"));
 
-	sess->res->banlist_butRefresh = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, banlist_refresh, sess, _("Refresh"));
+	banl->but_refresh = gtkutil_button (bbox, GTK_STOCK_REFRESH, 0, banlist_refresh, banl, _("Refresh"));
 
-	banlist_do_refresh (sess);
+	banlist_do_refresh (banl);
 
-	gtk_widget_show (sess->res->banlist_window);
+	gtk_widget_show_all (banl->window);
 }
diff --git a/src/fe-gtk/banlist.h b/src/fe-gtk/banlist.h
index 7ceccd00..899ee5e5 100644
--- a/src/fe-gtk/banlist.h
+++ b/src/fe-gtk/banlist.h
@@ -1 +1,76 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_BANLIST_H
+#define HEXCHAT_BANLIST_H
+
+#include "../common/hexchat.h"
 void banlist_opengui (session *sess);
+
+#ifndef RPL_BANLIST
+/* Where's that darn header file, that would have all these defines ? */
+#define RPL_BANLIST 367
+#define RPL_ENDOFBANLIST 368
+#define RPL_INVITELIST 346
+#define RPL_ENDOFINVITELIST 347
+#define RPL_EXCEPTLIST 348
+#define RPL_ENDOFEXCEPTLIST 349
+#define RPL_QUIETLIST 728
+#define RPL_ENDOFQUIETLIST 729
+#endif
+
+typedef enum banlist_modes_e {
+	MODE_BAN,
+	MODE_EXEMPT,
+	MODE_INVITE,
+	MODE_QUIET,
+	MODE_CT
+} banlist_modes;
+
+typedef struct banlist_info_s {
+	session *sess;
+	int capable;	/* MODE bitmask */
+	int readable;	/* subset of capable if not op */
+	int writeable;	/* subset of capable if op */
+	int checked;	/* subset of (op? writeable: readable) */
+	int pending;	/* subset of checked */
+	int current;	/* index of currently processing mode */
+	int line_ct;	/* count of presented lines */
+	int select_ct;	/* count of selected lines */
+		/* Not really; 1 if any are selected otherwise 0 */
+	GtkWidget *window;
+	GtkWidget *treeview;
+	GtkWidget *checkboxes[MODE_CT];
+	GtkWidget *but_remove;
+	GtkWidget *but_crop;
+	GtkWidget *but_clear;
+	GtkWidget *but_refresh;
+} banlist_info;
+
+typedef struct mode_info_s {
+	char *name;		/* Checkbox name, e.g. "Bans" */
+	char *type;		/* Type for type column, e.g. "Ban" */
+	char letter;	/* /mode-command letter, e.g. 'b' for MODE_BAN */
+	int code;		/* rfc RPL_foo code, e.g. 367 for RPL_BANLIST */
+	int endcode;	/* rfc RPL_ENDOFfoo code, e.g. 368 for RPL_ENDOFBANLIST */
+	int bit;			/* Mask bit, e.g., 1<<MODE_BAN  */
+	void (*tester)(banlist_info *, int);	/* Function returns true to set bit into checkable */
+} mode_info;
+
+#endif /* HEXCHAT_BANLIST_H */
diff --git a/src/fe-gtk/chanlist.c b/src/fe-gtk/chanlist.c
index c2cc6fcb..47b9f1db 100644
--- a/src/fe-gtk/chanlist.c
+++ b/src/fe-gtk/chanlist.c
@@ -30,21 +30,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkalignment.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvseparator.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
@@ -58,10 +43,8 @@
 #include "maingui.h"
 #include "menu.h"
 
-
 #include "custom-list.h"
 
-
 enum
 {
 	COL_CHANNEL,
diff --git a/src/fe-gtk/chanlist.h b/src/fe-gtk/chanlist.h
index 19a8b25e..481beec3 100644
--- a/src/fe-gtk/chanlist.h
+++ b/src/fe-gtk/chanlist.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_CHANLIST_H
+#define HEXCHAT_CHANLIST_H
+
 void chanlist_opengui (server *serv, int do_refresh);
+
+#endif
diff --git a/src/fe-gtk/chanview-tabs.c b/src/fe-gtk/chanview-tabs.c
index 10203476..9db6b21a 100644
--- a/src/fe-gtk/chanview-tabs.c
+++ b/src/fe-gtk/chanview-tabs.c
@@ -1,3 +1,22 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 /* file included in chanview.c */
 
 typedef struct
diff --git a/src/fe-gtk/chanview-tree.c b/src/fe-gtk/chanview-tree.c
index 4a4f1db2..a7cd7235 100644
--- a/src/fe-gtk/chanview-tree.c
+++ b/src/fe-gtk/chanview-tree.c
@@ -1,3 +1,22 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 /* file included in chanview.c */
 
 typedef struct
@@ -12,7 +31,6 @@ typedef struct
 #include "maingui.h"
 
 #include <gdk/gdk.h>
-#include <gtk/gtktreeview.h>
 
 static void 	/* row-activated, when a row is double clicked */
 cv_tree_activated_cb (GtkTreeView *view, GtkTreePath *path,
@@ -75,6 +93,8 @@ cv_tree_init (chanview *cv)
 {
 	GtkWidget *view, *win;
 	GtkCellRenderer *renderer;
+	GtkTreeViewColumn *col;
+	int wid1, wid2;
 	static const GtkTargetEntry dnd_src_target[] =
 	{
 		{"HEXCHAT_CHANVIEW", GTK_TARGET_SAME_APP, 75 }
@@ -105,8 +125,17 @@ cv_tree_init (chanview *cv)
 	{
 		gtk_tree_view_set_enable_tree_lines (GTK_TREE_VIEW (view), TRUE);
 	}
+	
+	/* Indented channels with no server looks silly, but we still want expanders */
+	if (!prefs.hex_gui_tab_server)
+	{
+		gtk_widget_style_get (view, "expander-size", &wid1, "horizontal-separator", &wid2, NULL);
+		gtk_tree_view_set_level_indentation (GTK_TREE_VIEW (view), -wid1 - wid2);
+	}
+
 
 	gtk_container_add (GTK_CONTAINER (win), view);
+	col = gtk_tree_view_column_new();
 
 	/* icon column */
 	if (cv->use_icons)
@@ -114,9 +143,9 @@ cv_tree_init (chanview *cv)
 		renderer = gtk_cell_renderer_pixbuf_new ();
 		if (prefs.hex_gui_compact)
 			g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
-		gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
-																	-1, NULL, renderer,
-																	"pixbuf", COL_PIXBUF, NULL);
+
+		gtk_tree_view_column_pack_start(col, renderer, FALSE);
+		gtk_tree_view_column_set_attributes (col, renderer, "pixbuf", COL_PIXBUF, NULL);
 	}
 
 	/* main column */
@@ -124,9 +153,9 @@ cv_tree_init (chanview *cv)
 	if (prefs.hex_gui_compact)
 		g_object_set (G_OBJECT (renderer), "ypad", 0, NULL);
 	gtk_cell_renderer_text_set_fixed_height_from_font (GTK_CELL_RENDERER_TEXT (renderer), 1);
-	gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (view),
-																-1, NULL, renderer,
-									"text", COL_NAME, "attributes", COL_ATTR, NULL);
+	gtk_tree_view_column_pack_start(col, renderer, TRUE);
+	gtk_tree_view_column_set_attributes (col, renderer, "text", COL_NAME, "attributes", COL_ATTR, NULL);
+	gtk_tree_view_append_column(GTK_TREE_VIEW(view), col);									
 
 	g_signal_connect (G_OBJECT (gtk_tree_view_get_selection (GTK_TREE_VIEW (view))),
 							"changed", G_CALLBACK (cv_tree_sel_cb), cv);
diff --git a/src/fe-gtk/chanview.c b/src/fe-gtk/chanview.c
index f7e01695..500ed1e5 100644
--- a/src/fe-gtk/chanview.c
+++ b/src/fe-gtk/chanview.c
@@ -1,16 +1,31 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 /* abstract channel view: tabs or tree or anything you like */
 
 #include <stdlib.h>
 #include <string.h>
 
-#include <gtk/gtk.h>
-
-#include "chanview.h"
 #include "gtkutil.h"
-
+#include "chanview.h"
 
 /* treeStore columns */
-
 #define COL_NAME 0		/* (char *) */
 #define COL_CHAN 1		/* (chan *) */
 #define COL_ATTR 2		/* (PangoAttrList *) */
diff --git a/src/fe-gtk/chanview.h b/src/fe-gtk/chanview.h
index 75b5ef1f..a1495b1d 100644
--- a/src/fe-gtk/chanview.h
+++ b/src/fe-gtk/chanview.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_CHANVIEW_H
+#define HEXCHAT_CHANVIEW_H
+
 typedef struct _chanview chanview;
 typedef struct _chan chan;
 
@@ -29,3 +51,5 @@ chan * chan_get_parent (chan *ch);
 #define FOCUS_NEW_ALL 1
 #define FOCUS_NEW_ONLY_ASKED 2
 #define FOCUS_NEW_NONE 0
+
+#endif
diff --git a/src/fe-gtk/custom-list.c b/src/fe-gtk/custom-list.c
index 0c3c40b5..ed292294 100644
--- a/src/fe-gtk/custom-list.c
+++ b/src/fe-gtk/custom-list.c
@@ -1,3 +1,22 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
 #include <string.h>
 #include <stdlib.h>
 #include "custom-list.h"
diff --git a/src/fe-gtk/custom-list.h b/src/fe-gtk/custom-list.h
index d9e4f09e..64f0535f 100644
--- a/src/fe-gtk/custom-list.h
+++ b/src/fe-gtk/custom-list.h
@@ -1,8 +1,29 @@
-#ifndef _custom_list_h_included_
-#define _custom_list_h_included_
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_CUSTOM_LIST_H
+#define HEXCHAT_CUSTOM_LIST_H
 
 #include <gtk/gtk.h>
 
+GType custom_list_get_type (void);
+
 /* Some boilerplate GObject defines. 'klass' is used
  *   instead of 'class', because 'class' is a C++ keyword */
 
@@ -82,4 +103,4 @@ void custom_list_append (CustomList *, chanlistrow *);
 void custom_list_resort (CustomList *);
 void custom_list_clear (CustomList *);
 
-#endif /* _custom_list_h_included_ */
+#endif /* HEXCHAT_CUSTOM_LIST_H */
diff --git a/src/fe-gtk/dccgui.c b/src/fe-gtk/dccgui.c
index 6cfcd8b7..0fb2e7e5 100644
--- a/src/fe-gtk/dccgui.c
+++ b/src/fe-gtk/dccgui.c
@@ -28,22 +28,6 @@
 #include "../common/inet.h"
 #include "fe-gtk.h"
 
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkexpander.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkversion.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "../common/fe.h"
@@ -745,6 +729,7 @@ fe_dcc_open_recv_win (int passive)
 	dccfwin.window = mg_create_generic_tab ("Transfers", _(DISPLAY_NAME": Uploads and Downloads"),
 														 FALSE, TRUE, close_dcc_file_window, NULL,
 														 win_width, win_height, &vbox, 0);
+	gtkutil_destroy_on_esc (dccfwin.window);
 	gtk_container_set_border_width (GTK_CONTAINER (dccfwin.window), 3);
 	gtk_box_set_spacing (GTK_BOX (vbox), 3);
 
@@ -989,6 +974,7 @@ fe_dcc_open_chat_win (int passive)
 	dcccwin.window =
 			  mg_create_generic_tab ("DCCChat", _(DISPLAY_NAME": DCC Chat List"),
 						FALSE, TRUE, dcc_chat_close_cb, NULL, 550, 180, &vbox, 0);
+	gtkutil_destroy_on_esc (dcccwin.window);
 	gtk_container_set_border_width (GTK_CONTAINER (dcccwin.window), 3);
 	gtk_box_set_spacing (GTK_BOX (vbox), 3);
 
diff --git a/src/fe-gtk/editlist.c b/src/fe-gtk/editlist.c
index c1be5b23..4c4c4367 100644
--- a/src/fe-gtk/editlist.c
+++ b/src/fe-gtk/editlist.c
@@ -31,12 +31,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkstock.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvseparator.h>
-
 #include "../common/hexchat.h"
 #include "../common/cfgfiles.h"
 #include "../common/hexchatc.h"
diff --git a/src/fe-gtk/editlist.h b/src/fe-gtk/editlist.h
index f17cc2e0..5487684b 100644
--- a/src/fe-gtk/editlist.h
+++ b/src/fe-gtk/editlist.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_EDITLIST_H
+#define HEXCHAT_EDITLIST_H
+
 void editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass, char *file, char *help);
+
+#endif
diff --git a/src/fe-gtk/fe-gtk-xp.vcxproj b/src/fe-gtk/fe-gtk-xp.vcxproj
deleted file mode 100644
index 94ebd4a0..00000000
--- a/src/fe-gtk/fe-gtk-xp.vcxproj
+++ /dev/null
@@ -1,179 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>

-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

-  <ItemGroup Label="ProjectConfigurations">

-    <ProjectConfiguration Include="Release|Win32">

-      <Configuration>Release</Configuration>

-      <Platform>Win32</Platform>

-    </ProjectConfiguration>

-    <ProjectConfiguration Include="Release|x64">

-      <Configuration>Release</Configuration>

-      <Platform>x64</Platform>

-    </ProjectConfiguration>

-  </ItemGroup>

-  <PropertyGroup Label="Globals">

-    <ProjectGuid>{E4BDB4C8-2335-415A-ACEE-BA88B19BFE82}</ProjectGuid>

-    <Keyword>Win32Proj</Keyword>

-    <RootNamespace>fegtk</RootNamespace>

-    <ProjectName>fe-gtk</ProjectName>

-  </PropertyGroup>

-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">

-    <ConfigurationType>Application</ConfigurationType>

-    <UseDebugLibraries>false</UseDebugLibraries>

-    <WholeProgramOptimization>true</WholeProgramOptimization>

-    <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>WDK7</PlatformToolset>

-  </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">

-    <ConfigurationType>Application</ConfigurationType>

-    <UseDebugLibraries>false</UseDebugLibraries>

-    <WholeProgramOptimization>true</WholeProgramOptimization>

-    <CharacterSet>MultiByte</CharacterSet>

-    <PlatformToolset>WDK7</PlatformToolset>

-  </PropertyGroup>

-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />

-  <ImportGroup Label="ExtensionSettings">

-  </ImportGroup>

-  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

-    <Import Project="..\..\win32\hexchat-xp.props" />

-  </ImportGroup>

-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">

-    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />

-    <Import Project="..\..\win32\hexchat-xp.props" />

-  </ImportGroup>

-  <PropertyGroup Label="UserMacros" />

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

-    <LinkIncremental>false</LinkIncremental>

-    <TargetName>hexchat</TargetName>

-    <OutDir>$(HexChatBin)</OutDir>

-    <IntDir>$(HexChatObj)$(ProjectName)\</IntDir>

-  </PropertyGroup>

-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

-    <LinkIncremental>false</LinkIncremental>

-    <TargetName>hexchat</TargetName>

-    <OutDir>$(HexChatBin)</OutDir>

-    <IntDir>$(HexChatObj)$(ProjectName)\</IntDir>

-  </PropertyGroup>

-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">

-    <ClCompile>

-      <PrecompiledHeader>

-      </PrecompiledHeader>

-      <Optimization>MaxSpeed</Optimization>

-      <FunctionLevelLinking>true</FunctionLevelLinking>

-      <IntrinsicFunctions>true</IntrinsicFunctions>

-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

-      <MultiProcessorCompilation>true</MultiProcessorCompilation>

-      <DisableSpecificWarnings>4244</DisableSpecificWarnings>

-    </ClCompile>

-    <Link>

-      <SubSystem>Windows</SubSystem>

-      <GenerateDebugInformation>true</GenerateDebugInformation>

-      <EnableCOMDATFolding>true</EnableCOMDATFolding>

-      <OptimizeReferences>true</OptimizeReferences>

-      <AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

-      <AdditionalDependencies>$(DepLibs);common.lib;%(AdditionalDependencies)</AdditionalDependencies>

-      <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>

-    </Link>

-  </ItemDefinitionGroup>

-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">

-    <ClCompile>

-      <PrecompiledHeader>

-      </PrecompiledHeader>

-      <Optimization>MaxSpeed</Optimization>

-      <FunctionLevelLinking>true</FunctionLevelLinking>

-      <IntrinsicFunctions>true</IntrinsicFunctions>

-      <PreprocessorDefinitions>WIN32;_WIN64;_AMD64_;NDEBUG;_WINDOWS;$(OwnFlags);%(PreprocessorDefinitions)</PreprocessorDefinitions>

-      <AdditionalIncludeDirectories>$(DepsRoot)\include;$(Glib);$(Gtk);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>

-      <MultiProcessorCompilation>true</MultiProcessorCompilation>

-      <DisableSpecificWarnings>4244;4267</DisableSpecificWarnings>

-    </ClCompile>

-    <Link>

-      <SubSystem>Windows</SubSystem>

-      <GenerateDebugInformation>true</GenerateDebugInformation>

-      <EnableCOMDATFolding>true</EnableCOMDATFolding>

-      <OptimizeReferences>true</OptimizeReferences>

-      <AdditionalLibraryDirectories>$(DepsRoot)\lib;$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>

-      <AdditionalDependencies>$(DepLibs);common.lib;%(AdditionalDependencies)</AdditionalDependencies>

-      <EntryPointSymbol>mainCRTStartup</EntryPointSymbol>

-    </Link>

-  </ItemDefinitionGroup>

-  <ItemGroup>

-    <ClInclude Include="about.h" />

-    <ClInclude Include="ascii.h" />

-    <ClInclude Include="banlist.h" />

-    <ClInclude Include="chanlist.h" />

-    <ClInclude Include="chanview.h" />

-    <ClInclude Include="custom-list.h" />

-    <ClInclude Include="editlist.h" />

-    <ClInclude Include="fe-gtk.h" />

-    <ClInclude Include="fkeys.h" />

-    <ClInclude Include="gtkutil.h" />

-    <ClInclude Include="joind.h" />

-    <ClInclude Include="maingui.h" />

-    <ClInclude Include="menu.h" />

-    <ClInclude Include="mmx_cmod.h" />

-    <ClInclude Include="notifygui.h" />

-    <ClInclude Include="palette.h" />

-    <ClInclude Include="pixmaps.h" />

-    <ClInclude Include="plugin-tray.h" />

-    <ClInclude Include="plugingui.h" />

-    <ClInclude Include="rawlog.h" />

-    <ClInclude Include="search.h" />

-    <ClInclude Include="servlistgui.h" />

-    <ClInclude Include="setup.h" />

-    <ClInclude Include="sexy-iso-codes.h" />

-    <ClInclude Include="sexy-marshal.h" />

-    <ClInclude Include="sexy-spell-entry.h" />

-    <ClInclude Include="textgui.h" />

-    <ClInclude Include="urlgrab.h" />

-    <ClInclude Include="userlistgui.h" />

-    <ClInclude Include="xtext.h" />

-  </ItemGroup>

-  <ItemGroup>

-    <ClCompile Include="about.c" />

-    <ClCompile Include="ascii.c" />

-    <ClCompile Include="banlist.c" />

-    <ClCompile Include="chanlist.c" />

-    <ClCompile Include="chanview.c" />

-    <ClCompile Include="custom-list.c" />

-    <ClCompile Include="dccgui.c" />

-    <ClCompile Include="editlist.c" />

-    <ClCompile Include="fe-gtk.c" />

-    <ClCompile Include="fkeys.c" />

-    <ClCompile Include="gtkutil.c" />

-    <ClCompile Include="ignoregui.c" />

-    <ClCompile Include="joind.c" />

-    <ClCompile Include="maingui.c" />

-    <ClCompile Include="menu.c" />

-    <ClCompile Include="notifygui.c" />

-    <ClCompile Include="palette.c" />

-    <ClCompile Include="pixmaps.c" />

-    <ClCompile Include="plugin-tray.c" />

-    <ClCompile Include="plugingui.c" />

-    <ClCompile Include="rawlog.c" />

-    <ClCompile Include="search.c" />

-    <ClCompile Include="servlistgui.c" />

-    <ClCompile Include="setup.c" />

-    <ClCompile Include="sexy-iso-codes.c" />

-    <ClCompile Include="sexy-marshal.c" />

-    <ClCompile Include="sexy-spell-entry.c" />

-    <ClCompile Include="textgui.c" />

-    <ClCompile Include="urlgrab.c" />

-    <ClCompile Include="userlistgui.c" />

-    <ClCompile Include="xtext.c" />

-  </ItemGroup>

-  <ItemGroup>

-    <Manifest Include="hexchat.exe.manifest" />

-  </ItemGroup>

-  <ItemGroup>

-    <ResourceCompile Include="hexchat.rc" />

-  </ItemGroup>

-  <ItemGroup>

-    <None Include="..\..\share\icons\hexchat.ico" />

-  </ItemGroup>

-  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

-  <ImportGroup Label="ExtensionTargets">

-  </ImportGroup>

-</Project>
\ No newline at end of file
diff --git a/src/fe-gtk/fe-gtk-xp.vcxproj.filters b/src/fe-gtk/fe-gtk-xp.vcxproj.filters
deleted file mode 100644
index a319babd..00000000
--- a/src/fe-gtk/fe-gtk-xp.vcxproj.filters
+++ /dev/null
@@ -1,219 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>

-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

-  <ItemGroup>

-    <Filter Include="Source Files">

-      <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>

-      <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>

-    </Filter>

-    <Filter Include="Header Files">

-      <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>

-      <Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>

-    </Filter>

-    <Filter Include="Resource Files">

-      <UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>

-      <Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>

-    </Filter>

-  </ItemGroup>

-  <ItemGroup>

-    <ClInclude Include="about.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="ascii.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="banlist.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="chanlist.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="chanview.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="custom-list.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="editlist.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="fe-gtk.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="fkeys.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="gtkutil.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="joind.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="maingui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="menu.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="mmx_cmod.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="notifygui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="palette.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="pixmaps.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="plugingui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="plugin-tray.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="rawlog.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="search.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="sexy-iso-codes.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="sexy-marshal.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="sexy-spell-entry.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="textgui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="urlgrab.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="userlistgui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="xtext.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="servlistgui.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-    <ClInclude Include="setup.h">

-      <Filter>Header Files</Filter>

-    </ClInclude>

-  </ItemGroup>

-  <ItemGroup>

-    <ClCompile Include="about.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="ascii.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="banlist.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="chanlist.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="chanview.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="custom-list.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="dccgui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="editlist.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="fe-gtk.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="fkeys.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="gtkutil.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="ignoregui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="joind.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="maingui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="menu.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="notifygui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="palette.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="pixmaps.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="plugingui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="plugin-tray.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="rawlog.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="search.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="servlistgui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="setup.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="sexy-iso-codes.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="sexy-marshal.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="sexy-spell-entry.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="textgui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="urlgrab.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="userlistgui.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-    <ClCompile Include="xtext.c">

-      <Filter>Source Files</Filter>

-    </ClCompile>

-  </ItemGroup>

-  <ItemGroup>

-    <Manifest Include="hexchat.exe.manifest">

-      <Filter>Resource Files</Filter>

-    </Manifest>

-  </ItemGroup>

-  <ItemGroup>

-    <ResourceCompile Include="hexchat.rc">

-      <Filter>Resource Files</Filter>

-    </ResourceCompile>

-  </ItemGroup>

-  <ItemGroup>

-    <None Include="..\..\share\icons\hexchat.ico">

-      <Filter>Resource Files</Filter>

-    </None>

-  </ItemGroup>

-</Project>
\ No newline at end of file
diff --git a/src/fe-gtk/fe-gtk.c b/src/fe-gtk/fe-gtk.c
index a29a6fda..896ab143 100644
--- a/src/fe-gtk/fe-gtk.c
+++ b/src/fe-gtk/fe-gtk.c
@@ -22,17 +22,9 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkmain.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkversion.h>
-
 #ifdef WIN32
 #include <gdk/gdkwin32.h>
+#include <windows.h>
 #else
 #include <unistd.h>
 #endif
@@ -62,15 +54,6 @@
 
 #ifdef USE_XLIB
 #include <gdk/gdkx.h>
-#include <gtk/gtkinvisible.h>
-#endif
-
-#ifdef USE_GTKSPELL
-#include <gtk/gtktextview.h>
-#endif
-
-#ifdef WIN32
-#include <windows.h>
 #endif
 
 GdkPixmap *channelwin_pix;
@@ -134,7 +117,7 @@ static const GOptionEntry gopt_entries[] =
  {"no-plugins",	'n', 0, G_OPTION_ARG_NONE,	&arg_skip_plugins, N_("Don't auto load any plugins"), NULL},
  {"plugindir",	'p', 0, G_OPTION_ARG_NONE,	&arg_show_autoload, N_("Show plugin/script auto-load directory"), NULL},
  {"configdir",	'u', 0, G_OPTION_ARG_NONE,	&arg_show_config, N_("Show user config directory"), NULL},
- {"url",	 0,  0, G_OPTION_ARG_STRING,	&arg_url, N_("Open an irc://server:port/channel URL"), "URL"},
+ {"url",	 0,  0, G_OPTION_ARG_STRING,	&arg_url, N_("Open an irc://server:port/channel?key URL"), "URL"},
 #ifndef WIN32	/* uses DBUS */
  {"command",	'c', 0, G_OPTION_ARG_STRING,	&arg_command, N_("Execute command:"), "COMMAND"},
  {"existing",	'e', 0, G_OPTION_ARG_NONE,	&arg_existing, N_("Open URL or execute command in an existing HexChat"), NULL},
@@ -149,7 +132,7 @@ create_msg_dialog (gchar *title, gchar *message)
 {
 	GtkWidget *dialog;
 
-	dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, message);
+	dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, "%s", message);
 	gtk_window_set_title (GTK_WINDOW (dialog), title);
 
 /* On Win32 we automatically have the icon. If we try to load it explicitly, it will look ugly for some reason. */
@@ -604,14 +587,6 @@ fe_is_chanwindow (struct server *serv)
 	return 1;
 }
 
-int
-fe_is_banwindow (struct session *sess)
-{
-   if (!sess->res->banlist_window)
-     return 0;
-   return 1;
-}
-
 void
 fe_notify_update (char *name)
 {
diff --git a/src/fe-gtk/fe-gtk.h b/src/fe-gtk/fe-gtk.h
index 313afc4b..7b4132da 100644
--- a/src/fe-gtk/fe-gtk.h
+++ b/src/fe-gtk/fe-gtk.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_FE_GTK_H
+#define HEXCHAT_FE_GTK_H
+
 #ifdef WIN32
 #include "../../config-win32.h"
 #else
@@ -26,9 +48,8 @@
 #  define _(x) (x)
 #endif
 
-#include <gtk/gtkwidget.h>
-#include <gtk/gtkcontainer.h>
-#include <gtk/gtksignal.h>
+#include <gtk/gtk.h>
+#include "banlist.h"
 
 #undef gtk_signal_connect
 #define gtk_signal_connect g_signal_connect
@@ -97,10 +118,7 @@ struct server_gui
 
 typedef struct restore_gui
 {
-	/* banlist stuff */
-	GtkWidget *banlist_window;
-	GtkWidget *banlist_treeview;
-	GtkWidget *banlist_butRefresh;
+	banlist_info *banlist;
 
 	void *tab;			/* (chan *) */
 
@@ -192,3 +210,5 @@ void SPELL_ENTRY_INSERT (GtkWidget *entry, const char *text, int len, int *pos);
 #define SPELL_ENTRY_SET_POS(e,p) gtk_editable_set_position(GTK_EDITABLE(e),p);
 #define SPELL_ENTRY_INSERT(e,t,l,p) gtk_editable_insert_text(GTK_EDITABLE(e),t,l,p)
 #endif
+
+#endif
diff --git a/src/fe-gtk/fkeys.c b/src/fe-gtk/fkeys.c
index 3a937e1a..f35ae466 100644
--- a/src/fe-gtk/fkeys.c
+++ b/src/fe-gtk/fkeys.c
@@ -32,20 +32,6 @@
 
 #include "fe-gtk.h"
 
-#include <glib.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkeditable.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkoptionmenu.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkvscrollbar.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "../common/cfgfiles.h"
@@ -65,10 +51,6 @@
 #include "textgui.h"
 #include "fkeys.h"
 
-#ifdef USE_GTKSPELL
-#include <gtk/gtktextview.h>
-#endif
-
 static void replace_handle (GtkWidget * wid);
 void key_action_tab_clean (void);
 
diff --git a/src/fe-gtk/fkeys.h b/src/fe-gtk/fkeys.h
index 93f2cea7..621c872c 100644
--- a/src/fe-gtk/fkeys.h
+++ b/src/fe-gtk/fkeys.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_FKEYS_H
+#define HEXCHAT_FKEYS_H
+
 /* These are cp'ed from history.c --AGL */
 #define STATE_SHIFT		GDK_SHIFT_MASK
 #define STATE_ALT		GDK_MOD1_MASK
@@ -12,3 +34,5 @@ void key_dialog_show (void);
 int key_handle_key_press (GtkWidget * wid, GdkEventKey * evt, session *sess);
 int key_action_insert (GtkWidget * wid, GdkEventKey * evt, char *d1, char *d2,
 						 session *sess);
+
+#endif
diff --git a/src/fe-gtk/gtkutil.c b/src/fe-gtk/gtkutil.c
index d032cf48..41948e44 100644
--- a/src/fe-gtk/gtkutil.c
+++ b/src/fe-gtk/gtkutil.c
@@ -26,25 +26,7 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtktooltips.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkclipboard.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcellrenderertoggle.h>
-#include <gtk/gtkversion.h>
-#include <gtk/gtkfilechooserdialog.h>
+#include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
 #include "../common/fe.h"
@@ -338,6 +320,20 @@ gtkutil_file_req (const char *title, void *callback, void *userdata, char *filte
 	gtk_widget_show (dialog);
 }
 
+static gboolean
+gtkutil_esc_destroy (GtkWidget * win, GdkEventKey * key, gpointer userdata)
+{
+	if (key->keyval == GDK_Escape)
+		gtk_widget_destroy (win);
+	return FALSE;
+}
+
+void
+gtkutil_destroy_on_esc (GtkWidget *win)
+{
+	g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (gtkutil_esc_destroy), win);
+}
+
 void
 gtkutil_destroy (GtkWidget * igad, GtkWidget * dgad)
 {
diff --git a/src/fe-gtk/gtkutil.h b/src/fe-gtk/gtkutil.h
index 65b5c079..e3f59a29 100644
--- a/src/fe-gtk/gtkutil.h
+++ b/src/fe-gtk/gtkutil.h
@@ -1,5 +1,26 @@
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreemodel.h>
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_GTKUTIL_H
+#define HEXCHAT_GTKUTIL_H
+
+#include <gtk/gtk.h>
 
 typedef void (*filereqcallback) (void *, char *file);
 
@@ -12,6 +33,7 @@ typedef void (*filereqcallback) (void *, char *file);
 
 void gtkutil_file_req (const char *title, void *callback, void *userdata, char *filter, char *extensions, int flags);
 void gtkutil_destroy (GtkWidget * igad, GtkWidget * dgad);
+void gtkutil_destroy_on_esc (GtkWidget *win);
 GtkWidget *gtkutil_button (GtkWidget *box, char *stock, char *tip, void *callback,
 				 void *userdata, char *labeltext);
 void gtkutil_label_new (char *text, GtkWidget * box);
@@ -37,3 +59,4 @@ gboolean gtkutil_treemodel_string_to_iter (GtkTreeModel *model, gchar *pathstr,
 gboolean gtkutil_treeview_get_selected_iter (GtkTreeView *view, GtkTreeIter *iter_ret);
 gboolean gtkutil_treeview_get_selected (GtkTreeView *view, GtkTreeIter *iter_ret, ...);
 
+#endif
diff --git a/src/fe-gtk/ignoregui.c b/src/fe-gtk/ignoregui.c
index dca4384b..ae2dbd94 100644
--- a/src/fe-gtk/ignoregui.c
+++ b/src/fe-gtk/ignoregui.c
@@ -24,21 +24,6 @@
 #include <fcntl.h>
 #include "fe-gtk.h"
 
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkversion.h>
-
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcellrenderertoggle.h>
-
 #include "../common/hexchat.h"
 #include "../common/ignore.h"
 #include "../common/cfgfiles.h"
@@ -273,13 +258,15 @@ ignore_store_new (int cancel, char *mask, gpointer data)
 }
 
 static void
-ignore_clear_entry_clicked (GtkWidget * wid, gpointer unused)
+ignore_clear_cb (GtkDialog *dialog, gint response)
 {
 	GtkListStore *store = GTK_LIST_STORE (get_store ());
 	GtkTreeIter iter;
 	char *mask;
 
-	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter))
+	gtk_widget_destroy (GTK_WIDGET (dialog));
+
+	if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &iter) && response == GTK_RESPONSE_OK)
 	{
 		/* remove from ignore_list */
 		do
@@ -297,6 +284,20 @@ ignore_clear_entry_clicked (GtkWidget * wid, gpointer unused)
 }
 
 static void
+ignore_clear_entry_clicked (GtkWidget * wid)
+{
+	GtkWidget *dialog;
+
+	dialog = gtk_message_dialog_new (NULL, 0,
+								GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
+					_("Are you sure you want to remove all ignores?"));
+	g_signal_connect (G_OBJECT (dialog), "response",
+							G_CALLBACK (ignore_clear_cb), NULL);
+	gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
+	gtk_widget_show (dialog);
+}
+
+static void
 ignore_new_entry_clicked (GtkWidget * wid, struct session *sess)
 {
 	fe_get_str (_("Enter mask to ignore:"), "nick!userid@host.com",
@@ -349,6 +350,7 @@ ignore_gui_open ()
 			  mg_create_generic_tab ("IgnoreList", _(DISPLAY_NAME": Ignore list"),
 											FALSE, TRUE, close_ignore_gui_callback,
 											NULL, 600, 256, &vbox, 0);
+	gtkutil_destroy_on_esc (ignorewin);
 
 	view = ignore_treeview_new (vbox);
 	g_object_set_data (G_OBJECT (ignorewin), "view", view);
diff --git a/src/fe-gtk/joind.c b/src/fe-gtk/joind.c
index 41f3f405..b58d662a 100644
--- a/src/fe-gtk/joind.c
+++ b/src/fe-gtk/joind.c
@@ -1,7 +1,22 @@
-/* Copyright (c) 2005 Peter Zelezny
-   All Rights Reserved.
-
-   joind.c - The Join Dialog.
+/* X-Chat
+ * Copyright (C) 2005 Peter Zelezny.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+/* joind.c - The Join Dialog.
 
    Popups up when you connect without any autojoin channels and helps you
    to find or join a channel.
@@ -16,18 +31,6 @@
 #include <unistd.h>
 #endif
 
-#include <gtk/gtk.h>
-#include <gtk/gtkbbox.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkwindow.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "../common/server.h"
diff --git a/src/fe-gtk/joind.h b/src/fe-gtk/joind.h
index aa0fd0ad..a7f466b9 100644
--- a/src/fe-gtk/joind.h
+++ b/src/fe-gtk/joind.h
@@ -1,2 +1,26 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_JOIND_H
+#define HEXCHAT_JOIND_H
+
 void joind_open (server *serv);
 void joind_close (server *serv);
+
+#endif
diff --git a/src/fe-gtk/maingui.c b/src/fe-gtk/maingui.c
index 41344c8f..816a93f7 100644
--- a/src/fe-gtk/maingui.c
+++ b/src/fe-gtk/maingui.c
@@ -21,29 +21,6 @@
 #include <stdio.h>
 #include <ctype.h>
 
-#include <gtk/gtkarrow.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhpaned.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkprogressbar.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkbbox.h>
-#include <gtk/gtkvscrollbar.h>
-
 #include "../common/hexchat.h"
 #include "../common/fe.h"
 #include "../common/server.h"
@@ -71,7 +48,6 @@
 #include "xtext.h"
 
 #ifdef USE_GTKSPELL
-#include <gtk/gtktextview.h>
 #include <gtkspell/gtkspell.h>
 #endif
 
@@ -501,7 +477,7 @@ mg_windowstate_cb (GtkWindow *wid, GdkEventWindowState *event, gpointer userdata
 {
 	if ((event->changed_mask & GDK_WINDOW_STATE_ICONIFIED) &&
 		 (event->new_window_state & GDK_WINDOW_STATE_ICONIFIED) &&
-		 prefs.hex_gui_tray_minimize && !hextray_mode ())
+		 prefs.hex_gui_tray_minimize && !unity_mode ())
 	{
 		tray_toggle_visibility (TRUE);
 		gtk_window_deiconify (wid);
@@ -1295,7 +1271,7 @@ mg_open_quit_dialog (gboolean minimize_button)
 	gtk_button_box_set_layout (GTK_BUTTON_BOX (dialog_action_area1),
 										GTK_BUTTONBOX_END);
 
-	if (minimize_button && !hextray_mode ())
+	if (minimize_button && !unity_mode ())
 	{
 		button = gtk_button_new_with_mnemonic (_("_Minimize to Tray"));
 		gtk_widget_show (button);
@@ -1594,10 +1570,7 @@ mg_create_alertmenu (session *sess, GtkWidget *menu)
 
 	mg_perchan_menu_item (_("Beep on _Message"), submenu, &sess->alert_beep, prefs.hex_input_beep_chans);
 
-	if (!hextray_mode ())		/*disable this context menu item when HexTray is loaded */
-	{
-		mg_perchan_menu_item (_("Blink Tray _Icon"), submenu, &sess->alert_tray, prefs.hex_input_tray_chans);
-	}
+	mg_perchan_menu_item (_("Blink Tray _Icon"), submenu, &sess->alert_tray, prefs.hex_input_tray_chans);
 
 	mg_perchan_menu_item (_("Blink Task _Bar"), submenu, &sess->alert_taskbar, prefs.hex_input_flash_chans);
 }
@@ -3087,7 +3060,7 @@ mg_tabwindow_de_cb (GtkWidget *widget, GdkEvent *event, gpointer user_data)
 	GSList *list;
 	session *sess;
 
-	if (prefs.hex_gui_tray_close && !hextray_mode () && tray_toggle_visibility (FALSE))
+	if (prefs.hex_gui_tray_close && !unity_mode () && tray_toggle_visibility (FALSE))
 		return TRUE;
 
 	/* check for remaining toplevel windows */
@@ -3530,8 +3503,8 @@ fe_server_callback (server *serv)
 void
 fe_session_callback (session *sess)
 {
-	if (sess->res->banlist_window)
-		mg_close_gen (NULL, sess->res->banlist_window);
+	if (sess->res->banlist && sess->res->banlist->window)
+		mg_close_gen (NULL, sess->res->banlist->window);
 
 	if (sess->res->input_text)
 		free (sess->res->input_text);
diff --git a/src/fe-gtk/maingui.h b/src/fe-gtk/maingui.h
index bc9aaefd..a35f3684 100644
--- a/src/fe-gtk/maingui.h
+++ b/src/fe-gtk/maingui.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_MAINGUI_H
+#define HEXCHAT_MAINGUI_H
+
 extern GtkStyle *input_style;
 extern GtkWidget *parent_window;
 
@@ -31,3 +53,5 @@ gboolean mg_drag_begin_cb (GtkWidget *widget, GdkDragContext *context, gpointer
 void mg_drag_end_cb (GtkWidget *widget, GdkDragContext *context, gpointer userdata);
 gboolean mg_drag_drop_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer user_data);
 gboolean mg_drag_motion_cb (GtkWidget *widget, GdkDragContext *context, int x, int y, guint time, gpointer user_data); 
+
+#endif
diff --git a/src/fe-gtk/menu.c b/src/fe-gtk/menu.c
index f5f6b456..74b1783f 100644
--- a/src/fe-gtk/menu.c
+++ b/src/fe-gtk/menu.c
@@ -30,18 +30,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtkimagemenuitem.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkmenubar.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkversion.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
@@ -1609,7 +1597,7 @@ static struct mymenu mymenu[] = {
 	{N_("_New"), 0, GTK_STOCK_NEW, M_MENUSUB, 0, 0, 1},
 		{N_("Server Tab..."), menu_newserver_tab, 0, M_MENUITEM, 0, 0, 1, GDK_t},
 		{N_("Channel Tab..."), menu_newchannel_tab, 0, M_MENUITEM, 0, 0, 1},
-		{N_("Server Window..."), menu_newserver_window, 0, M_MENUITEM, 0, 0, 1},
+		{N_("Server Window..."), menu_newserver_window, 0, M_MENUITEM, 0, 0, 1, GDK_n},
 		{N_("Channel Window..."), menu_newchannel_window, 0, M_MENUITEM, 0, 0, 1},
 		{0, 0, 0, M_END, 0, 0, 0},
 	{0, 0, 0, M_SEP, 0, 0, 0},
@@ -1685,7 +1673,7 @@ static struct mymenu mymenu[] = {
 	{0, 0, 0, M_SEP, 0, 0, 0},
 	{N_("Reset Marker Line"), menu_resetmarker, 0, M_MENUITEM, 0, 0, 1, GDK_m},
 	{N_("_Copy Selection"), menu_copy_selection, 0, M_MENUITEM, 0, 0, 1, GDK_C},
-	{N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1, GDK_l},
+	{N_("C_lear Text"), menu_flushbuffer, GTK_STOCK_CLEAR, M_MENUSTOCK, 0, 0, 1},
 	{N_("Save Text..."), menu_savebuffer, GTK_STOCK_SAVE, M_MENUSTOCK, 0, 0, 1},
 #define SEARCH_OFFSET 68
 	{N_("Search"), 0, GTK_STOCK_JUSTIFY_LEFT, M_MENUSUB, 0, 0, 1},
diff --git a/src/fe-gtk/menu.h b/src/fe-gtk/menu.h
index 7fef79cd..dfc6fd07 100644
--- a/src/fe-gtk/menu.h
+++ b/src/fe-gtk/menu.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_MENU_H
+#define HEXCHAT_MENU_H
+
 GtkWidget *menu_create_main (void *accel_group, int bar, int away, int toplevel, GtkWidget **menu_widgets);
 void menu_urlmenu (GdkEventButton * event, char *url);
 void menu_chanmenu (session *sess, GdkEventButton * event, char *chan);
@@ -39,3 +61,5 @@ void menu_change_layout (void);
 #if (MENU_ID_NUM < MENU_ID_USERMENU)
 #error MENU_ID_NUM is set wrong
 #endif
+
+#endif
diff --git a/src/fe-gtk/mmx_cmod.h b/src/fe-gtk/mmx_cmod.h
index 52d07102..5b84a4b8 100644
--- a/src/fe-gtk/mmx_cmod.h
+++ b/src/fe-gtk/mmx_cmod.h
@@ -1,4 +1,28 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_MMX_CMOD_H
+#define HEXCHAT_MMX_CMOD_H
+
 void shade_ximage_15_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
 void shade_ximage_16_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
 void shade_ximage_32_mmx(void *data, int bpl, int w, int h, int rm, int gm, int bm);
 int have_mmx (void);
+
+#endif
diff --git a/src/fe-gtk/notifygui.c b/src/fe-gtk/notifygui.c
index 0559734c..3c3b6a6e 100644
--- a/src/fe-gtk/notifygui.c
+++ b/src/fe-gtk/notifygui.c
@@ -24,20 +24,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkscrolledwindow.h>
-
-#include <gtk/gtklabel.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-
 #include "../common/hexchat.h"
 #include "../common/notify.h"
 #include "../common/cfgfiles.h"
@@ -413,6 +399,7 @@ notify_opengui (void)
 	notify_window =
 		mg_create_generic_tab ("Notify", _(DISPLAY_NAME": Friends List"), FALSE, TRUE,
 		                       notify_closegui, NULL, 400, 250, &vbox, 0);
+	gtkutil_destroy_on_esc (notify_window);
 
 	view = notify_treeview_new (vbox);
 	g_object_set_data (G_OBJECT (notify_window), "view", view);
diff --git a/src/fe-gtk/notifygui.h b/src/fe-gtk/notifygui.h
index 360834dc..6517995c 100644
--- a/src/fe-gtk/notifygui.h
+++ b/src/fe-gtk/notifygui.h
@@ -1,2 +1,26 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_NOTIFYGUI_H
+#define HEXCHAT_NOTIFYGUI_H
+
 void notify_gui_update (void);
 void notify_opengui (void);
+
+#endif
diff --git a/src/fe-gtk/palette.h b/src/fe-gtk/palette.h
index 627c6963..6f53c1a7 100644
--- a/src/fe-gtk/palette.h
+++ b/src/fe-gtk/palette.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_PALETTE_H
+#define HEXCHAT_PALETTE_H
+
 extern GdkColor colors[];
 
 #define COL_MARK_FG 32
@@ -14,3 +36,5 @@ extern GdkColor colors[];
 void palette_alloc (GtkWidget * widget);
 void palette_load (void);
 void palette_save (void);
+
+#endif
diff --git a/src/fe-gtk/pixmaps.c b/src/fe-gtk/pixmaps.c
index 419ef4c1..bdd74e1e 100644
--- a/src/fe-gtk/pixmaps.c
+++ b/src/fe-gtk/pixmaps.c
@@ -26,8 +26,6 @@
 #include "../common/fe.h"
 
 #include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gdk-pixdata.h>
-#include <gtk/gtkstock.h>
 
 #include "../pixmaps/inline_pngs.h"
 
diff --git a/src/fe-gtk/pixmaps.h b/src/fe-gtk/pixmaps.h
index 64607582..7241fa84 100644
--- a/src/fe-gtk/pixmaps.h
+++ b/src/fe-gtk/pixmaps.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_PIXMAPS_H
+#define HEXCHAT_PIXMAPS_H
+
 extern GdkPixbuf *pix_ulist_voice;
 extern GdkPixbuf *pix_ulist_halfop;
 extern GdkPixbuf *pix_ulist_op;
@@ -19,3 +41,5 @@ extern GdkPixbuf *pix_hexchat;
 
 extern GdkPixmap *pixmap_load_from_file (char *file);
 extern void pixmaps_init (void);
+
+#endif
diff --git a/src/fe-gtk/plugin-tray.c b/src/fe-gtk/plugin-tray.c
index 694e4c35..cf9d036b 100644
--- a/src/fe-gtk/plugin-tray.c
+++ b/src/fe-gtk/plugin-tray.c
@@ -1,4 +1,20 @@
-/* Copyright (C) 2006-2007 Peter Zelezny. */
+/* X-Chat
+ * Copyright (C) 2006-2007 Peter Zelezny.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
 
 #include <string.h>
 #include "../common/hexchat-plugin.h"
@@ -13,7 +29,6 @@
 #include "pixmaps.h"
 #include "maingui.h"
 #include "menu.h"
-#include <gtk/gtk.h>
 
 #ifndef WIN32
 #include <unistd.h>
@@ -837,7 +852,7 @@ tray_apply_setup (void)
 	}
 	else
 	{
-		if (prefs.hex_gui_tray && !hextray_mode ())
+		if (prefs.hex_gui_tray && !unity_mode ())
 			tray_init ();
 	}
 }
@@ -869,7 +884,7 @@ tray_plugin_init (hexchat_plugin *plugin_handle, char **plugin_name,
 
 	hexchat_hook_print (ph, "Focus Window", -1, tray_focus_cb, NULL);
 
-	if (prefs.hex_gui_tray && !hextray_mode ())
+	if (prefs.hex_gui_tray && !unity_mode ())
 		tray_init ();
 
 	return 1;       /* return 1 for success */
diff --git a/src/fe-gtk/plugin-tray.h b/src/fe-gtk/plugin-tray.h
index d54be5a4..cb77019a 100644
--- a/src/fe-gtk/plugin-tray.h
+++ b/src/fe-gtk/plugin-tray.h
@@ -1,4 +1,28 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_PLUGIN_TRAY_H
+#define HEXCHAT_PLUGIN_TRAY_H
+
 int tray_plugin_init (void *, char **, char **, char **, char *);
 int tray_plugin_deinit (void *);
 gboolean tray_toggle_visibility (gboolean force_hide);
 void tray_apply_setup (void);
+
+#endif
diff --git a/src/fe-gtk/plugingui.c b/src/fe-gtk/plugingui.c
index 293535cc..48152d78 100644
--- a/src/fe-gtk/plugingui.c
+++ b/src/fe-gtk/plugingui.c
@@ -22,17 +22,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkscrolledwindow.h>
-
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-
 #include "../common/hexchat.h"
 #define PLUGIN_C
 typedef struct session hexchat_context;
@@ -219,6 +208,7 @@ plugingui_open (void)
 	plugin_window = mg_create_generic_tab ("Addons", _(DISPLAY_NAME": Plugins and Scripts"),
 														 FALSE, TRUE, plugingui_close, NULL,
 														 500, 250, &vbox, 0);
+	gtkutil_destroy_on_esc (plugin_window);
 
 	view = plugingui_treeview_new (vbox);
 	g_object_set_data (G_OBJECT (plugin_window), "view", view);
diff --git a/src/fe-gtk/plugingui.h b/src/fe-gtk/plugingui.h
index 945d9a01..ae079a72 100644
--- a/src/fe-gtk/plugingui.h
+++ b/src/fe-gtk/plugingui.h
@@ -1,2 +1,26 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_PLUGINGUI_H
+#define HEXCHAT_PLUGINGUI_H
+
 void plugingui_open (void);
 void plugingui_load (void);
+
+#endif
diff --git a/src/fe-gtk/rawlog.c b/src/fe-gtk/rawlog.c
index 6764034f..d0564406 100644
--- a/src/fe-gtk/rawlog.c
+++ b/src/fe-gtk/rawlog.c
@@ -29,11 +29,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvscrollbar.h>
-#include <gtk/gtkstock.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
@@ -86,7 +81,7 @@ rawlog_savebutton (GtkWidget * wid, server *serv)
 	return FALSE;
 }
 
-static void
+static gboolean
 rawlog_key_cb (GtkWidget * wid, GdkEventKey * key, gpointer userdata)
 {
 	/* Copy rawlog selection to clipboard when Ctrl+Shift+C is pressed,
@@ -99,13 +94,7 @@ rawlog_key_cb (GtkWidget * wid, GdkEventKey * key, gpointer userdata)
 	{
 		gtk_xtext_copy_selection (userdata);
 	}
-	/* close_rawlog is given to mg_create_generic_tab as
-	 * close_callback, it should take care of the rest.
-	 */
-	else if (key->keyval == GDK_Escape)
-	{
-		gtk_widget_destroy (wid);
-	}
+	return FALSE;
 }
 
 void
@@ -124,6 +113,7 @@ open_rawlog (struct server *serv)
 	serv->gui->rawlog_window =
 		mg_create_generic_tab ("RawLog", tbuf, FALSE, TRUE, close_rawlog, serv,
 							 640, 320, &vbox, serv);
+	gtkutil_destroy_on_esc (serv->gui->rawlog_window);
 
 	hbox = gtk_hbox_new (FALSE, 2);
 	gtk_container_add (GTK_CONTAINER (vbox), hbox);
diff --git a/src/fe-gtk/rawlog.h b/src/fe-gtk/rawlog.h
index db41e2a7..53c57d42 100644
--- a/src/fe-gtk/rawlog.h
+++ b/src/fe-gtk/rawlog.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_RAWLOG_H
+#define HEXCHAT_RAWLOG_H
+
 void open_rawlog (server *serv);
+
+#endif
diff --git a/src/fe-gtk/search.c b/src/fe-gtk/search.c
index 41a1a642..49c30a14 100644
--- a/src/fe-gtk/search.c
+++ b/src/fe-gtk/search.c
@@ -22,18 +22,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkvseparator.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtktogglebutton.h>
-#include <gdk/gdkkeysyms.h>
-
 #include "../common/hexchat.h"
 #include "../common/fe.h"
 #include "../common/util.h"
@@ -119,14 +107,6 @@ search_entry_cb (GtkWidget * entry, session * sess)
 	search_search (sess, gtk_entry_get_text (GTK_ENTRY (entry)));
 }
 
-static gboolean 
-search_key_cb (GtkWidget * window, GdkEventKey * key, gpointer userdata)
-{
-	if (key->keyval == GDK_Escape)
-		gtk_widget_destroy (window);
-	return FALSE;
-}
-
 static void
 search_caseign_cb (GtkToggleButton * but, session * sess)
 {
@@ -238,7 +218,7 @@ search_open (session * sess)
 	add_tip (wid, "Close this box, reset highlighted search items, and stop searching new lines.");
 
 	/* Add recognition of the ESC key to close the box */
-	g_signal_connect (G_OBJECT (win), "key_press_event", G_CALLBACK (search_key_cb), win);
+	gtkutil_destroy_on_esc (win);
 
 	/* That's all, folks */
 	searchwin = win;
diff --git a/src/fe-gtk/search.h b/src/fe-gtk/search.h
index 8fa1b628..55f8f0b5 100644
--- a/src/fe-gtk/search.h
+++ b/src/fe-gtk/search.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_SEARCH_H
+#define HEXCHAT_SEARCH_H
+
 void search_open (session * sess);
+
+#endif
diff --git a/src/fe-gtk/servlistgui.c b/src/fe-gtk/servlistgui.c
index 4aeaf00f..774ce1cc 100644
--- a/src/fe-gtk/servlistgui.c
+++ b/src/fe-gtk/servlistgui.c
@@ -1,5 +1,19 @@
 /* X-Chat
  * Copyright (C) 2004-2008 Peter Zelezny.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdlib.h>
@@ -7,29 +21,6 @@
 #include <string.h>
 #include <ctype.h>
 
-#include <gtk/gtkversion.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkcomboboxentry.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkimage.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtktree.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkvbbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkwindow.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
@@ -93,7 +84,6 @@ static GtkWidget *servlist_open_edit (GtkWidget *parent, ircnet *net);
 
 static const char *pages[]=
 {
-	"UTF-8 (Unicode)",
 	IRC_DEFAULT_CHARSET,
 	"ISO-8859-15 (Western Europe)",
 	"ISO-8859-2 (Central Europe)",
diff --git a/src/fe-gtk/servlistgui.h b/src/fe-gtk/servlistgui.h
index f2c2d14d..ca176a34 100644
--- a/src/fe-gtk/servlistgui.h
+++ b/src/fe-gtk/servlistgui.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_SERVLISTGUI_H
+#define HEXCHAT_SERVLISTGUI_H
+
 void servlist_autojoinedit (ircnet *net, char *channel, gboolean add);
+
+#endif
diff --git a/src/fe-gtk/setup.c b/src/fe-gtk/setup.c
index f02bc3d7..ac8826cf 100644
--- a/src/fe-gtk/setup.c
+++ b/src/fe-gtk/setup.c
@@ -1,5 +1,19 @@
 /* X-Chat
  * Copyright (C) 2004-2007 Peter Zelezny.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
 #include <stdio.h>
@@ -23,36 +37,10 @@
 #include "menu.h"
 #include "plugin-tray.h"
 
-#include <gtk/gtkcolorseldialog.h>
-#include <gtk/gtktable.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmisc.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkalignment.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkframe.h>
-#include <gtk/gtkfontsel.h>
-#include <gtk/gtkcheckbutton.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkspinbutton.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkhseparator.h>
-#include <gtk/gtkradiobutton.h>
-#include <gtk/gtkcombobox.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreestore.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkhscale.h>
 #ifdef WIN32
 #include "../common/fe.h"
 #endif
 #ifdef USE_GTKSPELL
-#include <gtk/gtktextview.h>
 #include <gtkspell/gtkspell.h>
 #endif
 #ifdef USE_LIBSEXY
@@ -287,6 +275,7 @@ static const setting userlist_settings[] =
 	{ST_TOGGLE, N_("Show hostnames in user list"), P_OFFINTNL(hex_gui_ulist_show_hosts), 0, 0, 0},
 	{ST_TOGGLE, N_("Use the Text box font and colors"), P_OFFINTNL(hex_gui_ulist_style),0,0,0},
 	{ST_TOGGLE, N_("Show icons for user modes"), P_OFFINTNL(hex_gui_ulist_icons), N_("Use graphical icons instead of text symbols in the user list."), 0, 0},
+	{ST_TOGGLE, N_("Color nicknames in userlist"), P_OFFINTNL(hex_gui_ulist_color), N_("Will color nicknames the same as in chat."), 0, 0},
 	{ST_TOGGLE, N_("Show user count in channels"), P_OFFINTNL(hex_gui_ulist_count), 0, 0, 0},
 /*	{ST_TOGGLE, N_("Resizable user list"), P_OFFINTNL(hex_gui_ulist_resizable),0,0,0},*/
 	{ST_MENU,	N_("User list sorted by:"), P_OFFINTNL(hex_gui_ulist_sort), 0, ulmenutext, 0},
@@ -321,6 +310,14 @@ static const char *const focusnewtabsmenu[] =
 	NULL
 };
 
+static const char *const noticeposmenu[] =
+{
+	N_("Automatic"),
+	N_("In an extra tab"),
+	N_("In the front tab"),
+	NULL
+};
+
 static const char *const swtype[] =
 {
 	N_("Tabs"),	/* 0 tabs */
@@ -334,13 +331,13 @@ static const setting tabs_settings[] =
 	/*{ST_HEADER,	N_("Channel Switcher"),0,0,0},*/
 	{ST_RADIO,  N_("Switcher type:"),P_OFFINTNL(hex_gui_tab_layout), 0, swtype, 0},
 	{ST_TOGGLE, N_("Open an extra tab for server messages"), P_OFFINTNL(hex_gui_tab_server), 0, 0, 0},
-	{ST_TOGGLE, N_("Open an extra tab for server notices"), P_OFFINTNL(hex_gui_tab_notices), 0, 0, 0},
 	{ST_TOGGLE, N_("Open a new tab when you receive a private message"), P_OFFINTNL(hex_gui_autoopen_dialog), 0, 0, 0},
 	{ST_TOGGLE, N_("Sort tabs in alphabetical order"), P_OFFINTNL(hex_gui_tab_sort), 0, 0, 0},
 	{ST_TOGGLE, N_("Show icons in the channel tree"), P_OFFINTNL(hex_gui_tab_icons), 0, 0, 0},
 	{ST_TOGGLE, N_("Show dotted lines in the channel tree"), P_OFFINTNL(hex_gui_tab_dots), 0, 0, 0},
 	{ST_TOGGLE, N_("Smaller text"), P_OFFINTNL(hex_gui_tab_small), 0, 0, 0},
 	{ST_MENU,	N_("Focus new tabs:"), P_OFFINTNL(hex_gui_tab_newtofront), 0, focusnewtabsmenu, 0},
+	{ST_MENU,	N_("Placement of notices:"), P_OFFINTNL(hex_irc_notice_pos), 0, noticeposmenu, 0},
 	{ST_MENU,	N_("Show channel switcher at:"), P_OFFINTNL(hex_gui_tab_pos), 0, cspos, 1},
 	{ST_NUMBER,	N_("Shorten tab labels to:"), P_OFFINTNL(hex_gui_tab_trunc), 0, (const char **)N_("letters."), 99},
 
@@ -437,7 +434,7 @@ static const setting alert_settings[] =
 	{ST_TOGGLE,	N_("Enable system tray icon"), P_OFFINTNL(hex_gui_tray), 0, 0, 0},
 	{ST_TOGGLE,	N_("Minimize to tray"), P_OFFINTNL(hex_gui_tray_minimize), 0, 0, 0},
 	{ST_TOGGLE,	N_("Close to tray"), P_OFFINTNL(hex_gui_tray_close), 0, 0, 0},
-	{ST_TOGGLE,	N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("When hiding to tray automatically change status."), 0, 0},
+	{ST_TOGGLE,	N_("Automatically mark away/back"), P_OFFINTNL(hex_gui_tray_away), N_("Automatically change status when hiding to tray."), 0, 0},
 #ifndef WIN32
 	{ST_TOGGLE,	N_("Only show tray balloons when hidden or iconified"), P_OFFINTNL(hex_gui_tray_quiet), 0, 0, 0},
 #endif
@@ -453,11 +450,12 @@ static const setting alert_settings[] =
 	{ST_END, 0, 0, 0, 0, 0}
 };
 
-static const setting alert_settings_hextray[] =
+static const setting alert_settings_unity[] =
 {
 	{ST_HEADER,	N_("Alerts"),0,0,0},
 
 	{ST_ALERTHEAD},
+	{ST_3OGGLE, N_("Show tray balloons on:"), 0, 0, (void *)balloonlist, 0},
 	{ST_3OGGLE, N_("Blink task bar on:"), 0, 0, (void *)taskbarlist, 0},
 	{ST_3OGGLE, N_("Make a beep sound on:"), 0, 0, (void *)beeplist, 0},
 
@@ -493,6 +491,7 @@ static const setting general_settings[] =
 static const setting advanced_settings[] =
 {
 	{ST_HEADER,	N_("Advanced Settings"),0,0,0},
+	{ST_ENTRY,  N_("Real name:"), P_OFFSETNL(hex_irc_real_name), 0, 0, sizeof prefs.hex_irc_real_name},
 #ifdef WIN32
 	{ST_ENTRY,  N_("Alternative fonts:"), P_OFFSETNL(hex_text_font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.hex_text_font_alternative},
 #endif
@@ -522,39 +521,6 @@ static const setting advanced_settings[] =
 	{ST_END, 0, 0, 0, 0, 0}
 };
 
-#ifdef WIN32
-static const setting advanced_settings_oneinstance[] =
-{
-	{ST_HEADER,	N_("Advanced Settings"),0,0,0},
-	{ST_ENTRY,  N_("Alternative fonts:"), P_OFFSETNL(hex_text_font_alternative), "Separate multiple entries with commas without spaces before or after.", 0, sizeof prefs.hex_text_font_alternative},
-	{ST_NUMBER,	N_("Auto reconnect delay:"), P_OFFINTNL(hex_net_reconnect_delay), 0, 0, 9999},
-	{ST_NUMBER,	N_("Auto join delay:"), P_OFFINTNL(hex_irc_join_delay), 0, 0, 9999},
-	{ST_TOGGLE,	N_("Display MODEs in raw form"), P_OFFINTNL(hex_irc_raw_modes), 0, 0, 0},
-	{ST_TOGGLE,	N_("Whois on notify"), P_OFFINTNL(hex_notify_whois_online), N_("Sends a /WHOIS when a user comes online in your notify list."), 0, 0},
-	{ST_TOGGLE,	N_("Hide join and part messages"), P_OFFINTNL(hex_irc_conf_mode), N_("Hide channel join/part messages by default."), 0, 0},
-	/* {ST_TOGGLE,	N_("Allow only one instance of HexChat to run"), P_OFFINTNL(hex_gui_single), 0, 0, 0}, */
-	{ST_TOGGLE,	N_("Display lists in compact mode"), P_OFFINTNL(hex_gui_compact), N_("Use less spacing between user list/channel tree rows."), 0, 0},
-	{ST_HEADER,	N_("Auto Open DCC Windows"),0,0,0},
-	{ST_TOGGLE, N_("Send window"), P_OFFINTNL(hex_gui_autoopen_send), 0, 0, 0},
-	{ST_TOGGLE, N_("Receive window"), P_OFFINTNL(hex_gui_autoopen_recv), 0, 0, 0},
-	{ST_TOGGLE, N_("Chat window"), P_OFFINTNL(hex_gui_autoopen_chat), 0, 0, 0},
-	{ST_HEADER,	N_("Auto Copy Behavior"),0,0,0},
-	{ST_TOGGLE, N_("Automatically copy selected text"), P_OFFINTNL(hex_text_autocopy_text),
-					N_("Copy selected text to clipboard when left mouse button is released. "
-						"Otherwise, CONTROL-SHIFT-C will copy the "
-						"selected text to the clipboard."), 0, 0},
-	{ST_TOGGLE, N_("Automatically include time stamps"), P_OFFINTNL(hex_text_autocopy_stamp),
-					N_("Automatically include time stamps in copied lines of text. Otherwise, "
-						"include time stamps if the SHIFT key is held down while selecting."), 0, 0},
-	{ST_TOGGLE, N_("Automatically include color information"), P_OFFINTNL(hex_text_autocopy_color),
-					N_("Automatically include color information in copied lines of text.  "
-						"Otherwise, include color information if the CONTROL key is held down "
-						"while selecting."), 0, 0},
-
-	{ST_END, 0, 0, 0, 0, 0}
-};
-#endif
-
 static const setting logging_settings[] =
 {
 	{ST_HEADER,	N_("Logging"),0,0,0},
@@ -1936,9 +1902,9 @@ setup_create_pages (GtkWidget *box)
 	setup_add_page (cata[4], book, setup_create_page (tabs_settings));
 	setup_add_page (cata[5], book, setup_create_color_page ());
 
-	if (hextray_mode ())
+	if (unity_mode ())
 	{
-		setup_add_page (cata[8], book, setup_create_page (alert_settings_hextray));
+		setup_add_page (cata[8], book, setup_create_page (alert_settings_unity));
 	}
 	else
 	{
@@ -1948,19 +1914,7 @@ setup_create_pages (GtkWidget *box)
 	setup_add_page (cata[9], book, setup_create_page (general_settings));
 	setup_add_page (cata[10], book, setup_create_page (logging_settings));
 	setup_add_page (cata[11], book, setup_create_sound_page ());
-
-#ifdef WIN32
-	if (portable_mode ())
-	{
-		setup_add_page (cata[12], book, setup_create_page (advanced_settings));
-	}
-	else
-	{
-		setup_add_page (cata[12], book, setup_create_page (advanced_settings_oneinstance));
-	}
-#else
 	setup_add_page (cata[12], book, setup_create_page (advanced_settings));
-#endif
 
 	setup_add_page (cata[14], book, setup_create_page (network_settings));
 	setup_add_page (cata[15], book, setup_create_page (filexfer_settings));
@@ -2220,7 +2174,7 @@ setup_apply (struct hexchatprefs *pr)
 	if (DIFF (hex_gui_compact))
 		noapply = TRUE;
 	if (DIFF (hex_gui_input_icon))
-		noapply = TRUE;	
+		noapply = TRUE;
 	if (DIFF (hex_gui_input_nick))
 		noapply = TRUE;
 	if (DIFF (hex_gui_lagometer))
@@ -2253,7 +2207,7 @@ setup_apply (struct hexchatprefs *pr)
 	if (DIFF (hex_gui_tab_layout))
 		do_layout = TRUE;
 
-	if (color_change || (DIFF (hex_away_size_max)) || (DIFF (hex_away_track)))
+	if (color_change || (DIFF (hex_gui_ulist_color)) || (DIFF (hex_away_size_max)) || (DIFF (hex_away_track)))
 		do_ulist = TRUE;
 
 	if ((pr->hex_gui_tab_pos == 5 || pr->hex_gui_tab_pos == 6) &&
diff --git a/src/fe-gtk/setup.h b/src/fe-gtk/setup.h
index 646ba18e..d756b10e 100644
--- a/src/fe-gtk/setup.h
+++ b/src/fe-gtk/setup.h
@@ -1 +1,25 @@
-void setup_apply_real (int new_pix, int do_ulist, int do_layout);
\ No newline at end of file
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_SETUP_H
+#define HEXCHAT_SETUP_H
+
+void setup_apply_real (int new_pix, int do_ulist, int do_layout);
+
+#endif
diff --git a/src/fe-gtk/sexy-marshal.c b/src/fe-gtk/sexy-marshal.c
index 10a629f2..363842ca 100644
--- a/src/fe-gtk/sexy-marshal.c
+++ b/src/fe-gtk/sexy-marshal.c
@@ -1,5 +1,22 @@
+/* libsexy
+ * Copyright (C) 2005-2006 Christian Hammond.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
 
-#include	<glib-object.h>
+#include <glib-object.h>
 
 
 #ifdef G_ENABLE_DEBUG
diff --git a/src/fe-gtk/sexy-marshal.h b/src/fe-gtk/sexy-marshal.h
index f41eccbe..aa560767 100644
--- a/src/fe-gtk/sexy-marshal.h
+++ b/src/fe-gtk/sexy-marshal.h
@@ -1,8 +1,25 @@
+/* libsexy
+ * Copyright (C) 2005-2006 Christian Hammond.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
 
 #ifndef __sexy_marshal_MARSHAL_H__
 #define __sexy_marshal_MARSHAL_H__
 
-#include	<glib-object.h>
+#include <glib-object.h>
 
 G_BEGIN_DECLS
 
diff --git a/src/fe-gtk/sexy-spell-entry.h b/src/fe-gtk/sexy-spell-entry.h
index 23f01af5..1c761235 100644
--- a/src/fe-gtk/sexy-spell-entry.h
+++ b/src/fe-gtk/sexy-spell-entry.h
@@ -1,7 +1,5 @@
-/*
- * @file libsexy/sexy-spell-entry.h Entry widget
- *
- * @Copyright (C) 2004-2006 Christian Hammond.
+/* libsexy
+ * Copyright (C) 2004-2006 Christian Hammond.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -14,8 +12,8 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 #ifndef _SEXY_SPELL_ENTRY_H_
 #define _SEXY_SPELL_ENTRY_H_
@@ -24,7 +22,7 @@ typedef struct _SexySpellEntry      SexySpellEntry;
 typedef struct _SexySpellEntryClass SexySpellEntryClass;
 typedef struct _SexySpellEntryPriv  SexySpellEntryPriv;
 
-#include <gtk/gtkentry.h>
+#include <gtk/gtk.h>
 
 #define SEXY_TYPE_SPELL_ENTRY            (sexy_spell_entry_get_type())
 #define SEXY_SPELL_ENTRY(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj), SEXY_TYPE_SPELL_ENTRY, SexySpellEntry))
diff --git a/src/fe-gtk/textgui.c b/src/fe-gtk/textgui.c
index 7e006e69..0bdb4476 100644
--- a/src/fe-gtk/textgui.c
+++ b/src/fe-gtk/textgui.c
@@ -26,16 +26,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkliststore.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkvbox.h>
-#include <gtk/gtkvpaned.h>
-#include <gtk/gtkvscrollbar.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "../common/cfgfiles.h"
diff --git a/src/fe-gtk/textgui.h b/src/fe-gtk/textgui.h
index 23db5848..6d9a3a23 100644
--- a/src/fe-gtk/textgui.h
+++ b/src/fe-gtk/textgui.h
@@ -1,2 +1,26 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_TEXTGUI_H
+#define HEXCHAT_TEXTGUI_H
+
 void PrintTextRaw (void *xtbuf, unsigned char *text, int indent, time_t stamp);
 void pevent_dialog_show (void);
+
+#endif
diff --git a/src/fe-gtk/urlgrab.c b/src/fe-gtk/urlgrab.c
index b8a40a35..be62239e 100644
--- a/src/fe-gtk/urlgrab.c
+++ b/src/fe-gtk/urlgrab.c
@@ -22,16 +22,6 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkhbox.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkhbbox.h>
-#include <gtk/gtkscrolledwindow.h>
-
-#include <gtk/gtkliststore.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkcellrenderertext.h>
-
 #include "../common/hexchat.h"
 #include "../common/hexchatc.h"
 #include "../common/cfgfiles.h"
@@ -198,6 +188,7 @@ url_opengui ()
 	urlgrabberwindow =
 		mg_create_generic_tab ("UrlGrabber", _(DISPLAY_NAME": URL Grabber"), FALSE,
 							 TRUE, url_closegui, NULL, 400, 256, &vbox, 0);
+	gtkutil_destroy_on_esc (urlgrabberwindow);
 	view = url_treeview_new (vbox);
 	g_object_set_data (G_OBJECT (urlgrabberwindow), "model",
 	                   gtk_tree_view_get_model (GTK_TREE_VIEW (view)));
diff --git a/src/fe-gtk/urlgrab.h b/src/fe-gtk/urlgrab.h
index 51f15812..246b56e7 100644
--- a/src/fe-gtk/urlgrab.h
+++ b/src/fe-gtk/urlgrab.h
@@ -1 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_URLGRAB_H
+#define HEXCHAT_URLGRAB_H
+
 void url_opengui (void);
+
+#endif
diff --git a/src/fe-gtk/userlistgui.c b/src/fe-gtk/userlistgui.c
index 8405695b..c2f2a462 100644
--- a/src/fe-gtk/userlistgui.c
+++ b/src/fe-gtk/userlistgui.c
@@ -22,22 +22,13 @@
 
 #include "fe-gtk.h"
 
-#include <gtk/gtkbox.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkdnd.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtktreeview.h>
-#include <gtk/gtktreeselection.h>
-#include <gtk/gtkscrolledwindow.h>
-#include <gtk/gtkcellrendererpixbuf.h>
-#include <gtk/gtkcellrenderertext.h>
-#include <gtk/gtkliststore.h>
 #include <gdk/gdkkeysyms.h>
 
 #include "../common/hexchat.h"
 #include "../common/util.h"
 #include "../common/userlist.h"
 #include "../common/modes.h"
+#include "../common/text.h"
 #include "../common/notify.h"
 #include "../common/hexchatc.h"
 #include "../common/fe.h"
@@ -49,11 +40,6 @@
 #include "userlistgui.h"
 #include "fkeys.h"
 
-#ifdef USE_GTKSPELL
-#include <gtk/gtktextview.h>
-#endif
-
-
 enum
 {
 	COL_PIX=0,		// GdkPixbuf *
@@ -327,21 +313,21 @@ fe_userlist_rehash (session *sess, struct User *user)
 {
 	GtkTreeIter *iter;
 	int sel;
-	int do_away = TRUE;
+	int nick_color = 0;
 
 	iter = find_row (GTK_TREE_VIEW (sess->gui->user_tree),
 						  sess->res->user_model, user, &sel);
 	if (!iter)
 		return;
 
-	if (prefs.hex_away_size_max < 1 || !prefs.hex_away_track)
-		do_away = FALSE;
+	if (prefs.hex_away_track && prefs.hex_away_size_max && user->away)
+		nick_color = COL_AWAY;
+	else if (prefs.hex_gui_ulist_color)
+		nick_color = text_color_of(user->nick);
 
 	gtk_list_store_set (GTK_LIST_STORE (sess->res->user_model), iter,
 							  COL_HOST, user->hostname,
-							  COL_GDKCOLOR, (do_away)
-									?	(user->away ? &colors[COL_AWAY] : NULL)
-									:	(NULL),
+							  COL_GDKCOLOR, nick_color ? &colors[nick_color] : NULL,
 							  -1);
 }
 
@@ -351,11 +337,13 @@ fe_userlist_insert (session *sess, struct User *newuser, int row, int sel)
 	GtkTreeModel *model = sess->res->user_model;
 	GdkPixbuf *pix = get_user_icon (sess->server, newuser);
 	GtkTreeIter iter;
-	int do_away = TRUE;
 	char *nick;
+	int nick_color = 0;
 
-	if (prefs.hex_away_size_max < 1 || !prefs.hex_away_track)
-		do_away = FALSE;
+	if (prefs.hex_away_track && prefs.hex_away_size_max && newuser->away)
+		nick_color = COL_AWAY;
+	else if (prefs.hex_gui_ulist_color)
+		nick_color = text_color_of(newuser->nick);
 
 	nick = newuser->nick;
 	if (!prefs.hex_gui_ulist_icons)
@@ -374,9 +362,7 @@ fe_userlist_insert (session *sess, struct User *newuser, int row, int sel)
 									COL_NICK, nick,
 									COL_HOST, newuser->hostname,
 									COL_USER, newuser,
-									COL_GDKCOLOR, (do_away)
-										?	(newuser->away ? &colors[COL_AWAY] : NULL)
-										:	(NULL),
+									COL_GDKCOLOR, nick_color ? &colors[nick_color] : NULL,
 								  -1);
 
 	if (!prefs.hex_gui_ulist_icons)
diff --git a/src/fe-gtk/userlistgui.h b/src/fe-gtk/userlistgui.h
index b49e2b9b..993fe8f0 100644
--- a/src/fe-gtk/userlistgui.h
+++ b/src/fe-gtk/userlistgui.h
@@ -1,3 +1,25 @@
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_USERLISTGUI_H
+#define HEXCHAT_USERLISTGUI_H
+
 void userlist_set_value (GtkWidget *treeview, gfloat val);
 gfloat userlist_get_value (GtkWidget *treeview);
 GtkWidget *userlist_create (GtkWidget *box);
@@ -6,3 +28,5 @@ void userlist_show (session *sess);
 void userlist_select (session *sess, char *name);
 char **userlist_selection_list (GtkWidget *widget, int *num_ret);
 GdkPixbuf *get_user_icon (server *serv, struct User *user);
+
+#endif
diff --git a/src/fe-gtk/xtext.c b/src/fe-gtk/xtext.c
index 6005e265..e151524d 100644
--- a/src/fe-gtk/xtext.c
+++ b/src/fe-gtk/xtext.c
@@ -42,12 +42,6 @@
 #include <ctype.h>
 #include <stdlib.h>
 #include <time.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkclipboard.h>
-#include <gtk/gtkversion.h>
-#include <gtk/gtkwindow.h>
 
 #ifdef HEXCHAT
 #ifdef WIN32
@@ -90,15 +84,8 @@
 #endif
 
 /* is delimiter */
-#if 0
-/* () is used by Wikipedia */
-#define is_del(c) \
-	(c == ' ' || c == '\n' || c == ')' || c == '(' || \
-	 c == '>' || c == '<' || c == ATTR_RESET || c == ATTR_BOLD || c == 0)
-#endif
 #define is_del(c) \
-	(c == ' ' || c == '\n' || c == '>' || c == '<' || \
-	 c == ATTR_RESET || c == ATTR_BOLD || c == 0)
+	(c == ' ' || c == '\n' || c == '>' || c == '<' || c == 0)
 
 #ifdef SCROLL_HACK
 /* force scrolling off */
diff --git a/src/fe-gtk/xtext.h b/src/fe-gtk/xtext.h
index cc6bbebb..8a4b26cf 100644
--- a/src/fe-gtk/xtext.h
+++ b/src/fe-gtk/xtext.h
@@ -1,7 +1,26 @@
-#ifndef __XTEXT_H__
-#define __XTEXT_H__
-
-#include <gtk/gtkadjustment.h>
+/* HexChat
+ * Copyright (C) 1998-2010 Peter Zelezny.
+ * Copyright (C) 2009-2013 Berke Viktor.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef HEXCHAT_XTEXT_H
+#define HEXCHAT_XTEXT_H
+
+#include <gtk/gtk.h>
 #ifdef USE_XFT
 #include <X11/Xft/Xft.h>
 #endif