summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali (Khattak) <zeeshanak@gnome.org>2011-09-15 04:25:50 +0300
committerAlexander Larsson <alexl@redhat.com>2011-09-19 16:51:41 +0200
commitd39d6ef1cc600799dc6e5d17ffb4f01e9d7448ec (patch)
tree0546e01f44ee94a482264961cc6ef70178a6af58
parentfb14146e6b0f9525ed6540c69f5c5122de1af00f (diff)
downloadgvfs-d39d6ef1cc600799dc6e5d17ffb4f01e9d7448ec.tar.gz
gdu volume monitor: Mark bootable mounts as such
Add appropriate content-type for bootable mounts. Although 'bootability' information is coming from libosinfo[1], we are not adding a dependency on it with this patch since libosinfo sets a boolean property on the udev device for us. We can then just query that property using gudev. [1] https://fedorahosted.org/libosinfo/ https://bugzilla.gnome.org/show_bug.cgi?id=659109
-rw-r--r--monitor/gdu/Makefile.am2
-rw-r--r--monitor/gdu/ggdumount.c33
2 files changed, 35 insertions, 0 deletions
diff --git a/monitor/gdu/Makefile.am b/monitor/gdu/Makefile.am
index cb64944b..c9c91956 100644
--- a/monitor/gdu/Makefile.am
+++ b/monitor/gdu/Makefile.am
@@ -18,6 +18,7 @@ gvfs_gdu_volume_monitor_CFLAGS = \
-I$(top_srcdir)/monitor/proxy \
$(GLIB_CFLAGS) \
$(GDU_CFLAGS) \
+ $(GUDEV_CFLAGS) \
$(DBUS_CFLAGS) \
-DGIO_MODULE_DIR=\"$(GIO_MODULE_DIR)\" \
-DGVFS_LOCALEDIR=\""$(localedir)"\" \
@@ -31,6 +32,7 @@ gvfs_gdu_volume_monitor_LDFLAGS = \
gvfs_gdu_volume_monitor_LDADD = \
$(GLIB_LIBS) \
$(GDU_LIBS) \
+ $(GUDEV_LIBS) \
$(DBUS_LIBS) \
$(top_builddir)/common/libgvfscommon.la \
$(top_builddir)/monitor/proxy/libgvfsproxyvolumemonitordaemon-noin.la \
diff --git a/monitor/gdu/ggdumount.c b/monitor/gdu/ggdumount.c
index 83c1847c..b7e8545a 100644
--- a/monitor/gdu/ggdumount.c
+++ b/monitor/gdu/ggdumount.c
@@ -34,6 +34,10 @@
#include <gvfsmountinfo.h>
+#ifdef HAVE_GUDEV
+#include <gudev/gudev.h>
+#endif
+
#include "ggduvolumemonitor.h"
#include "ggdumount.h"
#include "ggduvolume.h"
@@ -1362,6 +1366,35 @@ g_gdu_mount_guess_content_type_sync (GMount *_mount,
}
}
+#ifdef HAVE_GUDEV
+ /* Check if its bootable */
+ if (device != NULL)
+ {
+ const gchar *device_file;
+
+ device_file = gdu_device_get_device_file (device);
+ if (device_file != NULL)
+ {
+ GUdevClient *client;
+ GUdevDevice *gudev_device;
+ const gchar *subsystems[] = {"block", NULL};
+
+ client = g_udev_client_new (subsystems);
+ gudev_device = g_udev_client_query_by_device_file (client, device_file);
+ if (gudev_device != NULL)
+ {
+ if (g_udev_device_get_property_as_boolean (gudev_device,
+ "OSINFO_BOOTABLE"))
+ g_ptr_array_add (p, g_strdup ("x-content/bootable-media"));
+
+ g_object_unref (gudev_device);
+ }
+
+ g_object_unref (client);
+ }
+ }
+#endif
+
if (p->len == 0)
{
result = NULL;