[nautilus/wip/apoos-maximus/gsoc2020: 20/27] properties-window: Stop setting "use_original" data
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/apoos-maximus/gsoc2020: 20/27] properties-window: Stop setting "use_original" data
- Date: Sun, 2 Aug 2020 17:30:00 +0000 (UTC)
commit 99fd55fa8c47cb76570e4de3ba3fc56daaedbffa
Author: Apoorv Sachan <apoorv 99 sachan gmail com>
Date: Sat Jul 11 03:38:09 2020 +0530
properties-window: Stop setting "use_original" data
now, value_field_update() and value_field_update_internal()
are merged into value_filed_update()
src/nautilus-properties-window.c | 79 +++++++++++++---------------------------
1 file changed, 26 insertions(+), 53 deletions(-)
---
diff --git a/src/nautilus-properties-window.c b/src/nautilus-properties-window.c
index e222e8a90..c9072234f 100644
--- a/src/nautilus-properties-window.c
+++ b/src/nautilus-properties-window.c
@@ -1344,18 +1344,42 @@ file_list_all_directories (GList *file_list)
#define INCONSISTENT_STATE_STRING \
"\xE2\x80\x92"
+static gboolean
+location_show_original (NautilusPropertiesWindow *window)
+{
+ NautilusFile *file;
+
+ /* there is no way a recent item will be mixed with
+ * other items so just pick the first file to check */
+ file = NAUTILUS_FILE (g_list_nth_data (window->original_files, 0));
+ return (file != NULL && !nautilus_file_is_in_recent (file));
+}
+
static void
-value_field_update_internal (GtkLabel *label,
- GList *file_list)
+value_field_update (NautilusPropertiesWindow *window,
+ GtkLabel *label)
{
+ GList *file_list;
const char *attribute_name;
char *attribute_value;
char *inconsistent_string;
char *mime_type, *tmp;
+ gboolean is_where;
g_assert (GTK_IS_LABEL (label));
attribute_name = g_object_get_data (G_OBJECT (label), "file_attribute");
+
+ is_where = (g_strcmp0 (attribute_name, "where") == 0);
+ if (is_where && location_show_original (window))
+ {
+ file_list = window->original_files;
+ }
+ else
+ {
+ file_list = window->target_files;
+ }
+
inconsistent_string = INCONSISTENT_STATE_STRING;
attribute_value = file_list_get_string_attribute (file_list,
attribute_name,
@@ -1378,20 +1402,6 @@ value_field_update_internal (GtkLabel *label,
g_free (attribute_value);
}
-static void
-value_field_update (NautilusPropertiesWindow *window,
- GtkLabel *label)
-{
- gboolean use_original;
-
- use_original = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (label), "show_original"));
-
- value_field_update_internal (label,
- (use_original ?
- window->original_files :
- window->target_files));
-}
-
static void
group_change_free (GroupChange *change)
{
@@ -2428,17 +2438,6 @@ should_show_link_target (NautilusPropertiesWindow *window)
return FALSE;
}
-static gboolean
-location_show_original (NautilusPropertiesWindow *window)
-{
- NautilusFile *file;
-
- /* there is no way a recent item will be mixed with
- * other items so just pick the first file to check */
- file = NAUTILUS_FILE (g_list_nth_data (window->original_files, 0));
- return (file != NULL && !nautilus_file_is_in_recent (file));
-}
-
static gboolean
should_show_free_space (NautilusPropertiesWindow *window)
{
@@ -2790,8 +2789,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->type_value_label), "file_attribute",
g_strdup ("detailed_type"), g_free);
- g_object_set_data (G_OBJECT (window->type_value_label), "show_original", GINT_TO_POINTER (FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->type_value_label);
}
@@ -2803,8 +2800,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->link_target_value_label), "file_attribute",
g_strdup ("link_target"), g_free);
- g_object_set_data (G_OBJECT (window->link_target_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->link_target_value_label);
}
@@ -2825,8 +2820,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->size_value_label), "file_attribute",
g_strdup ("size_detail"), g_free);
- g_object_set_data (G_OBJECT (window->size_value_label), "show_original", GINT_TO_POINTER (FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->size_value_label);
}
@@ -2839,8 +2832,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->parent_folder_value_label), "file_attribute",
g_strdup ("where"), g_free);
- g_object_set_data (G_OBJECT (window->parent_folder_value_label), "show_original", GINT_TO_POINTER
(location_show_original (window)));
-
window->value_fields = g_list_prepend (window->value_fields,
window->parent_folder_value_label);
}
@@ -2852,8 +2843,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->original_folder_value_label), "file_attribute",
g_strdup ("trash_orig_path"), g_free);
- g_object_set_data (G_OBJECT (window->original_folder_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->original_folder_value_label);
}
@@ -2865,8 +2854,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->volume_value_label), "file_attribute",
g_strdup ("volume"), g_free);
- g_object_set_data (G_OBJECT (window->volume_value_label), "show_original", GINT_TO_POINTER (FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->volume_value_label);
}
@@ -2878,8 +2865,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->trashed_on_value_label), "file_attribute",
g_strdup ("trashed_on_full"), g_free);
- g_object_set_data (G_OBJECT (window->trashed_on_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->trashed_on_value_label);
}
@@ -2898,8 +2883,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->accessed_value_label), "file_attribute",
g_strdup ("date_accessed_full"), g_free);
- g_object_set_data (G_OBJECT (window->accessed_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->accessed_value_label);
}
@@ -2912,8 +2895,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->modified_value_label), "file_attribute",
g_strdup ("date_modified_full"), g_free);
- g_object_set_data (G_OBJECT (window->modified_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->modified_value_label);
}
@@ -2929,8 +2910,6 @@ create_basic_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->free_space_value_label), "file_attribute",
g_strdup ("free_space"), g_free);
- g_object_set_data (G_OBJECT (window->free_space_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->free_space_value_label);
}
@@ -3899,8 +3878,6 @@ create_simple_permissions (NautilusPropertiesWindow *window,
g_object_set_data_full (G_OBJECT (owner_value_label), "file_attribute",
g_strdup ("owner"), g_free);
- g_object_set_data (G_OBJECT (owner_value_label), "show_original", GINT_TO_POINTER (FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
owner_value_label);
}
@@ -3949,8 +3926,6 @@ create_simple_permissions (NautilusPropertiesWindow *window,
g_object_set_data_full (G_OBJECT (group_value_label), "file_attribute",
g_strdup ("group"), g_free);
- g_object_set_data (G_OBJECT (group_value_label), "show_original", GINT_TO_POINTER (FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
group_value_label);
}
@@ -4322,8 +4297,6 @@ create_permissions_page (NautilusPropertiesWindow *window)
g_object_set_data_full (G_OBJECT (window->security_context_value_label), "file_attribute",
g_strdup ("selinux_context"), g_free);
- g_object_set_data (G_OBJECT (window->security_context_value_label), "show_original", GINT_TO_POINTER
(FALSE));
-
window->value_fields = g_list_prepend (window->value_fields,
window->security_context_value_label);
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]