gvfs r1929 - in trunk: . monitor/hal
- From: davidz svn gnome org
- To: svn-commits-list gnome org
- Subject: gvfs r1929 - in trunk: . monitor/hal
- Date: Tue, 2 Sep 2008 18:19:47 +0000 (UTC)
Author: davidz
Date: Tue Sep 2 18:19:47 2008
New Revision: 1929
URL: http://svn.gnome.org/viewvc/gvfs?rev=1929&view=rev
Log:
2008-09-02 David Zeuthen <davidz redhat com>
* monitor/hal/ghalvolume.c (do_update_from_hal): Revert patch from
bug 550100 - we really don't want to show "61.7MB Volume" instead
of "64M Volume".
Modified:
trunk/ChangeLog
trunk/monitor/hal/ghalvolume.c
Modified: trunk/monitor/hal/ghalvolume.c
==============================================================================
--- trunk/monitor/hal/ghalvolume.c (original)
+++ trunk/monitor/hal/ghalvolume.c Tue Sep 2 18:19:47 2008
@@ -136,6 +136,35 @@
return FALSE;
}
+#define KILOBYTE_FACTOR 1000.0
+#define MEGABYTE_FACTOR (1000.0 * 1000.0)
+#define GIGABYTE_FACTOR (1000.0 * 1000.0 * 1000.0)
+
+static char *
+format_size_for_display (guint64 size)
+{
+ char *str;
+ gdouble displayed_size;
+
+ if (size < MEGABYTE_FACTOR)
+ {
+ displayed_size = (double) size / KILOBYTE_FACTOR;
+ str = g_strdup_printf (_("%.1f kB"), displayed_size);
+ }
+ else if (size < GIGABYTE_FACTOR)
+ {
+ displayed_size = (double) size / MEGABYTE_FACTOR;
+ str = g_strdup_printf (_("%.1f MB"), displayed_size);
+ }
+ else
+ {
+ displayed_size = (double) size / GIGABYTE_FACTOR;
+ str = g_strdup_printf (_("%.1f GB"), displayed_size);
+ }
+
+ return str;
+}
+
static void
do_update_from_hal (GHalVolume *mv)
{
@@ -187,7 +216,7 @@
{
if (strcmp (volume_fsusage, "crypto") == 0 && strcmp (volume_fstype, "crypto_LUKS") == 0)
{
- size = g_format_size_for_display (volume_size);
+ size = format_size_for_display (volume_size);
/* Translators: %s is the size of the volume (e.g. 512 MB) */
name = g_strdup_printf (_("%s Encrypted Data"), size);
g_free (size);
@@ -210,7 +239,7 @@
}
else
{
- size = g_format_size_for_display (volume_size);
+ size = format_size_for_display (volume_size);
/* Translators: %s is the size of the volume (e.g. 512 MB) */
name = g_strdup_printf (_("%s Media"), size);
g_free (size);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]