diff options
-rw-r--r-- | about.c | 10 | ||||
-rw-r--r-- | settings.c | 3 | ||||
-rw-r--r-- | xombrero.1 | 4 | ||||
-rw-r--r-- | xombrero.c | 4 | ||||
-rw-r--r-- | xombrero.h | 2 |
5 files changed, 16 insertions, 7 deletions
diff --git a/about.c b/about.c index 25bae01..7b41454 100644 --- a/about.c +++ b/about.c @@ -618,7 +618,7 @@ remove_favorite(struct tab *t, int index) return; } - /* build a string which will become the new favroites file */ + /* build a string which will become the new favorites file */ new_favs = g_strdup(""); for (i = 1;;) { @@ -683,6 +683,7 @@ add_favorite(struct tab *t, struct karg *args) FILE *f; char *line = NULL; size_t urilen, linelen; + gchar *argtitle = NULL; const gchar *uri, *title; if (t == NULL) @@ -700,7 +701,10 @@ add_favorite(struct tab *t, struct karg *args) return (1); } - title = get_title(t, FALSE); + if (args->s && strlen(g_strstrip(args->s))) + argtitle = html_escape(g_strstrip(args->s)); + + title = argtitle ? argtitle : get_title(t, FALSE); uri = get_uri(t); if (title == NULL || uri == NULL) { @@ -724,6 +728,8 @@ add_favorite(struct tab *t, struct karg *args) fprintf(f, "\n%s\n%s", title, uri); done: + if (argtitle) + g_free(argtitle); if (line) free(line); fclose(f); diff --git a/settings.c b/settings.c index 1ad7bc1..f9d3e36 100644 --- a/settings.c +++ b/settings.c @@ -3740,7 +3740,8 @@ struct settings_args { void print_setting(struct settings *s, char *val, void *cb_args) { - char *enc_val, *tmp, *color; + char *color; + gchar *tmp, *enc_val; struct settings_args *sa = cb_args; if (sa == NULL || s->flags & XT_SF_INVISIBLE) diff --git a/xombrero.1 b/xombrero.1 index dcf60dc..5ad4627 100644 --- a/xombrero.1 +++ b/xombrero.1 @@ -515,8 +515,10 @@ contents will be opened in the same fashion as for the command above .It Cm fav Show favorites. -.It Cm favadd +.It Cm favadd Op Ar title Add the current page to favorites. +The title can be overridden by specifying +.Ar title . .It Cm favedit Shows favorites list and links to remove entries. .It Cm fullscreen , f diff --git a/xombrero.c b/xombrero.c index 2e48b1f..57bc59a 100644 --- a/xombrero.c +++ b/xombrero.c @@ -992,7 +992,7 @@ find_mime_type(char *mime_type) * This only escapes the & and < characters, as per the discussion found here: * http://lists.apple.com/archives/Webkitsdk-dev/2007/May/msg00056.html */ -char * +gchar * html_escape(const char *val) { char *s, *sp; @@ -3289,7 +3289,7 @@ struct cmd { { "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 }, + { "favadd", 0, add_favorite, 0, XT_USERARG }, { "qall", 0, quit, 0, 0 }, { "quitall", 0, quit, 0, 0 }, diff --git a/xombrero.h b/xombrero.h index 777b3d3..bda96fc 100644 --- a/xombrero.h +++ b/xombrero.h @@ -407,7 +407,7 @@ void load_uri(struct tab *t, const gchar *uri); gboolean match_uri(const gchar *uri, const gchar *key); int valid_url_type(const char *); void expand_tilde(char *, size_t, const char *); -char *html_escape(const char *val); +gchar *html_escape(const char *val); void set_status(struct tab *t, gchar *fmt, ...); void load_webkit_string(struct tab *, const char *, gchar *, int); |