[Xfce4-commits] [apps/ristretto] 01/01: Show file size in the status bar

noreply at xfce.org noreply at xfce.org
Mon Apr 8 00:31:53 CEST 2019


This is an automated email from the git hooks/post-receive script.

f   2   4   0   4       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 apps/ristretto.

commit 374703d462155f60197bc2d9291b76ae1d91d37c
Author: Igor <f2404 at yandex.ru>
Date:   Sun Apr 7 18:31:13 2019 -0400

    Show file size in the status bar
    
    Fixes bug #14791
---
 src/file.c        | 13 +++++++++++++
 src/file.h        |  3 +++
 src/main_window.c |  5 ++++-
 3 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/src/file.c b/src/file.c
index e638b2d..5d2020f 100644
--- a/src/file.c
+++ b/src/file.c
@@ -462,6 +462,19 @@ rstto_file_get_modified_time ( RsttoFile *r_file )
     return time_;
 }
 
+goffset
+rstto_file_get_size (RsttoFile *r_file )
+{
+    goffset size = 0;
+    GFileInfo *file_info = g_file_query_info (r_file->priv->file, G_FILE_ATTRIBUTE_STANDARD_SIZE, 0, NULL, NULL);
+
+    size = g_file_info_get_size ( file_info );
+
+    g_object_unref (file_info);
+
+    return size;
+}
+
 ExifEntry *
 rstto_file_get_exif ( RsttoFile *r_file, ExifTag id )
 {
diff --git a/src/file.h b/src/file.h
index eb53340..c1cd87b 100644
--- a/src/file.h
+++ b/src/file.h
@@ -101,6 +101,9 @@ rstto_file_get_thumbnail ( RsttoFile *, RsttoThumbnailSize );
 guint64
 rstto_file_get_modified_time ( RsttoFile *);
 
+goffset
+rstto_file_get_size ( RsttoFile * );
+
 ExifEntry *
 rstto_file_get_exif ( RsttoFile *, ExifTag );
 
diff --git a/src/main_window.c b/src/main_window.c
index 44c43fe..252f3d8 100644
--- a/src/main_window.c
+++ b/src/main_window.c
@@ -1573,11 +1573,14 @@ rstto_main_window_update_statusbar (RsttoMainWindow *window)
 
                 if(rstto_image_viewer_get_width(viewer) != 0 && rstto_image_viewer_get_height(viewer) != 0)
                 {
-                    tmp_status = g_strdup_printf ("%s\t%d x %d\t%.1f%%", status,
+                    gchar *size_string = g_format_size(rstto_file_get_size(cur_file));
+                    tmp_status = g_strdup_printf ("%s\t%d x %d\t%s\t%.1f%%", status,
                                                 rstto_image_viewer_get_width(viewer),
                                                 rstto_image_viewer_get_height(viewer),
+                                                size_string,
                                                 (100 * rstto_image_viewer_get_scale(viewer)));
 
+                    g_free (size_string);
                     g_free (status);
                     status = tmp_status;
                 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list