diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2005-07-27 01:41:04 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2005-07-27 01:41:04 +0800 |
commit | fc69f229f306940d351fd20606fe6a77104ef48d (patch) | |
tree | 4ebf2c194552d38c330a9ac974b5c38abe1b198c /src/bookmarks/ephy-bookmark-action.c | |
parent | 185ea56fa4d1b5626ff1418a90d979f3cc15b108 (diff) | |
download | gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.gz gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.bz2 gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.lz gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.xz gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.tar.zst gsoc2013-epiphany-fc69f229f306940d351fd20606fe6a77104ef48d.zip |
Unify bookmarks/smart bookmarks address resolution, and add a signal to
2005-07-26 Christian Persch <chpe@cvs.gnome.org>
* lib/ephy-marshal.list:
* src/bookmarks/ephy-bookmark-action.c: (open_in_tab_activate_cb),
(open_in_window_activate_cb), (activate_cb):
* src/bookmarks/ephy-bookmarks.c: (ephy_bookmarks_class_init),
(impl_resolve_address), (ephy_bookmarks_resolve_address):
* src/bookmarks/ephy-bookmarks.h:
* src/bookmarks/ephy-topic-action.c: (menu_activate_cb),
(open_in_tabs_activate_cb):
* src/ephy-location-action.c: (action_activated_cb),
(entry_activate_cb):
* src/epiphany.defs:
Unify bookmarks/smart bookmarks address resolution, and add a signal
to EphyBookmarks for it.
Diffstat (limited to 'src/bookmarks/ephy-bookmark-action.c')
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 90 |
1 files changed, 44 insertions, 46 deletions
diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index 983b2aedb..f7459c477 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -308,81 +308,79 @@ static void open_in_tab_activate_cb (GtkWidget *widget, EphyBookmarkAction *action) { - const char *url; + EphyBookmarkActionPrivate *priv = action->priv; + EphyBookmarks *bookmarks; + const char *location; + char *address; - g_return_if_fail (action->priv->node != NULL); + g_return_if_fail (priv->node != NULL); - url = ephy_node_get_property_string (action->priv->node, - EPHY_NODE_BMK_PROP_LOCATION); - ephy_link_open (EPHY_LINK (action), url, NULL, + location = ephy_node_get_property_string + (priv->node, EPHY_NODE_BMK_PROP_LOCATION); + g_return_if_fail (location != NULL); + + bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); + address = ephy_bookmarks_resolve_address (bookmarks, location, NULL); + g_return_if_fail (address != NULL); + + ephy_link_open (EPHY_LINK (action), address, NULL, EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO); + + g_free (address); } static void open_in_window_activate_cb (GtkWidget *widget, EphyBookmarkAction *action) { - const char *url; + EphyBookmarkActionPrivate *priv = action->priv; + EphyBookmarks *bookmarks; + const char *location; + char *address; - g_return_if_fail (action->priv->node != NULL); + g_return_if_fail (priv->node != NULL); + + location = ephy_node_get_property_string + (priv->node, EPHY_NODE_BMK_PROP_LOCATION); + g_return_if_fail (location != NULL); + + bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); + address = ephy_bookmarks_resolve_address (bookmarks, location, NULL); + g_return_if_fail (address != NULL); - url = ephy_node_get_property_string (action->priv->node, - EPHY_NODE_BMK_PROP_LOCATION); + ephy_link_open (EPHY_LINK (action), address, NULL, EPHY_LINK_NEW_WINDOW); - ephy_link_open (EPHY_LINK (action), url, NULL, EPHY_LINK_NEW_WINDOW); + g_free (address); } static void activate_cb (GtkWidget *widget, EphyBookmarkAction *action) { - const char *url; - char *location = NULL, *text = NULL; + EphyBookmarkActionPrivate *priv = action->priv; + EphyBookmarks *bookmarks; + const char *location; + char *address, *text = NULL; - g_return_if_fail (action->priv->node != NULL); + g_return_if_fail (priv->node != NULL); - url = ephy_node_get_property_string (action->priv->node, - EPHY_NODE_BMK_PROP_LOCATION); + location = ephy_node_get_property_string + (priv->node, EPHY_NODE_BMK_PROP_LOCATION); + g_return_if_fail (location != NULL); if (GTK_IS_EDITABLE (widget)) { text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); } - if (text != NULL && text[0] != '\0') - { - EphyBookmarks *bookmarks; - - bookmarks = ephy_shell_get_bookmarks (ephy_shell); - - location = ephy_bookmarks_solve_smart_url (bookmarks, - url, - text); - } - else - { - if (action->priv->smart_url) - { - GnomeVFSURI *uri; - - uri = gnome_vfs_uri_new (url); - - if (uri) - { - location = g_strdup (gnome_vfs_uri_get_host_name (uri)); - gnome_vfs_uri_unref (uri); - } - } + bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); - if (location == NULL) - { - location = g_strdup (url); - } - } + address = ephy_bookmarks_resolve_address (bookmarks, location, text); + g_return_if_fail (address != NULL); - ephy_link_open (EPHY_LINK (action), location, NULL, + ephy_link_open (EPHY_LINK (action), address, NULL, ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); - g_free (location); + g_free (address); g_free (text); } |