summary refs log tree commit diff stats
path: root/src/fe-gtk
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-03-16 00:08:01 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-03-16 00:08:01 +0100
commit0452f9582eb1221bb44f9a078452a6b86c662c00 (patch)
treee60c602c36d32fc25b9f266cebc06f967064bad3 /src/fe-gtk
parent3672db76c506f77e85e4cafdb031c37596599e31 (diff)
parent1012be5efbf01597d4edfd8071068286a77ff2dd (diff)
Merge branch 'master' into wdk
Diffstat (limited to 'src/fe-gtk')
-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.");
+	}
 }