diff options
author | Josh Rickmar <jrick@devio.us> | 2012-08-06 10:53:22 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-08-06 10:53:22 -0400 |
commit | f42dfb2b201ad6a0dc4432eec7798d7fed19c67f (patch) | |
tree | b2b26663bf6e441e19bb4c47d389ea92269ed0ae | |
parent | 91ffa05aa8b2c6ada1c6cc0a65ef8df0f47e4efe (diff) | |
download | xombrero-f42dfb2b201ad6a0dc4432eec7798d7fed19c67f.tar.gz |
Add a favedit command and remove rm links from :fav
This makes using :fav with link hinting less likely to accidentally remove an entry by typing the wrong number. The old favorites page with the rm links is still available by using the favedit command. Patch slightly modified from a patch provide by user wallex on FS.
-rw-r--r-- | about.c | 35 | ||||
-rw-r--r-- | xombrero.1 | 2 | ||||
-rw-r--r-- | xombrero.c | 5 |
3 files changed, 28 insertions, 14 deletions
diff --git a/about.c b/about.c index 084cf5c..6fb9ef0 100644 --- a/about.c +++ b/about.c @@ -1287,9 +1287,13 @@ xtp_page_fl(struct tab *t, struct karg *args) } /* body */ - body = g_strdup_printf("<table style='table-layout:fixed'><tr>" - "<th style='width: 40px'>#</th><th>Link</th>" - "<th style='width: 40px'>Rm</th></tr>\n"); + if (args->i & XT_DELETE) + body = g_strdup_printf("<table style='table-layout:fixed'><tr>" + "<th style='width: 40px'>#</th><th>Link</th>" + "<th style='width: 40px'>Rm</th></tr>\n"); + else + body = g_strdup_printf("<table style='table-layout:fixed'><tr>" + "<th style='width: 40px'>#</th><th>Link</th></tr>\n"); for (i = 1;;) { if ((title = fparseln(f, &len, &lineno, delim, 0)) == NULL) @@ -1308,15 +1312,22 @@ xtp_page_fl(struct tab *t, struct karg *args) } tmp = body; - body = g_strdup_printf("%s<tr>" - "<td>%d</td>" - "<td><a href='%s'>%s</a></td>" - "<td style='text-align: center'>" - "<a href='%s%d/%s/%d/%d'>X</a></td>" - "</tr>\n", - body, i, uri, title, - XT_XTP_STR, XT_XTP_FL, t->session_key, XT_XTP_FL_REMOVE, i); - + if (args->i & XT_DELETE) + body = g_strdup_printf("%s<tr>" + "<td>%d</td>" + "<td><a href='%s'>%s</a></td>" + "<td style='text-align: center'>" + "<a href='%s%d/%s/%d/%d'>X</a></td>" + "</tr>\n", + body, i, uri, title, + XT_XTP_STR, XT_XTP_FL, t->session_key, + XT_XTP_FL_REMOVE, i); + else + body = g_strdup_printf("%s<tr>" + "<td>%d</td>" + "<td><a href='%s'>%s</a></td>" + "</tr>\n", + body, i, uri, title); g_free(tmp); free(uri); diff --git a/xombrero.1 b/xombrero.1 index 95472f6..c47e4fe 100644 --- a/xombrero.1 +++ b/xombrero.1 @@ -510,6 +510,8 @@ above Show favorites. .It Cm favadd Add the current page to favorites. +.It Cm favedit +Shows favorites list and links to remove entries. .It Cm fullscreen , f Toggle hiding tabs and url entry toolbar. .It Cm h , hist , history diff --git a/xombrero.c b/xombrero.c index 567fc6f..b2acbdd 100644 --- a/xombrero.c +++ b/xombrero.c @@ -3359,8 +3359,9 @@ struct cmd { { "scrollfarright", 0, move, XT_MOVE_FARRIGHT, 0 }, { "scrollfarleft", 0, move, XT_MOVE_FARLEFT, 0 }, - { "favorites", 0, xtp_page_fl, 0, 0 }, - { "fav", 0, xtp_page_fl, 0, 0 }, + { "favorites", 0, xtp_page_fl, XT_SHOW, 0 }, + { "fav", 0, xtp_page_fl, XT_SHOW, 0 }, + { "favedit", 0, xtp_page_fl, XT_SHOW|XT_DELETE, 0 }, { "favadd", 0, add_favorite, 0, 0 }, { "qall", 0, quit, 0, 0 }, |