summary refs log tree commit diff stats
path: root/src/fe-gtk/urlgrab.c
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-03-15 23:58:52 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-03-15 23:58:52 +0100
commit1012be5efbf01597d4edfd8071068286a77ff2dd (patch)
tree214832df97982d504d81c822650d93c1e095b5a0 /src/fe-gtk/urlgrab.c
parent605c3dea36918a631d917269d78bf9557552608b (diff)
update xchat to r1503
Diffstat (limited to 'src/fe-gtk/urlgrab.c')
-rw-r--r--src/fe-gtk/urlgrab.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/fe-gtk/urlgrab.c b/src/fe-gtk/urlgrab.c
index 6e5f1e0d..7f23af92 100644
--- a/src/fe-gtk/urlgrab.c
+++ b/src/fe-gtk/urlgrab.c
@@ -33,6 +33,7 @@
 #include <gtk/gtkcellrenderertext.h>
 
 #include "../common/xchat.h"
+#include "../common/xchatc.h"
 #include "../common/cfgfiles.h"
 #include "../common/fe.h"
 #include "../common/url.h"
@@ -152,6 +153,7 @@ fe_url_add (const char *urltext)
 {
 	GtkListStore *store;
 	GtkTreeIter iter;
+	gboolean valid;
 	
 	if (urlgrabberwindow)
 	{
@@ -161,6 +163,15 @@ fe_url_add (const char *urltext)
 		gtk_list_store_set (store, &iter,
 		                    URL_COLUMN, urltext,
 		                    -1);
+
+		/* remove any overflow */
+		if (prefs.url_grabber_limit > 0)
+		{
+			valid = gtk_tree_model_iter_nth_child (
+				GTK_TREE_MODEL (store), &iter, NULL, prefs.url_grabber_limit);
+			while (valid)
+				valid = gtk_list_store_remove (store, &iter);
+		}
 	}
 }
 
@@ -204,5 +215,11 @@ url_opengui ()
 
 	gtk_widget_show (urlgrabberwindow);
 
-	tree_foreach (url_tree, (tree_traverse_func *)populate_cb, NULL);
+	if (prefs.url_grabber)
+		tree_foreach (url_tree, (tree_traverse_func *)populate_cb, NULL);
+	else
+	{
+		gtk_list_store_clear (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view))));
+		fe_url_add ("URL Grabber is disabled.");
+	}
 }