#include "dnd.h"
#include "editors.h"
#include "img-view.h"
+#include "filecluster.h"
#include "layout.h"
#include "layout_image.h"
#include "menu.h"
ViewFile *vf = data;
GtkTreePath *tpath;
+ // DO NOT SUBMIT
+ // TODO(xsdg): these key combos should be handled by the standard, configurable mechanism.
+
+ if (event->keyval == GDK_KEY_Insert || event->keyval == GDK_KEY_F2)
+ {
+ // First off, get the selected FDs
+ GList *selected_fds = NULL;
+ {
+ GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(vf->listview));
+ if (event->keyval == GDK_KEY_Insert)
+ {
+ if (gtk_tree_selection_count_selected_rows(selection) < 2)
+ {
+ g_warning("Need at least two items selected to create a cluster.");
+ return TRUE;
+ }
+ }
+ else
+ {
+ if (gtk_tree_selection_count_selected_rows(selection) < 1)
+ {
+ g_warning("Must have a node selected to flip show_children.");
+ return TRUE;
+ }
+ }
+
+ // List of GtkTreePath
+ GList *selected_rows = gtk_tree_selection_get_selected_rows(selection, NULL);
+ GtkTreeModel *store = gtk_tree_view_get_model(GTK_TREE_VIEW(vf->listview));
+ GtkTreeIter iter;
+ for (GList *work = selected_rows; work; work = work->next)
+ {
+ FileData *fd;
+ GtkTreePath *select_path = work->data;
+ gtk_tree_model_get_iter(store, &iter, select_path);
+ gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &fd, -1);
+ selected_fds = g_list_prepend(selected_fds, file_data_ref(fd));
+ }
+
+ selected_fds = g_list_reverse(selected_fds);
+ g_list_free_full(selected_rows, (GDestroyNotify)gtk_tree_path_free);
+ }
+
+ if (event->keyval == GDK_KEY_Insert)
+ {
+ g_warning("Starting a cluster!");
+ FileCluster *fc = fileclusterlist_create_cluster(vf->cluster_list, selected_fds);
+ if (fc)
+ {
+ // TODO(xsdg): mark as in a cluster somehow?
+ vf_refresh(vf);
+ }
+ }
+ else if (event->keyval == GDK_KEY_F2)
+ {
+ FileData *fd = selected_fds->data;
+ if (fd)
+ {
+ g_warning("Flipping show_children!");
+ FileCluster *fc = g_hash_table_lookup(vf->cluster_list->clusters, fd);
+ if (fc)
+ {
+ filecluster_toggle_show_children(fc);
+ vf_refresh(vf);
+ }
+ }
+ }
+
+ return TRUE; // Handled event; stop propagating.
+ }
+
if (event->keyval != GDK_KEY_Menu) return FALSE;
gtk_tree_view_get_cursor(GTK_TREE_VIEW(vf->listview), &tpath, NULL);
return fd;
}
-
-void vflist_thumb_reset_all(ViewFile *vf)
-{
- GList *work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- if (fd->thumb_pixbuf)
- {
- g_object_unref(fd->thumb_pixbuf);
- fd->thumb_pixbuf = NULL;
- }
- work = work->next;
- }
-}
-
/*
*-----------------------------------------------------------------------------
* row stuff
*-----------------------------------------------------------------------------
*/
-FileData *vflist_index_get_data(ViewFile *vf, gint row)
-{
- return g_list_nth_data(vf->list, row);
-}
-
gint vflist_index_by_fd(ViewFile *vf, FileData *fd)
{
gint p = 0;
return -1;
}
-guint vflist_count(ViewFile *vf, gint64 *bytes)
-{
- if (bytes)
- {
- gint64 b = 0;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
- b += fd->size;
- }
-
- *bytes = b;
- }
-
- return g_list_length(vf->list);
-}
-
-GList *vflist_get_list(ViewFile *vf)
-{
- GList *list = NULL;
- GList *work;
-
- work = vf->list;
- while (work)
- {
- FileData *fd = work->data;
- work = work->next;
-
- list = g_list_prepend(list, file_data_ref(fd));
- }
-
- return g_list_reverse(list);
-}
-
/*
*-----------------------------------------------------------------------------
* selections
}
vf->list = file_data_filter_marks_list(vf->list, vf_marks_get_filter(vf));
+ vf->list = fileclusterlist_remove_children_from_list(vf->cluster_list, vf->list);
file_data_register_notify_func(vf_notify_cb, vf, NOTIFY_PRIORITY_MEDIUM);
DEBUG_1("%s vflist_refresh: sort", get_exec_time());