From: Alexander Butenko Date: Fri, 2 Jul 2010 04:23:25 +0000 (-0400) Subject: Allow to expand/ collapse folder by double click X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4e0c1396a094ba47cdcf3f80040b5a7777c5177d;p=midori Allow to expand/ collapse folder by double click --- diff --git a/panels/midori-bookmarks.c b/panels/midori-bookmarks.c index 286524ca..0604fcd4 100644 --- a/panels/midori-bookmarks.c +++ b/panels/midori-bookmarks.c @@ -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); } } diff --git a/panels/midori-history.c b/panels/midori-history.c index c5691d0a..809fb25e 100644 --- a/panels/midori-history.c +++ b/panels/midori-history.c @@ -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); } }