[nautilus/wip/csoriano/flow] f
- From: Carlos Soriano <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/csoriano/flow] f
- Date: Tue, 17 Jan 2017 15:24:54 +0000 (UTC)
commit 1a8799d017dbf8b579d38830f9727ae20b0b319b
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Jan 17 16:24:37 2017 +0100
f
src/nautilus-view-icon-controller.c | 30 +++++++++++++++++++++++++++++-
src/nautilus-view-model.c | 22 ++++++++++++++++++++++
src/nautilus-view-model.h | 3 +++
3 files changed, 54 insertions(+), 1 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index c84f292..87e4368 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -263,7 +263,19 @@ real_file_changed (NautilusFilesView *files_view,
static GList *
real_get_selection (NautilusFilesView *files_view)
{
- return NULL;
+ NautilusViewIconController *self;
+ GList *selected_files = NULL;
+ GList *l;
+ g_autoptr (GQueue) selected_items = NULL;
+
+ self = NAUTILUS_VIEW_ICON_CONTROLLER (files_view);
+ selected_items = nautilus_view_model_get_selected (self->model);
+ for (l = g_queue_peek_head_link (selected_items); l != NULL; l = l->next)
+ {
+ selected_files = g_list_prepend (selected_files, l->data);
+ }
+
+ return selected_files;
}
@@ -557,6 +569,20 @@ real_click_policy_changed (NautilusFilesView *files_view)
{
}
+static gboolean
+on_button_press_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ NautilusViewIconController *self;
+
+ self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
+
+ nautilus_files_view_pop_up_selection_context_menu (NAUTILUS_FILES_VIEW (self),
+ (GdkEventButton *) event);
+ return FALSE;
+}
+
static int
real_compare_files (NautilusFilesView *files_view,
NautilusFile *file1,
@@ -732,6 +758,8 @@ constructed (GObject *object)
self->model = nautilus_view_model_new ();
self->view_ui = nautilus_view_icon_ui_new (self);
+ g_signal_connect_after (GTK_WIDGET (self->view_ui), "button-press-event",
+ (GCallback) on_button_press_event, self);
gtk_widget_show (GTK_WIDGET (self->view_ui));
self->view_icon = g_themed_icon_new ("view-grid-symbolic");
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index a3ac7a8..d3f2ca3 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -223,6 +223,28 @@ nautilus_view_model_set_selected (NautilusViewModel *self,
}
}
+GQueue *
+nautilus_view_model_get_selected (NautilusViewModel *self)
+{
+ NautilusViewItemModel *item_model;
+ GQueue *selected_items;
+ gint i;
+
+ i = 0;
+ selected_items = g_queue_new ();
+ while ((item_model = g_list_model_get_item (G_LIST_MODEL(self->internal_model), i)))
+ {
+ if (nautilus_view_item_model_get_is_selected (item_model))
+ {
+ g_queue_push_tail (selected_items,
+ g_object_ref (nautilus_view_item_model_get_file (item_model)));
+ }
+ i++;
+ }
+
+ return selected_items;
+}
+
static gpointer *
convert_gqueue_to_array (NautilusViewModel *self,
GQueue *queue)
diff --git a/src/nautilus-view-model.h b/src/nautilus-view-model.h
index 5f640cb..ed20f04 100644
--- a/src/nautilus-view-model.h
+++ b/src/nautilus-view-model.h
@@ -26,8 +26,11 @@ NautilusViewModelSortData * nautilus_view_model_get_sort_type (NautilusViewModel
GListStore * nautilus_view_model_get_g_model (NautilusViewModel *self);
GQueue * nautilus_view_model_get_item_models_from_files (NautilusViewModel *self,
GQueue *files);
+
void nautilus_view_model_set_selected (NautilusViewModel *self,
GQueue *item_models);
+GQueue * nautilus_view_model_get_selected (NautilusViewModel *self);
+
void nautilus_view_model_set_items (NautilusViewModel *self,
GQueue *items);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]