]> spindle.queued.net Git - midori/commitdiff
Allow to expand/ collapse folder by double click
authorAlexander Butenko <a.butenka@gmail.com>
Fri, 2 Jul 2010 04:23:25 +0000 (00:23 -0400)
committerChristian Dywan <christian@twotoasts.de>
Fri, 2 Jul 2010 21:17:05 +0000 (23:17 +0200)
panels/midori-bookmarks.c
panels/midori-history.c

index 286524ca7b141b7211356a3cc2d32433b844bf78..0604fcd45f57c20bfff8239e2805515c4c79f672 100644 (file)
@@ -566,13 +566,20 @@ midori_bookmarks_row_activated_cb (GtkTreeView*       treeview,
 
     if (gtk_tree_model_get_iter (model, &iter, path))
     {
-        MidoriBrowser* browser;
-
         gtk_tree_model_get (model, &iter, 0, &item, -1);
+        if (KATZE_ITEM_IS_BOOKMARK (item))
+        {
+            MidoriBrowser* browser;
 
-        browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
-        midori_browser_open_bookmark (browser, item);
-
+            browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
+            midori_browser_open_bookmark (browser, item);
+            g_object_unref (item);
+            return;
+        }
+        if (gtk_tree_view_row_expanded (treeview, path))
+            gtk_tree_view_collapse_row (treeview, path);
+        else
+            gtk_tree_view_expand_row (treeview, path, FALSE);
         g_object_unref (item);
     }
 }
index c5691d0a3abcbf73fd70078f36f243436ac5bf67..809fb25e73b1e7f25edef2248419c62b13123530 100644 (file)
@@ -582,33 +582,34 @@ midori_history_treeview_render_icon_cb (GtkTreeViewColumn* column,
 #if HAVE_SQLITE
 static void
 midori_history_row_activated_cb (GtkTreeView*       treeview,
-                                   GtkTreePath*       path,
-                                   GtkTreeViewColumn* column,
-                                   MidoriHistory*   history)
+                                 GtkTreePath*       path,
+                                 GtkTreeViewColumn* column,
+                                 MidoriHistory*     history)
 {
     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))
     {
         gtk_tree_model_get (model, &iter, 0, &item, -1);
-
-        if (!item)
-            return;
-
-        uri = katze_item_get_uri (item);
-        if (uri && *uri)
+        if (KATZE_ITEM_IS_BOOKMARK (item))
         {
             MidoriBrowser* browser;
+            const gchar* uri;
 
+            uri = katze_item_get_uri (item);
             browser = midori_browser_get_for_widget (GTK_WIDGET (history));
             midori_browser_set_current_uri (browser, uri);
+            g_object_unref (item);
+            return;
         }
-
+        if (gtk_tree_view_row_expanded (treeview, path))
+            gtk_tree_view_collapse_row (treeview, path);
+        else
+            gtk_tree_view_expand_row (treeview, path, FALSE);
         g_object_unref (item);
     }
 }