diff options
author | Denis Ollier <larchunix@users.noreply.github.com> | 2018-07-22 13:01:10 +0300 |
---|---|---|
committer | Denis Ollier <larchunix@users.noreply.github.com> | 2018-07-22 13:01:10 +0300 |
commit | 0bf3f816576b7b3f614fdf085c77059c86a618c5 (patch) | |
tree | 8a9ec3d31e1e7ab0281f3c140627f6ba62a3a169 | |
parent | 782218632180077c7d38fc0a138809980933e5d9 (diff) |
sftp: use glib's g_format_size_full() to compute file size
Bump glib version requirement to 2.30.
-rw-r--r-- | cmake/FindGLIB2.cmake | 4 | ||||
-rw-r--r-- | src/remmina_ftp_client.c | 12 |
2 files changed, 3 insertions, 13 deletions
diff --git a/cmake/FindGLIB2.cmake b/cmake/FindGLIB2.cmake index 2e9c07b05..139e6ec9f 100644 --- a/cmake/FindGLIB2.cmake +++ b/cmake/FindGLIB2.cmake @@ -14,14 +14,14 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Foundation, Inc., 51 Franklin Street, Fifth Floor, # Boston, MA 02110-1301, USA. set(_GLIB_found_all true) # Glib -pkg_check_modules(PC_GLIB2 glib-2.0>=2.28) +pkg_check_modules(PC_GLIB2 glib-2.0>=2.30) if(NOT PC_GLIB2_FOUND) set(_GLIB_found_all false) diff --git a/src/remmina_ftp_client.c b/src/remmina_ftp_client.c index f1cfc0884..b89c5e73a 100644 --- a/src/remmina_ftp_client.c +++ b/src/remmina_ftp_client.c @@ -237,18 +237,8 @@ static gchar* remmina_ftp_client_size_to_str(gfloat size) { TRACE_CALL(__func__); - gchar *str; - if (size < 1024.0) { - str = g_strdup_printf("%i", (gint)size); - }else if (size < 1024.0 * 1024.0) { - str = g_strdup_printf("%iK", (gint)(size / 1024.0)); - }else if (size < 1024.0 * 1024.0 * 1024.0) { - str = g_strdup_printf("%.1fM", size / 1024.0 / 1024.0); - }else { - str = g_strdup_printf("%.1fG", size / 1024.0 / 1024.0 / 1024.0); - } - return str; + return g_format_size_full((guint64)size, G_FORMAT_SIZE_IEC_UNITS); } static void remmina_ftp_client_cell_data_size(GtkTreeViewColumn *col, GtkCellRenderer *renderer, GtkTreeModel *model, |