aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2004-01-29 02:32:07 +0800
committerChristian Persch <chpe@src.gnome.org>2004-01-29 02:32:07 +0800
commitd51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb (patch)
tree251713d43b01ccc0847e86abfcca1085971f8011 /src
parenta02ddda2f0c8abfb4d0ec8f526ac7c68038dd9b3 (diff)
downloadgsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar.gz
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar.bz2
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar.lz
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar.xz
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.tar.zst
gsoc2013-epiphany-d51741a8f81b10f4bff7b3a73f04fc7f71b7cbcb.zip
Fix options parsing.
2004-01-28 Christian Persch <chpe@cvs.gnome.org> * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_solve_smart_url), (options_find_first_option), (smart_url_options_get): Fix options parsing.
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index b0b1190fa..a8be4a515 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2002, 2003 Marco Pesenti Gritti
+ * Copyright (C) 2002-2004 Marco Pesenti Gritti
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -80,7 +80,6 @@ static const EphyBookmarksBookmarkInfo default_bookmarks [] =
* For instance in .nl these should be
* "http://www.google.nl" and "http://www.google.nl/search?q=%s"
*/
-
{ N_("Search the web"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8") }
};
static int n_default_bookmarks = G_N_ELEMENTS (default_bookmarks);
@@ -111,21 +110,18 @@ enum
static guint ephy_bookmarks_signals[LAST_SIGNAL] = { 0 };
-static void
-ephy_bookmarks_class_init (EphyBookmarksClass *klass);
-static void
-ephy_bookmarks_init (EphyBookmarks *tab);
-static void
-ephy_bookmarks_finalize (GObject *object);
+static void ephy_bookmarks_class_init (EphyBookmarksClass *klass);
+static void ephy_bookmarks_init (EphyBookmarks *tab);
+static void ephy_bookmarks_finalize (GObject *object);
static GObjectClass *parent_class = NULL;
GType
ephy_bookmarks_get_type (void)
{
- static GType ephy_bookmarks_type = 0;
+ static GType type = 0;
- if (ephy_bookmarks_type == 0)
+ if (type == 0)
{
static const GTypeInfo our_info =
{
@@ -140,12 +136,12 @@ ephy_bookmarks_get_type (void)
(GInstanceInitFunc) ephy_bookmarks_init
};
- ephy_bookmarks_type = g_type_register_static (G_TYPE_OBJECT,
- "EphyBookmarks",
- &our_info, 0);
+ type = g_type_register_static (G_TYPE_OBJECT,
+ "EphyBookmarks",
+ &our_info, 0);
}
- return ephy_bookmarks_type;
+ return type;
}
static void
@@ -898,6 +894,17 @@ options_find_next_option (const char *current)
return (char *) ret;
}
+static char *
+options_find_first_option (const char *input)
+{
+ const char *start;
+
+ if (!input) return NULL;
+ start = strrchr (input, '{');
+ if (!start || !(*start)) return NULL;
+ return options_skip_spaces (start+1);
+}
+
/**
* Very simple parser for option strings in the
* form a=b,c=d,e="f g",...
@@ -907,7 +914,7 @@ smart_url_options_get (const gchar *options, const gchar *option)
{
gchar *ret = NULL;
gsize optionlen = strlen (option);
- const gchar *current = options_skip_spaces (options);
+ const gchar *current = options_find_first_option (options_skip_spaces (options));
while (current)
{
@@ -983,6 +990,7 @@ ephy_bookmarks_solve_smart_url (EphyBookmarks *eb,
arg = g_convert (content, strlen (content),
encoding, "UTF-8", NULL, NULL, NULL);
+ if (arg == NULL) return NULL;
escaped_arg = gnome_vfs_escape_string (arg);
t1 = smarturl_only;