From f60db2013a1ab6a0bae904e6bc2a59ba01711747 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Wed, 29 Jan 2025 21:17:58 +0100 Subject: [PATCH] save current number of selected items --- mizunara/gtk-filesview.c | 8 +++++++- mizunara/gtk-filesview.h | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/mizunara/gtk-filesview.c b/mizunara/gtk-filesview.c index c035167..52fb8a0 100644 --- a/mizunara/gtk-filesview.c +++ b/mizunara/gtk-filesview.c @@ -262,7 +262,7 @@ void mz_files_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot) { int img_y_offset = (item_height - img_alloc.height - label_alloc.height) / 2; int label_x_offset = (item_width - label_alloc.width) / 2; - + size_t selection_count = 0; int x = 0; int y = 0; @@ -285,6 +285,7 @@ void mz_files_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot) { gtk_snapshot_append_node(snapshot, highlight_clip_node); } else { view->items[i].isselected = 1; + selection_count++; } } else if (view->update_selection == 1) { view->items[i].isselected = 0; @@ -324,6 +325,11 @@ void mz_files_view_snapshot(GtkWidget *widget, GtkSnapshot *snapshot) { y++; } } + + if(view->update_selection) { + view->selection_count = selection_count; + printf("selection_count: %d\n", (int)selection_count); + } } // draw children diff --git a/mizunara/gtk-filesview.h b/mizunara/gtk-filesview.h index 423f778..fd2f5ba 100644 --- a/mizunara/gtk-filesview.h +++ b/mizunara/gtk-filesview.h @@ -64,7 +64,9 @@ typedef struct MzFilesView { int current_width; MzViewSection *sections; size_t numsections; - + + size_t selection_count; + int highlight_col; int highlight_row; -- 2.43.5