]> spindle.queued.net Git - midori/commitdiff
Open bookmarks from the panel as apps or internal consistently
authorChristian Dywan <christian@twotoasts.de>
Wed, 25 Nov 2009 22:55:12 +0000 (23:55 +0100)
committerChristian Dywan <christian@twotoasts.de>
Thu, 26 Nov 2009 22:16:07 +0000 (23:16 +0100)
midori/midori-browser.c
panels/midori-bookmarks.c

index 15c6b475a73014ebd4e5a532bec7f0570f0ab67f..588ca5704445c4bf39ef953dc8dee796844f77e1 100644 (file)
@@ -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));
     }
 }
index dc12c34170310fdabb80ebb086208595bb4a577c..87c02db1ba9774e2e45a26e7b210d10b75d31d82 100644 (file)
@@ -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);
     }