aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog26
-rw-r--r--embed/mozilla/default-prefs.js2
-rw-r--r--lib/ephy-node.c10
-rw-r--r--lib/ephy-node.h2
-rw-r--r--lib/ephy-types.h2
-rw-r--r--src/bookmarks/ephy-bookmarks.c51
-rw-r--r--src/ephy-shell.c2
7 files changed, 83 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 644dc94e0..a57f31e52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+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.
+
2003-04-13 Xan Lopez <xan@masilla.org>
* NEWS:
diff --git a/embed/mozilla/default-prefs.js b/embed/mozilla/default-prefs.js
index 82ce61c46..c1ac9deed 100644
--- a/embed/mozilla/default-prefs.js
+++ b/embed/mozilla/default-prefs.js
@@ -2,7 +2,7 @@
user_pref("mozilla.widget.raise-on-setfocus", false);
// set default search engine
-user_pref("keyword.URL", "http://www.google.com/search?q=");
+user_pref("keyword.URL", "http://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=");
user_pref("keyword.enabled", true);
user_pref("security.checkloaduri", false);
diff --git a/lib/ephy-node.c b/lib/ephy-node.c
index 19ca32a15..44ae48c2e 100644
--- a/lib/ephy-node.c
+++ b/lib/ephy-node.c
@@ -96,14 +96,12 @@ enum
LAST_SIGNAL
};
-#define RESERVED_IDS 10
-
static GObjectClass *parent_class = NULL;
static guint ephy_node_signals[LAST_SIGNAL] = { 0 };
static GMutex *id_factory_lock = NULL;
-static long id_factory = RESERVED_IDS;
+static long id_factory;
static GStaticRWLock *id_to_node_lock = NULL;
static GPtrArray *id_to_node;
@@ -399,8 +397,6 @@ ephy_node_new_with_id (gulong reserved_id)
{
EphyNode *node;
- g_return_val_if_fail (reserved_id < RESERVED_IDS, NULL);
-
node = EPHY_NODE (g_object_new (EPHY_TYPE_NODE,
"id", reserved_id,
NULL));
@@ -1376,7 +1372,7 @@ ephy_node_get_previous_child (EphyNode *node,
}
void
-ephy_node_system_init (void)
+ephy_node_system_init (gulong reserved_ids)
{
/* id to node */
id_to_node = g_ptr_array_new ();
@@ -1385,7 +1381,7 @@ ephy_node_system_init (void)
g_static_rw_lock_init (id_to_node_lock);
/* id factory */
- id_factory = RESERVED_IDS;
+ id_factory = reserved_ids;
id_factory_lock = g_mutex_new ();
}
diff --git a/lib/ephy-node.h b/lib/ephy-node.h
index 5a3413617..f257ebb1e 100644
--- a/lib/ephy-node.h
+++ b/lib/ephy-node.h
@@ -136,7 +136,7 @@ EphyNode *ephy_node_get_previous_child (EphyNode *node,
EphyNode *child);
/* node id services */
-void ephy_node_system_init (void);
+void ephy_node_system_init (gulong reserved_ids);
void ephy_node_system_shutdown (void);
long ephy_node_new_id (void);
diff --git a/lib/ephy-types.h b/lib/ephy-types.h
index 3d8b6be06..f489081e8 100644
--- a/lib/ephy-types.h
+++ b/lib/ephy-types.h
@@ -30,6 +30,8 @@ typedef enum
G_NOT_IMPLEMENTED
} gresult;
+#define EPHY_NODE_RESERVED_IDS 100
+
/* Ids of the root nodes of history,
* bookmarks and favicon cache */
enum
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);
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 1fa250e66..d76dc5d86 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -267,7 +267,7 @@ ephy_shell_init (EphyShell *gs)
ephy_debug_init ();
ephy_thread_helpers_init ();
- ephy_node_system_init ();
+ ephy_node_system_init (EPHY_NODE_RESERVED_IDS);
ephy_file_helpers_init ();
ephy_stock_icons_init ();
ephy_ensure_dir_exists (ephy_dot_dir ());