[gnome-settings-daemon] housekeeping: Add helper to detect removable media
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] housekeeping: Add helper to detect removable media
- Date: Thu, 19 Apr 2012 13:26:08 +0000 (UTC)
commit 8d8e23b9cf6a619a8a55d532b91f848875036360
Author: Bastien Nocera <hadess hadess net>
Date: Thu Apr 19 14:25:41 2012 +0100
housekeeping: Add helper to detect removable media
plugins/housekeeping/gsd-disk-space-helper.c | 19 +++++++++++++++++++
plugins/housekeeping/gsd-disk-space-helper.h | 1 +
2 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/plugins/housekeeping/gsd-disk-space-helper.c b/plugins/housekeeping/gsd-disk-space-helper.c
index e505d48..1987337 100644
--- a/plugins/housekeeping/gsd-disk-space-helper.c
+++ b/plugins/housekeeping/gsd-disk-space-helper.c
@@ -103,3 +103,22 @@ gsd_should_ignore_unix_mount (GUnixMountEntry *mount)
return FALSE;
}
+
+gboolean
+gsd_is_removable_mount (GUnixMountEntry *mount)
+{
+ const char *mount_path;
+ char *path;
+
+ mount_path = g_unix_mount_get_mount_path (mount);
+ if (mount_path == NULL)
+ return FALSE;
+
+ path = g_strdup_printf ("/run/media/%s", g_get_user_name ());
+ if (g_str_has_prefix (mount_path, path)) {
+ g_free (path);
+ return TRUE;
+ }
+ g_free (path);
+ return FALSE;
+}
diff --git a/plugins/housekeeping/gsd-disk-space-helper.h b/plugins/housekeeping/gsd-disk-space-helper.h
index 99c16eb..b558a8c 100644
--- a/plugins/housekeeping/gsd-disk-space-helper.h
+++ b/plugins/housekeeping/gsd-disk-space-helper.h
@@ -32,6 +32,7 @@
G_BEGIN_DECLS
gboolean gsd_should_ignore_unix_mount (GUnixMountEntry *mount);
+gboolean gsd_is_removable_mount (GUnixMountEntry *mount);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]