about summary refs log tree commit diff stats
path: root/xxxterm.c
diff options
context:
space:
mode:
authorEdd Barrett <vext01@gmail.com>2010-12-31 16:29:27 +0000
committerEdd Barrett <vext01@gmail.com>2010-12-31 16:29:27 +0000
commit2c8e006e0e2d7a524c668778949e0f0d79faf01b (patch)
tree38d7ac744feed35bc60288e0efb7f6295e98e50c /xxxterm.c
parent0cec90e10509e0f6946058d0b4511f64e3711895 (diff)
downloadxombrero-2c8e006e0e2d7a524c668778949e0f0d79faf01b.tar.gz
* If there are no favorites to show, show a message.
* Dissallow adding xtp pages as favorites (fixes seg fault).
Diffstat (limited to 'xxxterm.c')
-rw-r--r--xxxterm.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xxxterm.c b/xxxterm.c
index c6658fb..7d04014 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -1785,6 +1785,16 @@ xtp_page_fl(struct tab *t, struct karg *args)
 	}
 	fclose(f);
 
+	/* if none, say so */
+	if (i == 1) {
+		tmp = body;
+		body = g_strdup_printf("%s<tr>"
+		    "<td colspan='3' style='text-align: center'>"
+		    "No favorites - To add one use the 'favadd' command."
+		    "</td></tr>", body);
+		g_free(tmp);
+	}
+
 	if (uri)
 		free(uri);
 	if (title)
@@ -1970,6 +1980,12 @@ add_favorite(struct tab *t, struct karg *args)
 	if (t == NULL)
 		return (1);
 
+	/* don't allow adding of xtp pages to favorites */
+	if (t->xtp_meaning != XT_XTP_TAB_MEANING_NORMAL) {
+		warn("%s: can't add xtp pages to favorites", __func__);
+		return (1);
+	}
+
 	snprintf(file, sizeof file, "%s/%s/%s",
 	    pwd->pw_dir, XT_DIR, XT_FAVS_FILE);
 	if ((f = fopen(file, "r+")) == NULL) {