diff options
author | Raphael Slinckx <rslinckx@cvs.gnome.org> | 2005-09-17 01:53:14 +0800 |
---|---|---|
committer | Raphaƫl Slinckx <rslinckx@src.gnome.org> | 2005-09-17 01:53:14 +0800 |
commit | 71404d67b91b3db6d6c97397a76fc928e8097e39 (patch) | |
tree | 7e41b85d0ab0448511323ca4a17e4f366226c618 | |
parent | c229eb7ccf39dbfcc57547cdd2ca16d2dcbb2033 (diff) | |
download | gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar.gz gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar.bz2 gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar.lz gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar.xz gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.tar.zst gsoc2013-epiphany-71404d67b91b3db6d6c97397a76fc928e8097e39.zip |
Repair the previous b0rkage, see previous log
2005-09-16 Raphael Slinckx <rslinckx@cvs.gnome.org>
* src/bookmarks/ephy-bookmark-action.c:
(bookmark_activate_with_flags), (open_in_tab_activate_cb),
(open_in_window_activate_cb), (activate_cb):
* src/bookmarks/ephy-bookmarks.c: (impl_resolve_address):
Repair the previous b0rkage, see previous log
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 96 | ||||
-rw-r--r-- | src/bookmarks/ephy-bookmarks.c | 19 |
3 files changed, 53 insertions, 70 deletions
@@ -1,3 +1,11 @@ +2005-09-16 Raphael Slinckx <rslinckx@cvs.gnome.org> + + * src/bookmarks/ephy-bookmark-action.c: + (bookmark_activate_with_flags), (open_in_tab_activate_cb), + (open_in_window_activate_cb), (activate_cb): + * src/bookmarks/ephy-bookmarks.c: (impl_resolve_address): + Repair the previous b0rkage, see previous log + 2005-09-15 Raphael Slinckx <rslinckx@cvs.gnome.org> * src/bookmarks/ephy-bookmarks.c: (impl_resolve_address): diff --git a/src/bookmarks/ephy-bookmark-action.c b/src/bookmarks/ephy-bookmark-action.c index f7459c477..a4154b298 100644 --- a/src/bookmarks/ephy-bookmark-action.c +++ b/src/bookmarks/ephy-bookmark-action.c @@ -305,83 +305,77 @@ ephy_bookmark_action_sync_label (GtkAction *gaction, } static void -open_in_tab_activate_cb (GtkWidget *widget, - EphyBookmarkAction *action) +bookmark_activate_with_flags (GtkWidget *widget, + EphyBookmarkAction *action, + EphyLinkFlags flags) { EphyBookmarkActionPrivate *priv = action->priv; EphyBookmarks *bookmarks; const char *location; - char *address; + char *address = NULL, *text = 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); + + if (GTK_IS_EDITABLE (widget)) + { + text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); + } + + /* The entered search term is empty, and we have a smart bookmark */ + if ((text == NULL || text[0] == '\0') && strstr (location, "%s") != NULL) + { + GnomeVFSURI *uri = gnome_vfs_uri_new (location); + if (uri != NULL) + { + address = g_strconcat ( + gnome_vfs_uri_get_scheme (uri), + "://", + gnome_vfs_uri_get_host_name (uri), + NULL); + gnome_vfs_uri_unref (uri); + } + } + + if (address == NULL) + { + address = ephy_bookmarks_resolve_address (bookmarks, location, text); + } g_return_if_fail (address != NULL); - ephy_link_open (EPHY_LINK (action), address, NULL, - EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO); + ephy_link_open (EPHY_LINK (action), address, NULL, flags); g_free (address); + g_free (text); } static void -open_in_window_activate_cb (GtkWidget *widget, EphyBookmarkAction *action) +open_in_tab_activate_cb (GtkWidget *widget, + EphyBookmarkAction *action) { - EphyBookmarkActionPrivate *priv = action->priv; - EphyBookmarks *bookmarks; - const char *location; - char *address; - - 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); - - ephy_link_open (EPHY_LINK (action), address, NULL, EPHY_LINK_NEW_WINDOW); + bookmark_activate_with_flags(widget, action, + EPHY_LINK_NEW_TAB | EPHY_LINK_JUMP_TO); +} - g_free (address); +static void +open_in_window_activate_cb (GtkWidget *widget, + EphyBookmarkAction *action) +{ + bookmark_activate_with_flags(widget, action, + EPHY_LINK_NEW_WINDOW); } static void activate_cb (GtkWidget *widget, - EphyBookmarkAction *action) + EphyBookmarkAction *action) { - EphyBookmarkActionPrivate *priv = action->priv; - EphyBookmarks *bookmarks; - const char *location; - char *address, *text = 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); - - if (GTK_IS_EDITABLE (widget)) - { - text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1); - } - - bookmarks = ephy_shell_get_bookmarks (ephy_shell_get_default ()); - - address = ephy_bookmarks_resolve_address (bookmarks, location, text); - g_return_if_fail (address != NULL); - - ephy_link_open (EPHY_LINK (action), address, NULL, + bookmark_activate_with_flags(widget, action, ephy_gui_is_middle_click () ? EPHY_LINK_NEW_TAB : 0); - - g_free (address); - g_free (text); } static void diff --git a/src/bookmarks/ephy-bookmarks.c b/src/bookmarks/ephy-bookmarks.c index 3e222eaf6..4a9357834 100644 --- a/src/bookmarks/ephy-bookmarks.c +++ b/src/bookmarks/ephy-bookmarks.c @@ -1342,25 +1342,6 @@ impl_resolve_address (EphyBookmarks *eb, char *pos, *oldpos, *arg, *escaped_arg, *encoding, *optionsend; if (address == NULL) return NULL; - - /* The entered search term is empty "" */ - if (content == NULL || content[0] == '\0') - { - GnomeVFSURI *uri = gnome_vfs_uri_new (address); - if (uri != NULL) - { - char *real_address = g_strconcat ( - gnome_vfs_uri_get_scheme (uri), - "://", - gnome_vfs_uri_get_host_name (uri), - NULL); - gnome_vfs_uri_unref (uri); - - return real_address; - } - } - - /* Either there was a search term, or gnome-vfs URI had a problem */ if (content == NULL) content = ""; result = g_string_new_len (NULL, strlen (content) + strlen (address)); |