Allow to expand/ collapse folder by double click

This commit is contained in:
Alexander Butenko 2010-07-02 00:23:25 -04:00 committed by Christian Dywan
parent 8306424277
commit 4e0c1396a0
2 changed files with 24 additions and 16 deletions

View file

@ -566,13 +566,20 @@ midori_bookmarks_row_activated_cb (GtkTreeView* treeview,
if (gtk_tree_model_get_iter (model, &iter, path)) if (gtk_tree_model_get_iter (model, &iter, path))
{ {
MidoriBrowser* browser;
gtk_tree_model_get (model, &iter, 0, &item, -1); 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)); browser = midori_browser_get_for_widget (GTK_WIDGET (bookmarks));
midori_browser_open_bookmark (browser, item); 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); g_object_unref (item);
} }
} }

View file

@ -589,26 +589,27 @@ midori_history_row_activated_cb (GtkTreeView* treeview,
GtkTreeModel* model; GtkTreeModel* model;
GtkTreeIter iter; GtkTreeIter iter;
KatzeItem* item; KatzeItem* item;
const gchar* uri;
model = gtk_tree_view_get_model (treeview); model = gtk_tree_view_get_model (treeview);
if (gtk_tree_model_get_iter (model, &iter, path)) if (gtk_tree_model_get_iter (model, &iter, path))
{ {
gtk_tree_model_get (model, &iter, 0, &item, -1); gtk_tree_model_get (model, &iter, 0, &item, -1);
if (KATZE_ITEM_IS_BOOKMARK (item))
if (!item)
return;
uri = katze_item_get_uri (item);
if (uri && *uri)
{ {
MidoriBrowser* browser; MidoriBrowser* browser;
const gchar* uri;
uri = katze_item_get_uri (item);
browser = midori_browser_get_for_widget (GTK_WIDGET (history)); browser = midori_browser_get_for_widget (GTK_WIDGET (history));
midori_browser_set_current_uri (browser, uri); 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); g_object_unref (item);
} }
} }