diff options
author | Raphael Slinckx <rslinckx@cvs.gnome.org> | 2005-09-17 01:51:54 +0800 |
---|---|---|
committer | Raphaƫl Slinckx <rslinckx@src.gnome.org> | 2005-09-17 01:51:54 +0800 |
commit | 60d3fe5725287c2d95e518aec3868b7bb9d7bd7a (patch) | |
tree | 53472749c499f6b2171c27d0b54d334c1a65faca /src/bookmarks/ephy-bookmark-action.c | |
parent | c12bdc7dee5f0521be6e91bdcf09bf88f862d60c (diff) | |
download | gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar.gz gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar.bz2 gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar.lz gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar.xz gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.tar.zst gsoc2013-epiphany-60d3fe5725287c2d95e518aec3868b7bb9d7bd7a.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
Diffstat (limited to 'src/bookmarks/ephy-bookmark-action.c')
-rw-r--r-- | src/bookmarks/ephy-bookmark-action.c | 96 |
1 files changed, 45 insertions, 51 deletions
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 |