Adding of library to mount removeable devices when found, and to notify listeners that a change happened to list of known devices. Uses DeviceKit-disks, and policykit-1 to mount drives and get notified of changes
Review URL: http://chromereview.prom.corp.google.com/1175100
git-svn-id: svn://chrome-svn/chromeos/trunk@100 06c00378-0e64-4dae-be16-12b19f9950a1
diff --git a/chromeos/dbus/dbus.h b/chromeos/dbus/dbus.h
index 0a86baa..30c3246 100644
--- a/chromeos/dbus/dbus.h
+++ b/chromeos/dbus/dbus.h
@@ -279,10 +279,12 @@
G_TYPE_STRING, property,
G_TYPE_INVALID,
G_TYPE_VALUE, &value,
- G_TYPE_INVALID))
+ G_TYPE_INVALID)){
+ LOG(ERROR) << "Getting property failed: " << (error->message ? error->message : "Unknown Error.");
return false;
- return glib::Retrieve<T>(value, result);
+ }
+ return glib::Retrieve(value, result);
}
// \brief RetrieveProperties returns a HashTable of all properties for the
diff --git a/chromeos/glib/object.h b/chromeos/glib/object.h
index ecb7f64..d4d0cb0 100644
--- a/chromeos/glib/object.h
+++ b/chromeos/glib/object.h
@@ -202,11 +202,15 @@
Value()
: GValue() {
}
+ explicit Value(const ::GValue& x)
+ : GValue() {
+ *this = *static_cast<const Value*>(&x);
+ }
template <typename T>
explicit Value(T x)
: GValue() {
::g_value_init(this,
- type_to_gtypeid<typename promotes_from<T>::type>());
+ type_to_gtypeid<typename promotes_from<T>::type>());
RawSet(this, x);
}
Value(const Value& x)
@@ -267,8 +271,8 @@
bool Retrieve(const ::GValue& x, T* result) {
if (!G_VALUE_HOLDS(&x, type_to_gtypeid<typename promotes_from<T>::type>())) {
LOG(WARNING) << "GValue retrieve failed. Expected: "
- << type_to_gtypeid<typename promotes_from<T>::type>()
- << ", Found: " << G_VALUE_TYPE(&x);
+ << g_type_name(type_to_gtypeid<typename promotes_from<T>::type>())
+ << ", Found: " << g_type_name(G_VALUE_TYPE(&x));
return false;
}
@@ -276,6 +280,11 @@
return true;
}
+inline bool Retrieve(const ::GValue& x, Value* result) {
+ *result = Value(x);
+ return true;
+}
+
// \brief ScopedError holds a ::GError* and deletes it on destruction.
struct FreeError {