This is an automated email from the git hooks/post-receive script. a l e x p u s h e d a c o m m i t t o b r a n c h m a s t e r in repository xfce/thunar.
commit a5071b6a31d90c4686891ba4a79e9ff05944e3c0 Author: Adam Purkrt <a...@purkrt.net> Date: Fri Feb 2 23:51:47 2018 +0100 Add setting to show file size in bytes in detailed view (Bug #11690) --- thunar/thunar-details-view.c | 2 +- thunar/thunar-enum-types.c | 1 + thunar/thunar-enum-types.h | 2 ++ thunar/thunar-file.c | 19 +++++++++++++++++++ thunar/thunar-file.h | 1 + thunar/thunar-list-model.c | 27 +++++++++++++++++++++++++++ thunar/thunar-preferences.c | 2 +- 7 files changed, 52 insertions(+), 2 deletions(-) diff --git a/thunar/thunar-details-view.c b/thunar/thunar-details-view.c index 4dc4615..8029461 100644 --- a/thunar/thunar-details-view.c +++ b/thunar/thunar-details-view.c @@ -279,7 +279,7 @@ thunar_details_view_init (ThunarDetailsView *details_view) else { /* size is right aligned, everything else is left aligned */ - renderer = (column == THUNAR_COLUMN_SIZE) ? right_aligned_renderer : left_aligned_renderer; + renderer = (column == THUNAR_COLUMN_SIZE || column == THUNAR_COLUMN_SIZE_IN_BYTES) ? right_aligned_renderer : left_aligned_renderer; /* add the renderer */ gtk_tree_view_column_pack_start (details_view->columns[column], renderer, TRUE); diff --git a/thunar/thunar-enum-types.c b/thunar/thunar-enum-types.c index 6bfc7b8..5585f4a 100644 --- a/thunar/thunar-enum-types.c +++ b/thunar/thunar-enum-types.c @@ -97,6 +97,7 @@ thunar_column_get_type (void) { THUNAR_COLUMN_OWNER, "THUNAR_COLUMN_OWNER", N_ ("Owner"), }, { THUNAR_COLUMN_PERMISSIONS, "THUNAR_COLUMN_PERMISSIONS", N_ ("Permissions"), }, { THUNAR_COLUMN_SIZE, "THUNAR_COLUMN_SIZE", N_ ("Size"), }, + { THUNAR_COLUMN_SIZE_IN_BYTES, "THUNAR_COLUMN_SIZE_IN_BYTES", N_ ("Size in Bytes"), }, { THUNAR_COLUMN_TYPE, "THUNAR_COLUMN_TYPE", N_ ("Type"), }, { THUNAR_COLUMN_FILE, "THUNAR_COLUMN_FILE", N_ ("File"), }, { THUNAR_COLUMN_FILE_NAME, "THUNAR_COLUMN_FILE_NAME", N_ ("File Name"), }, diff --git a/thunar/thunar-enum-types.h b/thunar/thunar-enum-types.h index 9fb34a7..83103bc 100644 --- a/thunar/thunar-enum-types.h +++ b/thunar/thunar-enum-types.h @@ -80,6 +80,7 @@ GType thunar_date_style_get_type (void) G_GNUC_CONST; * @THUNAR_COLUMN_OWNER : owner's name. * @THUNAR_COLUMN_PERMISSIONS : permissions bits. * @THUNAR_COLUMN_SIZE : file size. + * @THUNAR_COLUMN_SIZE_IN_BYTES : file size in bytes. * @THUNAR_COLUMN_TYPE : file type (i.e. 'plain text document'). * @THUNAR_COLUMN_FILE : #ThunarFile object. * @THUNAR_COLUMN_FILE_NAME : real file name. @@ -98,6 +99,7 @@ typedef enum THUNAR_COLUMN_OWNER, THUNAR_COLUMN_PERMISSIONS, THUNAR_COLUMN_SIZE, + THUNAR_COLUMN_SIZE_IN_BYTES, THUNAR_COLUMN_TYPE, /* special internal columns */ diff --git a/thunar/thunar-file.c b/thunar/thunar-file.c index 6762e7d..5348484 100644 --- a/thunar/thunar-file.c +++ b/thunar/thunar-file.c @@ -2297,6 +2297,25 @@ thunar_file_get_size_string (const ThunarFile *file) /** + * thunar_file_get_size_in_bytes_string: + * @file : a #ThunarFile instance. + * + * Returns the size in bytes of the file as text. + * You'll need to free the result using g_free() + * if you're done with it. + * + * Return value: the size of @file in a human readable format. + **/ +gchar * +thunar_file_get_size_in_bytes_string (const ThunarFile *file) +{ + _thunar_return_val_if_fail (THUNAR_IS_FILE (file), NULL); + return g_strdup_printf ("%'"G_GUINT64_FORMAT, thunar_file_get_size (file)); +} + + + +/** * thunar_file_get_size_string_formatted: * @file : a #ThunarFile instance. * @file_size_binary : indicates if file size format diff --git a/thunar/thunar-file.h b/thunar/thunar-file.h index 7ddd873..f16a3e3 100644 --- a/thunar/thunar-file.h +++ b/thunar/thunar-file.h @@ -168,6 +168,7 @@ gchar *thunar_file_get_date_string (const ThunarFile ThunarDateStyle date_style) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; gchar *thunar_file_get_mode_string (const ThunarFile *file) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; gchar *thunar_file_get_size_string (const ThunarFile *file) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; +gchar *thunar_file_get_size_in_bytes_string (const ThunarFile *file) G_GNUC_MALLOC G_GNUC_WARN_UNUSED_RESULT; gchar *thunar_file_get_size_string_formatted (const ThunarFile *file, const gboolean file_size_binary); diff --git a/thunar/thunar-list-model.c b/thunar/thunar-list-model.c index 4c2b76b..f2357f9 100644 --- a/thunar/thunar-list-model.c +++ b/thunar/thunar-list-model.c @@ -172,6 +172,9 @@ static gint sort_by_permissions (const ThunarF static gint sort_by_size (const ThunarFile *a, const ThunarFile *b, gboolean case_sensitive); +static gint sort_by_size_in_bytes (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive); static gint sort_by_type (const ThunarFile *a, const ThunarFile *b, gboolean case_sensitive); @@ -594,6 +597,9 @@ thunar_list_model_get_column_type (GtkTreeModel *model, case THUNAR_COLUMN_SIZE: return G_TYPE_STRING; + case THUNAR_COLUMN_SIZE_IN_BYTES: + return G_TYPE_STRING; + case THUNAR_COLUMN_TYPE: return G_TYPE_STRING; @@ -750,6 +756,11 @@ thunar_list_model_get_value (GtkTreeModel *model, g_value_take_string (value, thunar_file_get_size_string_formatted (file, THUNAR_LIST_MODEL (model)->file_size_binary)); break; + case THUNAR_COLUMN_SIZE_IN_BYTES: + g_value_init (value, G_TYPE_STRING); + g_value_take_string (value, thunar_file_get_size_in_bytes_string (file)); + break; + case THUNAR_COLUMN_TYPE: g_value_init (value, G_TYPE_STRING); if (G_UNLIKELY (thunar_file_is_symlink (file))) @@ -909,6 +920,8 @@ thunar_list_model_get_sort_column_id (GtkTreeSortable *sortable, *sort_column_id = THUNAR_COLUMN_PERMISSIONS; else if (store->sort_func == sort_by_size) *sort_column_id = THUNAR_COLUMN_SIZE; + else if (store->sort_func == sort_by_size_in_bytes) + *sort_column_id = THUNAR_COLUMN_SIZE_IN_BYTES; else if (store->sort_func == sort_by_date_accessed) *sort_column_id = THUNAR_COLUMN_DATE_ACCESSED; else if (store->sort_func == sort_by_date_modified) @@ -979,6 +992,10 @@ thunar_list_model_set_sort_column_id (GtkTreeSortable *sortable, store->sort_func = sort_by_size; break; + case THUNAR_COLUMN_SIZE_IN_BYTES: + store->sort_func = sort_by_size_in_bytes; + break; + case THUNAR_COLUMN_TYPE: store->sort_func = sort_by_type; break; @@ -1563,6 +1580,16 @@ sort_by_size (const ThunarFile *a, static gint +sort_by_size_in_bytes (const ThunarFile *a, + const ThunarFile *b, + gboolean case_sensitive) +{ + return sort_by_size (a, b, case_sensitive); +} + + + +static gint sort_by_type (const ThunarFile *a, const ThunarFile *b, gboolean case_sensitive) diff --git a/thunar/thunar-preferences.c b/thunar/thunar-preferences.c index 9a86ae1..1ce996a 100644 --- a/thunar/thunar-preferences.c +++ b/thunar/thunar-preferences.c @@ -221,7 +221,7 @@ thunar_preferences_class_init (ThunarPreferencesClass *klass) g_param_spec_string ("last-details-view-column-order", "LastDetailsViewColumnOrder", NULL, - "THUNAR_COLUMN_NAME,THUNAR_COLUMN_SIZE,THUNAR_COLUMN_TYPE,THUNAR_COLUMN_DATE_MODIFIED", + "THUNAR_COLUMN_NAME,THUNAR_COLUMN_SIZE,THUNAR_COLUMN_SIZE_IN_BYTES,THUNAR_COLUMN_TYPE,THUNAR_COLUMN_DATE_MODIFIED", EXO_PARAM_READWRITE); /** -- To stop receiving notification emails like this one, please contact the administrator of this repository. _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits