aboutsummaryrefslogtreecommitdiffstats
path: root/src/bookmarks
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@it.gnome.org>2003-04-13 18:12:34 +0800
committerMarco Pesenti Gritti <mpeseng@src.gnome.org>2003-04-13 18:12:34 +0800
commit71ba304503bfc2219ea4905ea766ed0880219ecc (patch)
treeb6b78fa300e81856e52c24ee701cf40f4fc6d47a /src/bookmarks
parent4e4065d82b2f0322c43015db238e11e9edf76bd8 (diff)
downloadgsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar.gz
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar.bz2
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar.lz
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar.xz
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.tar.zst
gsoc2013-epiphany-71ba304503bfc2219ea4905ea766ed0880219ecc.zip
Use google feel like for keywords
2003-04-13 Marco Pesenti Gritti <marco@it.gnome.org> * embed/mozilla/default-prefs.js: Use google feel like for keywords * lib/ephy-node.c: (ephy_node_new_with_id), (ephy_node_system_init): * lib/ephy-node.h: Pass the reserved ids num * lib/ephy-types.h: * src/ephy-shell.c: (ephy_shell_init): Increase reserved ids to 100. * src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_init_defaults), (ephy_bookmarks_load), (ephy_bookmarks_init): Default keywords and bookmarks (only google smb). Keywords are probably quite sucky, well it's a start ;) Adding more bookmarks could be a i18n pain. We should be ready for 0.5.0 now. Apologies to translators for the added string, but this was really necessary for the bookmarks system to make sense :/
Diffstat (limited to 'src/bookmarks')
-rw-r--r--src/bookmarks/ephy-bookmarks.c51
1 files changed, 49 insertions, 2 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c
index 5db21ad14..f500082e7 100644
--- a/src/bookmarks/ephy-bookmarks.c
+++ b/src/bookmarks/ephy-bookmarks.c
@@ -40,6 +40,29 @@ struct EphyBookmarksPrivate
double lower_score;
};
+typedef struct
+{
+ const char *title;
+ const char *location;
+ const char *smart_url;
+} EphyBookmarksBookmarkInfo;
+
+static const EphyBookmarksBookmarkInfo default_bookmarks [] =
+{
+ { N_("Search the web"), "http://www.google.com", "http://www.google.com/search?q=%s" }
+};
+static int n_default_bookmarks = G_N_ELEMENTS (default_bookmarks);
+
+static const char *default_topics [] =
+{
+ N_("News"),
+ N_("People"),
+ N_("Shop"),
+ N_("Art"),
+ N_("Work")
+};
+static int n_default_topics = G_N_ELEMENTS (default_topics);
+
static void
ephy_bookmarks_class_init (EphyBookmarksClass *klass);
static void
@@ -193,6 +216,24 @@ ephy_bookmarks_class_init (EphyBookmarksClass *klass)
}
static void
+ephy_bookmarks_init_defaults (EphyBookmarks *eb)
+{
+ int i;
+
+ for (i = 0; i < n_default_topics; i++)
+ {
+ ephy_bookmarks_add_keyword (eb, default_topics[i]);
+ }
+
+ for (i = 0; i < n_default_bookmarks; i++)
+ {
+ ephy_bookmarks_add (eb, default_bookmarks[i].title,
+ default_bookmarks[i].location,
+ default_bookmarks[i].smart_url);
+ }
+}
+
+static gboolean
ephy_bookmarks_load (EphyBookmarks *eb)
{
xmlDocPtr doc;
@@ -200,7 +241,7 @@ ephy_bookmarks_load (EphyBookmarks *eb)
char *tmp;
if (g_file_test (eb->priv->xml_file, G_FILE_TEST_EXISTS) == FALSE)
- return;
+ return FALSE;
doc = xmlParseFile (eb->priv->xml_file);
g_assert (doc != NULL);
@@ -219,6 +260,8 @@ ephy_bookmarks_load (EphyBookmarks *eb)
}
xmlFreeDoc (doc);
+
+ return TRUE;
}
static void
@@ -491,7 +534,11 @@ ephy_bookmarks_init (EphyBookmarks *eb)
g_value_unset (&value);
ephy_node_add_child (eb->priv->keywords, eb->priv->favorites);
- ephy_bookmarks_load (eb);
+ if (!ephy_bookmarks_load (eb))
+ {
+ ephy_bookmarks_init_defaults (eb);
+ }
+
ephy_bookmarks_emit_data_changed (eb);
ephy_setup_history_notifiers (eb);