[gnome-disk-utility] Rudimentary support for loop files
- From: David Zeuthen <davidz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-disk-utility] Rudimentary support for loop files
- Date: Fri, 12 Mar 2010 16:56:48 +0000 (UTC)
commit a60bbb6b468e0fbc42680dd6b4d90997f314ffb4
Author: David Zeuthen <davidz redhat com>
Date: Fri Mar 12 11:20:12 2010 -0500
Rudimentary support for loop files
http://people.freedesktop.org/~david/gnome-loopback-2.png
Unfortunately the current string break prevents us from doing a
dedicated GduSectionLinuxLoop screen. Next release...
src/gdu/gdu-drive.c | 20 ++++++++++++++++++++
src/gdu/gdu-volume.c | 16 ++++++++++++----
2 files changed, 32 insertions(+), 4 deletions(-)
---
diff --git a/src/gdu/gdu-drive.c b/src/gdu/gdu-drive.c
index 03cb9b4..1482886 100644
--- a/src/gdu/gdu-drive.c
+++ b/src/gdu/gdu-drive.c
@@ -680,6 +680,12 @@ gdu_drive_get_name (GduPresentable *presentable)
strsize = gdu_util_get_size_for_display (size, FALSE, FALSE);
}
+ if (gdu_device_is_linux_loop (drive->priv->device)) {
+ /* TODO: mark for translation */
+ g_string_append_printf (result, "%s File", strsize);
+ goto out;
+ }
+
if (is_removable) {
get_drive_name_from_media_compat (drive->priv->device, result);
@@ -851,6 +857,14 @@ gdu_drive_get_vpd_name (GduPresentable *presentable)
result = g_string_new (NULL);
+ if (gdu_device_is_linux_loop (drive->priv->device)) {
+ gchar *s;
+ s = g_path_get_basename (gdu_device_linux_loop_get_filename (drive->priv->device));
+ g_string_append (result, s);
+ g_free (s);
+ goto out;
+ }
+
vendor = gdu_device_drive_get_vendor (drive->priv->device);
model = gdu_device_drive_get_model (drive->priv->device);
@@ -866,6 +880,7 @@ gdu_drive_get_vpd_name (GduPresentable *presentable)
vendor != NULL ? " " : "",
model != NULL ? model : "");
+ out:
return g_string_free (result, FALSE);
}
@@ -932,6 +947,11 @@ gdu_drive_get_icon (GduPresentable *presentable)
goto out;
}
+ if (gdu_device_is_linux_loop (drive->priv->device)) {
+ name = "drive-removable-media-file";
+ goto out;
+ }
+
/* media type */
if (strv_has (drive_media_compat, "optical_cd")) {
/* TODO: it would probably be nice to export a property whether this device can
diff --git a/src/gdu/gdu-volume.c b/src/gdu/gdu-volume.c
index 715433d..16fe3cf 100644
--- a/src/gdu/gdu-volume.c
+++ b/src/gdu/gdu-volume.c
@@ -600,6 +600,12 @@ gdu_volume_get_icon (GduPresentable *presentable)
if (!gdu_device_is_drive (d))
goto out;
+
+ if (gdu_device_is_linux_loop (d)) {
+ name = "drive-removable-media-file";
+ goto out;
+ }
+
connection_interface = gdu_device_drive_get_connection_interface (d);
if (connection_interface == NULL)
goto out;
@@ -694,10 +700,12 @@ out:
/* ultimate fallback */
if (icon == NULL) {
- if (is_removable)
- name = "drive-removable-media";
- else
- name = "drive-harddisk";
+ if (name == NULL) {
+ if (is_removable)
+ name = "drive-removable-media";
+ else
+ name = "drive-harddisk";
+ }
icon = g_themed_icon_new_with_default_fallbacks (name);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]