diff --git a/midori/midori-browser.c b/midori/midori-browser.c index 15c6b475..588ca570 100644 --- a/midori/midori-browser.c +++ b/midori/midori-browser.c @@ -2866,16 +2866,20 @@ _action_bookmarks_populate_popup (GtkAction* action, gtk_widget_show (menuitem); } -static void +/* static */ void midori_browser_open_bookmark (MidoriBrowser* browser, KatzeItem* item) { + const gchar* uri = katze_item_get_uri (item); + if (!(uri && *uri)) + return; + /* FIXME: Use the same binary that is running right now */ if (katze_item_get_meta_integer (item, "app") != -1) - sokoke_spawn_program ("midori -a", katze_item_get_uri (item), FALSE); + sokoke_spawn_program ("midori -a", uri, FALSE); else { - midori_browser_set_current_uri (browser, katze_item_get_uri (item)); + midori_browser_set_current_uri (browser, uri); gtk_widget_grab_focus (midori_browser_get_current_tab (browser)); } } diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index dc12c341..87c02db1 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -32,6 +32,10 @@ midori_browser_edit_bookmark_dialog_new (MidoriBrowser* browser, gboolean new_bookmark, gboolean is_folder); +void +midori_browser_open_bookmark (MidoriBrowser* browser, + KatzeItem* item); + struct _MidoriBookmarks { GtkVBox parent_instance; @@ -601,19 +605,17 @@ midori_bookmarks_row_activated_cb (GtkTreeView* treeview, GtkTreeModel* model; GtkTreeIter iter; KatzeItem* item; - const gchar* uri; model = gtk_tree_view_get_model (treeview); if (gtk_tree_model_get_iter (model, &iter, path)) { + MidoriBrowser* browser; + gtk_tree_model_get (model, &iter, 0, &item, -1); - uri = katze_item_get_uri (item); - if (uri && *uri) - { - MidoriBrowser* browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); - midori_browser_set_current_uri (browser, uri); - } + + browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks)); + midori_browser_open_bookmark (browser, item); g_object_unref (item); }