diff options
author | Marco Pesenti Gritti <marco@it.gnome.org> | 2003-06-09 19:49:43 +0800 |
---|---|---|
committer | Marco Pesenti Gritti <mpeseng@src.gnome.org> | 2003-06-09 19:49:43 +0800 |
commit | 50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd (patch) | |
tree | 4e8a7a54ff0f66f5c611e4cda2cb33138873cb6f /src/bookmarks/ephy-bookmarks.c | |
parent | 715e6da7a85512491ac612dc5f97e48809ea5b4a (diff) | |
download | gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.gz gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.bz2 gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.lz gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.xz gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.tar.zst gsoc2013-epiphany-50bb5af3f6a571e8e341d26cdd5b7a1b2178d8dd.zip |
Get rid of starthere: and default to google, as discussed with Seth. Add a
2003-06-09 Marco Pesenti Gritti <marco@it.gnome.org>
* data/epiphany.schemas.in:
* data/ui/epiphany-bookmark-editor-ui.xml.in:
* embed/ephy-embed-shell.c: (ephy_embed_shell_class_init):
* embed/mozilla/Makefile.am:
* embed/mozilla/MozRegisterComponents.cpp:
* lib/Makefile.am:
* src/bookmarks/ephy-bookmark-action.c: (create_tool_item),
(ephy_bookmark_action_sync_smart_url), (entry_activated_cb),
(activate_cb), (connect_proxy),
(ephy_bookmark_action_set_property),
(ephy_bookmark_action_finalize), (ephy_bookmark_action_class_init),
(sync_bookmark_properties), (ephy_bookmark_action_init):
* src/bookmarks/ephy-bookmark-properties.c:
(location_entry_changed_cb):
* src/bookmarks/ephy-bookmarks-editor.c: (show_properties_dialog),
(add_bookmarks_source_menu), (import_dialog_response_cb),
(cmd_bookmarks_import):
* src/bookmarks/ephy-bookmarks-import.c: (ephy_bookmarks_import),
(mozilla_parse_bookmarks), (xbel_parse_folder),
(xbel_parse_bookmarks), (ephy_bookmarks_import_xbel):
* src/bookmarks/ephy-bookmarks-import.h:
* src/bookmarks/ephy-bookmarks.c:
(ephy_bookmarks_autocompletion_source_foreach),
(ephy_bookmarks_init_defaults), (update_topics_list),
(update_has_smart_address), (ephy_bookmarks_add),
(ephy_bookmarks_set_address):
* src/bookmarks/ephy-bookmarks.h:
* src/bookmarks/ephy-new-bookmark.c: (ephy_new_bookmark_finalize),
(ephy_new_bookmark_add), (ephy_new_bookmark_init),
(ephy_new_bookmark_set_title):
* src/bookmarks/ephy-new-bookmark.h:
* src/ephy-shell.c: (ephy_shell_init):
* src/popup-commands.c: (popup_cmd_bookmark_link):
Get rid of starthere: and default to google, as discussed
with Seth.
Add a way to import bookmarks from the editor. (you still
cant specificy a file, that's sort of low priority for me, but
we have a plan on how to do it).
Allow to edit smart bookmarks in the user interface. The address
field is used and when there is a %s, it's considered a smart
url. (like mozilla does it).
Diffstat (limited to 'src/bookmarks/ephy-bookmarks.c')
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 68 |
1 files changed, 44 insertions, 24 deletions
diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 801aadc87..9d4269a4e 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -68,7 +68,7 @@ static const EphyBookmarksBookmarkInfo default_bookmarks [] = * "http://www.google.nl" and "http://www.google.nl/search?q=%s" */ - { N_("Search the web"), N_("http://www.google.com"), N_("http://www.google.com/search?q=%s&ie=UTF-8&oe=UTF-8") } + { 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); @@ -169,29 +169,20 @@ ephy_bookmarks_autocompletion_source_foreach (EphyAutocompletionSource *source, for (i = 0; i < children->len; i++) { EphyNode *kid; - const char *url, *smart_url, *title, *keywords; + const char *url, *title, *keywords; + gboolean smart_url; kid = g_ptr_array_index (children, i); url = ephy_node_get_property_string (kid, EPHY_NODE_BMK_PROP_LOCATION); - smart_url = ephy_node_get_property_string - (kid, EPHY_NODE_BMK_PROP_SMART_LOCATION); + smart_url = ephy_node_get_property_boolean + (kid, EPHY_NODE_BMK_PROP_HAS_SMART_ADDRESS); title = ephy_node_get_property_string (kid, EPHY_NODE_BMK_PROP_TITLE); keywords = ephy_node_get_property_string (kid, EPHY_NODE_BMK_PROP_KEYWORDS); - if (smart_url == NULL || - g_utf8_strlen (smart_url, -1) == 0) - { - smart_url = NULL; - } - - func (source, - smart_url ? NULL : keywords, - title, - smart_url ? smart_url : url, - (smart_url != NULL), + func (source, keywords, title, url, smart_url, TRUE, 0, data); } ephy_node_thaw (eb->priv->bookmarks); @@ -224,8 +215,7 @@ ephy_bookmarks_init_defaults (EphyBookmarks *eb) 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); + default_bookmarks[i].location); node = ephy_bookmarks_find_bookmark (eb, default_bookmarks[i].location); if (node == NULL) break; @@ -584,6 +574,7 @@ static void update_topics_list (EphyNode *bookmark, const char *list) { GValue value = { 0, }; + g_value_init (&value, G_TYPE_STRING); g_value_set_string (&value, list); ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_KEYWORDS, @@ -763,11 +754,28 @@ ephy_bookmarks_new () return tab; } +static void +update_has_smart_address (EphyNode *bmk, const char *address) +{ + gboolean smart = FALSE; + GValue value = { 0, }; + + if (address) + { + smart = strstr (address, "%s") != NULL; + } + + g_value_init (&value, G_TYPE_BOOLEAN); + g_value_set_boolean (&value, smart); + ephy_node_set_property (bmk, EPHY_NODE_BMK_PROP_HAS_SMART_ADDRESS, + &value); + g_value_unset (&value); +} + EphyNode * ephy_bookmarks_add (EphyBookmarks *eb, const char *title, - const char *url, - const char *smart_url) + const char *url) { EphyNode *bm; GValue value = { 0, }; @@ -786,11 +794,7 @@ ephy_bookmarks_add (EphyBookmarks *eb, &value); g_value_unset (&value); - g_value_init (&value, G_TYPE_STRING); - g_value_set_string (&value, smart_url); - ephy_node_set_property (bm, EPHY_NODE_BMK_PROP_SMART_LOCATION, - &value); - g_value_unset (&value); + update_has_smart_address (bm, url); ephy_node_add_child (eb->priv->bookmarks, bm); ephy_node_add_child (eb->priv->notcategorized, bm); @@ -801,6 +805,22 @@ ephy_bookmarks_add (EphyBookmarks *eb, return bm; } +void +ephy_bookmarks_set_address (EphyBookmarks *eb, + EphyNode *bookmark, + const char *address) +{ + GValue value = { 0, }; + + g_value_init (&value, G_TYPE_STRING); + g_value_set_string (&value, address); + ephy_node_set_property (bookmark, EPHY_NODE_BMK_PROP_LOCATION, + &value); + g_value_unset (&value); + + update_has_smart_address (bookmark, address); +} + EphyNode* ephy_bookmarks_find_bookmark (EphyBookmarks *eb, const char *url) |