[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, 13 Dec 2016 15:27:19 +0000 (UTC)
commit 830552cf624f7edda0b42ebe4471c7e41eccd287
Author: Carlos Soriano <csoriano gnome org>
Date: Tue Dec 13 16:26:40 2016 +0100
f
src/nautilus-view-icon-controller.c | 14 +++++++-------
src/nautilus-view-model.c | 26 +++++++++++++++++---------
src/nautilus-view-model.h | 2 ++
3 files changed, 26 insertions(+), 16 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index 9a9be01..be14659 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -99,7 +99,7 @@ real_remove_file (NautilusFilesView *files_view,
NautilusViewItemModel *current_item_model;
guint i = 0;
- while ((current_item_model = NAUTILUS_VIEW_ITEM_MODEL (g_list_model_get_item (self->model, i))))
+ while ((current_item_model = NAUTILUS_VIEW_ITEM_MODEL (g_list_model_get_item
(nautilus_view_model_get_g_model (self->model), i))))
{
current_file = nautilus_view_item_model_get_file (current_item_model);
if (current_file == file)
@@ -379,7 +379,7 @@ static const SortConstants sorts_constants[] =
}
};
-static SortConstants *
+static SortConstants
get_sort_constants_from_action_target_name (const gchar *action_target_name)
{
int i;
@@ -400,15 +400,15 @@ action_sort_order_changed (GSimpleAction *action,
gpointer user_data)
{
const gchar *target_name;
- SortConstants *sort_constants;
+ SortConstants sort_constants;
NautilusViewModelSortData sort_data;
+ NautilusViewIconController *self;
- g_assert (NAUTILUS_IS_CANVAS_VIEW (user_data));
-
+ self = NAUTILUS_VIEW_ICON_CONTROLLER (user_data);
target_name = g_variant_get_string (value, NULL);
sort_constants = get_sort_constants_from_action_target_name (target_name);
sort_data.sort_type = sort_constants.sort_type;
- sort_data.reverse = sort_constants.reverse;
+ sort_data.reversed = sort_constants.reversed;
sort_data.directories_first = nautilus_files_view_should_sort_directories_first (NAUTILUS_FILES_VIEW
(self));
nautilus_view_model_set_sort_type (self->model, &sort_data);
@@ -510,6 +510,7 @@ constructed (GObject *object)
view_icon_actions,
G_N_ELEMENTS (view_icon_actions),
self);
+ self->zoom_level = get_default_zoom_level (self);
/* Keep the action synced with the actual value, so the toolbar can poll it */
g_action_group_change_action_state (nautilus_files_view_get_action_group (NAUTILUS_FILES_VIEW (self)),
"zoom-to-level", g_variant_new_int32 (self->zoom_level));
@@ -574,4 +575,3 @@ nautilus_view_icon_controller_get_model (NautilusViewIconController *self)
return self->model;
}
-
diff --git a/src/nautilus-view-model.c b/src/nautilus-view-model.c
index dbf3b27..442c305 100644
--- a/src/nautilus-view-model.c
+++ b/src/nautilus-view-model.c
@@ -4,10 +4,12 @@
struct _NautilusViewModel
{
- Gobject parent_instance;
+ GObject parent_instance;
GListStore *internal_model;
- NautilusViewModelSortData *sort_data;
+ NautilusFileSortType sort_type;
+ gboolean reverse;
+ gboolean directories_first;
};
G_DEFINE_TYPE (NautilusViewModel, nautilus_view_model, G_TYPE_OBJECT)
@@ -37,7 +39,7 @@ get_property (GObject *object,
{
case PROP_SORT_TYPE:
{
- g_value_set_object (value, self->sort_type);
+ g_value_set_enum (value, self->sort_type);
}
break;
@@ -112,13 +114,13 @@ compare_data_func (gconstpointer a,
NautilusFile *file_a;
NautilusFile *file_b;
- file_a = nautilus_view_item_model_get_file (NAUTILUS_VIEW_ITEM_MODEL (a));
- file_b = nautilus_view_item_model_get_file (NAUTILUS_VIEW_ITEM_MODEL (a));
+ file_a = nautilus_view_item_model_get_file (NAUTILUS_VIEW_ITEM_MODEL ((gpointer) a));
+ file_b = nautilus_view_item_model_get_file (NAUTILUS_VIEW_ITEM_MODEL ((gpointer) a));
return nautilus_file_compare_for_sort (file_a, file_b,
- self->sort_data->sort_type,
- self->sort_data->sort_reversed,
- self->sort_data->sort_directories_first);
+ self->sort_type,
+ self->reversed,
+ self->directories_first);
}
NautilusViewModel *
@@ -129,7 +131,7 @@ nautilus_view_model_new ()
void
nautilus_view_model_set_sort_type (NautilusViewModel *self,
- NautilusViewModelSortData *sort_data);
+ NautilusViewModelSortData *sort_data)
{
if (self->sort_data)
{
@@ -143,3 +145,9 @@ nautilus_view_model_set_sort_type (NautilusViewModel *self,
g_list_store_sort (self, compare_data_func, self);
}
+
+GListStore *
+nautilus_view_model_get_g_model (NautilusViewModel *self)
+{
+ return self->internal_model;
+}
diff --git a/src/nautilus-view-model.h b/src/nautilus-view-model.h
index d9bd1a5..2d6aaed 100644
--- a/src/nautilus-view-model.h
+++ b/src/nautilus-view-model.h
@@ -22,6 +22,8 @@ NautilusViewModel * nautilus_view_model_new (void);
void nautilus_view_model_set_sort_type (NautilusViewModel *self,
NautilusViewModelSortData *sort_data);
+GListStore * nautilus_view_model_get_g_model (NautilusViewModel *self);
+
G_END_DECLS
#endif /* NAUTILUS_VIEW_MODEL_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]