#include "dnd.h"
#include "editors.h"
#include "img-view.h"
+#include "filecluster.h"
#include "filedata.h"
#include "layout.h"
#include "layout_image.h"
vf->popup = vf_pop_menu(vf);
gtk_menu_popup(GTK_MENU(vf->popup), NULL, NULL, vfi_menu_position_cb, vf, 0, GDK_CURRENT_TIME);
break;
+ case GDK_KEY_Insert:
+ // DO NOT SUBMIT
+ // TODO(xsdg): make an actual UX for this.
+ g_warning("Starting a cluster!");
+ fd = vficon_find_data(vf, VFICON(vf)->focus_row, VFICON(vf)->focus_column, NULL);
+ if (fd)
+ {
+ // Make a cluster out of the entire selection
+ if (VFICON(vf)->selection && VFICON(vf)->selection->next)
+ {
+ FileCluster *fc;
+ // At least two items selected; go for it.
+ g_warning("Had requisite number of selection items; going for it!");
+ fc = fileclusterlist_create_cluster(vf->cluster_list, VFICON(vf)->selection);
+ if (fc)
+ {
+ // TODO(xsdg): set CLUSTER_CHILD
+ vficon_selection_add(vf, VFICON(vf)->selection->data, SELECTION_CLUSTER_HEAD, NULL);
+ vf_refresh(vf);
+ }
+ }
+ else
+ {
+ if (VFICON(vf)->selection)
+ {
+ g_warning("Only one item selected; need at least two.");
+ }
+ else
+ {
+ g_warning("No items selected; need at least two.");
+ }
+ }
+ }
+ break;
+ case GDK_KEY_F2:
+ g_warning("Flipping show_children!");
+ fd = vficon_find_data(vf, VFICON(vf)->focus_row, VFICON(vf)->focus_column, NULL);
+ if (fd)
+ {
+ FileCluster *fc = g_hash_table_lookup(vf->cluster_list->clusters, fd);
+ if (fc)
+ {
+ filecluster_toggle_show_children(fc);
+ vf_refresh(vf);
+ }
+ }
+ break;
default:
stop_signal = FALSE;
break;
while (valid && tree_view_row_get_visibility(GTK_TREE_VIEW(vf->listview), &iter, FALSE) == 0)
{
GList *list;
-
gtk_tree_model_get(store, &iter, FILE_COLUMN_POINTER, &list, -1);
// TODO(xsdg): for loop here.
}
/* Then iterate through the entire list to load all of them. */
- for (GList *work = vf->list; work; work = work->next)
+ GList *work;
+ for (work = vf->list; work; work = work->next)
{
FileData *fd = work->data;
return NULL;
}
-void vficon_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 *vficon_index_get_data(ViewFile *vf, gint row)
-{
- FileData *fd;
-
- fd = g_list_nth_data(vf->list, row);
- return fd ? fd : NULL;
-}
-
-
gint vficon_index_by_fd(ViewFile *vf, FileData *in_fd)
{
gint p = 0;
return -1;
}
-guint vficon_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 *vficon_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);
-}
-
/*
*-----------------------------------------------------------------------------
*
{
ret = filelist_read(vf->dir_fd, &new_filelist, NULL);
new_filelist = file_data_filter_marks_list(new_filelist, vf_marks_get_filter(vf));
+ new_filelist = fileclusterlist_remove_children_from_list(vf->cluster_list, new_filelist);
}
- vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend); /* the list might not be sorted if there were renames */
+ /* the list might not be sorted if there were renames */
+ vf->list = filelist_sort(vf->list, vf->sort_method, vf->sort_ascend);
new_filelist = filelist_sort(new_filelist, vf->sort_method, vf->sort_ascend);
if (VFICON(vf)->selection)
memcpy(&color_fg, &style->text[state], sizeof(color_fg));
memcpy(&color_bg, &style->base[state], sizeof(color_bg));
+ if (fd->selected & SELECTION_CLUSTER_HEAD)
+ {
+ // TODO(xsdg): Cluster coloration should be part of the style.
+ color_bg.blue = 0x4000;
+ color_bg.green = 0x4000;
+ color_bg.red = 0xFFFF;
+ }
+ else if (fd->selected & SELECTION_CLUSTER_CHILD)
+ {
+ // TODO(xsdg): Cluster coloration should be part of the style.
+ color_bg.blue = 0x8000;
+ color_bg.green = 0x8000;
+ color_bg.red = 0xFFFF;
+ }
+
if (fd->selected & SELECTION_PRELIGHT)
{
shift_color(&color_bg, -1, 0);