[balsa/gtk3] Use g_format_size()
- From: Peter Bloomfield <PeterB src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa/gtk3] Use g_format_size()
- Date: Sun, 21 Aug 2011 23:09:20 +0000 (UTC)
commit 369a5cfbc5b1ac4f98aa126087c92fd84965afe8
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sun Aug 21 19:07:50 2011 -0400
Use g_format_size()
* libbalsa/libbalsa-vfs.c (libbalsa_vfs_get_size): get size as
guint64.
* libbalsa/libbalsa-vfs.h: ditto.
* src/sendmsg-window.c (add_attachment), (add_urlref_attachment),
(create_info_pane): ditto;
(render_attach_size): use g_format_size() instead of deprecated
g_format_size_for_display().
ChangeLog | 10 ++++++++++
libbalsa/libbalsa-vfs.c | 10 ++++------
libbalsa/libbalsa-vfs.h | 2 +-
src/sendmsg-window.c | 12 ++++++++----
4 files changed, 23 insertions(+), 11 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6b8f322..0570d28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
2011-08-21 Peter Bloomfield
+ * libbalsa/libbalsa-vfs.c (libbalsa_vfs_get_size): get size as
+ guint64.
+ * libbalsa/libbalsa-vfs.h: ditto.
+ * src/sendmsg-window.c (add_attachment), (add_urlref_attachment),
+ (create_info_pane): ditto;
+ (render_attach_size): use g_format_size() instead of deprecated
+ g_format_size_for_display().
+
+2011-08-21 Peter Bloomfield
+
* libbalsa/address-view.c (lbav_ensure_blank_line_idle_cb):
remove irrelevant comment.
* src/sendmsg-window.c (create_info_pane): create "Reply-To:"
diff --git a/libbalsa/libbalsa-vfs.c b/libbalsa/libbalsa-vfs.c
index 8313044..c892a9c 100644
--- a/libbalsa/libbalsa-vfs.c
+++ b/libbalsa/libbalsa-vfs.c
@@ -462,10 +462,9 @@ libbalsa_vfs_get_text_attr(const LibbalsaVfs * file)
}
-gsize
+guint64
libbalsa_vfs_get_size(const LibbalsaVfs * file)
{
- gsize retval = 0;
struct _LibbalsaVfsPriv * priv;
g_return_val_if_fail(file, 0);
@@ -481,11 +480,10 @@ libbalsa_vfs_get_size(const LibbalsaVfs * file)
g_file_query_info(priv->gio_gfile, GIO_INFO_ATTS,
G_FILE_QUERY_INFO_NONE, NULL, NULL);
if (priv->info)
- retval =
- (gsize) g_file_info_get_attribute_uint64(priv->info,
- G_FILE_ATTRIBUTE_STANDARD_SIZE);
+ return g_file_info_get_attribute_uint64(priv->info,
+ G_FILE_ATTRIBUTE_STANDARD_SIZE);
- return retval;
+ return 0;
}
diff --git a/libbalsa/libbalsa-vfs.h b/libbalsa/libbalsa-vfs.h
index 6d532ae..0ea028a 100644
--- a/libbalsa/libbalsa-vfs.h
+++ b/libbalsa/libbalsa-vfs.h
@@ -71,7 +71,7 @@ const gchar * libbalsa_vfs_get_basename_utf8(const LibbalsaVfs * file);
const gchar * libbalsa_vfs_get_mime_type(const LibbalsaVfs * file);
const gchar * libbalsa_vfs_get_charset(const LibbalsaVfs * file);
LibBalsaTextAttribute libbalsa_vfs_get_text_attr(const LibbalsaVfs * file);
-gsize libbalsa_vfs_get_size(const LibbalsaVfs * file);
+guint64 libbalsa_vfs_get_size(const LibbalsaVfs * file);
GMimeStream * libbalsa_vfs_create_stream(const LibbalsaVfs * file,
mode_t mode,
gboolean rdwr,
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 27d107f..b10c40b 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -2185,7 +2185,7 @@ add_attachment(BalsaSendmsg * bsmsg, const gchar *filename,
ATTACH_ICON_COLUMN, pixbuf,
ATTACH_TYPE_COLUMN, content_desc,
ATTACH_MODE_COLUMN, attach_data->mode,
- ATTACH_SIZE_COLUMN, (gfloat) libbalsa_vfs_get_size(file_uri),
+ ATTACH_SIZE_COLUMN, libbalsa_vfs_get_size(file_uri),
ATTACH_DESC_COLUMN, utf8name,
-1);
g_object_unref(attach_data);
@@ -2262,7 +2262,7 @@ add_urlref_attachment(BalsaSendmsg * bsmsg, gchar *url)
ATTACH_ICON_COLUMN, pixbuf,
ATTACH_TYPE_COLUMN, _("(URL)"),
ATTACH_MODE_COLUMN, attach_data->mode,
- ATTACH_SIZE_COLUMN, (gfloat) 0.0,
+ ATTACH_SIZE_COLUMN, 0,
ATTACH_DESC_COLUMN, url,
-1);
g_object_unref(attach_data);
@@ -2870,7 +2870,7 @@ render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *model, GtkTreeIter *iter, gpointer data)
{
gint mode;
- gfloat size;
+ guint64 size;
gchar *sstr;
gtk_tree_model_get(model, iter, ATTACH_MODE_COLUMN, &mode,
@@ -2878,7 +2878,11 @@ render_attach_size(GtkTreeViewColumn *column, GtkCellRenderer *cell,
if (mode == LIBBALSA_ATTACH_AS_EXTBODY)
sstr = g_strdup("-");
else
+#if GLIB_CHECK_VERSION(2, 30, 0)
+ sstr = g_format_size(size);
+#else /* GLIB_CHECK_VERSION(2, 30, 0) */
sstr = g_format_size_for_display((goffset) size);
+#endif /* GLIB_CHECK_VERSION(2, 30, 0) */
g_object_set(cell, "text", sstr, NULL);
g_free(sstr);
}
@@ -2993,7 +2997,7 @@ create_info_pane(BalsaSendmsg * bsmsg)
GDK_TYPE_PIXBUF,
G_TYPE_STRING,
G_TYPE_INT,
- G_TYPE_FLOAT,
+ G_TYPE_UINT64,
G_TYPE_STRING);
bsmsg->attachments[1] = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]