glibmm r660 - in trunk: . gio/src
- From: jjongsma svn gnome org
- To: svn-commits-list gnome org
- Subject: glibmm r660 - in trunk: . gio/src
- Date: Sat, 26 Apr 2008 05:12:59 +0100 (BST)
Author: jjongsma
Date: Sat Apr 26 04:12:58 2008
New Revision: 660
URL: http://svn.gnome.org/viewvc/glibmm?rev=660&view=rev
Log:
Add TypeTraits implementations for Drive and Volume similar to the one added for Mount.
Modified:
trunk/ChangeLog
trunk/gio/src/drive.hg
trunk/gio/src/volume.hg
Modified: trunk/gio/src/drive.hg
==============================================================================
--- trunk/gio/src/drive.hg (original)
+++ trunk/gio/src/drive.hg Sat Apr 26 04:12:58 2008
@@ -119,3 +119,43 @@
} // namespace Gio
+namespace Glib
+{
+
+//Pre-declare this so we can use it in TypeTrait:
+Glib::RefPtr<Gio::Drive> wrap(GDrive* object, bool take_copy);
+
+namespace Container_Helpers
+{
+
+/** This specialization of TypeTraits exists
+ * because the default use of Glib::wrap(GObject*),
+ * instead of a specific Glib::wrap(GSomeInterface*),
+ * would not return a wrapper for an interface.
+ */
+template <>
+struct TypeTraits< Glib::RefPtr<Gio::Drive> >
+{
+ typedef Glib::RefPtr<Gio::Drive> CppType;
+ typedef GDrive* CType;
+ typedef GDrive* CTypeNonConst;
+
+ static CType to_c_type (const CppType& item)
+ { return Glib::unwrap (item); }
+
+ static CppType to_cpp_type (const CType& item)
+ {
+ //Use a specific Glib::wrap() function,
+ //because CType has the specific type (not just GObject):
+ return Glib::wrap(item, true /* take_copy */);
+ }
+
+ static void release_c_type (CType item)
+ {
+ GLIBMM_DEBUG_UNREFERENCE(0, item);
+ g_object_unref(item);
+ }
+};
+
+} // Container_Helpers
+} // Glib
Modified: trunk/gio/src/volume.hg
==============================================================================
--- trunk/gio/src/volume.hg (original)
+++ trunk/gio/src/volume.hg Sat Apr 26 04:12:58 2008
@@ -181,3 +181,44 @@
};
} // namespace Gio
+
+namespace Glib
+{
+
+//Pre-declare this so we can use it in TypeTrait:
+Glib::RefPtr<Gio::Volume> wrap(GVolume* object, bool take_copy);
+
+namespace Container_Helpers
+{
+
+/** This specialization of TypeTraits exists
+ * because the default use of Glib::wrap(GObject*),
+ * instead of a specific Glib::wrap(GSomeInterface*),
+ * would not return a wrapper for an interface.
+ */
+template <>
+struct TypeTraits< Glib::RefPtr<Gio::Volume> >
+{
+ typedef Glib::RefPtr<Gio::Volume> CppType;
+ typedef GVolume* CType;
+ typedef GVolume* CTypeNonConst;
+
+ static CType to_c_type (const CppType& item)
+ { return Glib::unwrap (item); }
+
+ static CppType to_cpp_type (const CType& item)
+ {
+ //Use a specific Glib::wrap() function,
+ //because CType has the specific type (not just GObject):
+ return Glib::wrap(item, true /* take_copy */);
+ }
+
+ static void release_c_type (CType item)
+ {
+ GLIBMM_DEBUG_UNREFERENCE(0, item);
+ g_object_unref(item);
+ }
+};
+
+} // Container_Helpers
+} // Glib
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]