glibmm r518 - in trunk: . gio/src tools/m4



Author: murrayc
Date: Thu Jan 17 15:09:11 2008
New Revision: 518
URL: http://svn.gnome.org/viewvc/glibmm?rev=518&view=rev

Log:
2008-01-17  Murray Cumming  <murrayc murrayc com>

* gio/src/file.hg:
* gio/src/drive.ccg:
* gio/src/drive.hg: eject(),
* gio/src/volume.ccg:
* gio/src/volume.hg: eject(),
* tools/m4/convert_gio.m4: Wrapped GMountUnmountFlags enum as 
MountUnmountFlags, and used it. 

* gio/src/file.ccg:
* gio/src/file.hg: unmount_mountable(), eject(): Reorder the 
parameters and add a default flag value.

Modified:
   trunk/ChangeLog
   trunk/gio/src/drive.ccg
   trunk/gio/src/drive.hg
   trunk/gio/src/file.ccg
   trunk/gio/src/file.hg
   trunk/gio/src/mount.ccg
   trunk/gio/src/mount.hg
   trunk/gio/src/volume.ccg
   trunk/gio/src/volume.hg
   trunk/tools/m4/convert_gio.m4

Modified: trunk/gio/src/drive.ccg
==============================================================================
--- trunk/gio/src/drive.ccg	(original)
+++ trunk/gio/src/drive.ccg	Thu Jan 17 15:09:11 2008
@@ -50,7 +50,7 @@
 namespace Gio
 {
 
-void Drive::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, GMountUnmountFlags flags)
+void Drive::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -58,13 +58,13 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_drive_eject(gobj(),
-                flags, 
+                static_cast<GMountUnmountFlags>(flags), 
                 cancellable->gobj(),
                 &SignalProxy_async_callback,
                 slot_copy);
 }
 
-void Drive::eject(const SlotAsyncReady& slot, GMountUnmountFlags flags)
+void Drive::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -72,16 +72,16 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_drive_eject(gobj(),
-                flags, 
+                static_cast<GMountUnmountFlags>(flags), 
                 NULL, // cancellable
                 &SignalProxy_async_callback,
                 slot_copy);
 }
 
-void Drive::eject(GMountUnmountFlags flags)
+void Drive::eject(MountUnmountFlags flags)
 {
   g_drive_eject(gobj(),
-                flags, 
+                static_cast<GMountUnmountFlags>(flags), 
                 NULL, // cancellable
                 NULL,
                 NULL);

Modified: trunk/gio/src/drive.hg
==============================================================================
--- trunk/gio/src/drive.hg	(original)
+++ trunk/gio/src/drive.hg	Thu Jan 17 15:09:11 2008
@@ -19,11 +19,9 @@
 
 #include <gio/gio.h>
 
-#include <glibmm/interface.h>
-#include <giomm/asyncresult.h>
-#include <giomm/cancellable.h>
+#include <giomm/mount.h>
 #include <giomm/icon.h>
-#include <giomm/mountoperation.h>
+//#include <giomm/mountoperation.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/interface_p.h)
@@ -50,13 +48,9 @@
 
   _WRAP_METHOD(Glib::ustring get_name() const, g_drive_get_name)
 
-  _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(),
-               g_drive_get_icon,
-               refreturn)
-
-  _WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const,
-               g_drive_get_icon,
-               refreturn, constversion)
+  _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_drive_get_icon, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_drive_get_icon,  refreturn, constversion)
+
   _WRAP_METHOD(bool has_volumes() const, g_drive_has_volumes)
 
   // TODO: get_volumes, returns a list of GVolumes, we shouldn't take copy
@@ -64,32 +58,29 @@
 
   _WRAP_METHOD(bool is_media_removable() const, g_drive_is_media_removable)
   _WRAP_METHOD(bool has_media() const, g_drive_has_media)
-  _WRAP_METHOD(bool is_media_check_automatic(),
-               g_drive_is_media_check_automatic)
+  _WRAP_METHOD(bool is_media_check_automatic() const, g_drive_is_media_check_automatic)
   _WRAP_METHOD(bool can_poll_for_media() const, g_drive_can_poll_for_media)
-  _WRAP_METHOD(bool can_eject(), g_drive_can_eject)
-
-  //TODO: Use MountUnmountFlags instead of GMountUnmountFlags - we need to wrap some more stuff to see where this should best be declared.
+  _WRAP_METHOD(bool can_eject() const, g_drive_can_eject)
 
   /** Ejects the drive.
    * @param slot A callback which will be called when the eject is completed or canceled.
    * @param flags Flags affecting the unmount if required for eject.
    * @param cancellable A cancellable object which can be used to cancel the eject.
    */
-  void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
   /** Ejects the drive.
    * @param slot A callback which will be called when the eject is completed.
    * @param flags Flags affecting the unmount if required for eject.
    */
-  void eject(const SlotAsyncReady& slot, GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_drive_eject)
 
   /** Ejects the drive.
    * @param slot A callback which will be called when the eject is completed.
    * @param flags Flags affecting the unmount if required for eject.
    */
-  void eject(GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
   _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result),
                g_drive_eject_finish,

Modified: trunk/gio/src/file.ccg
==============================================================================
--- trunk/gio/src/file.ccg	(original)
+++ trunk/gio/src/file.ccg	Thu Jan 17 15:09:11 2008
@@ -670,7 +670,7 @@
                          slot_copy);
 }
 
-void File::unmount_mountable(GMountUnmountFlags flags, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot)
+void File::unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -678,14 +678,14 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_file_unmount_mountable(gobj(),
-                           flags, 
+                           static_cast<GMountUnmountFlags>(flags), 
                            cancellable->gobj(),
                            &SignalProxy_async_callback,
                            slot_copy);
 }
 
 void
-File::unmount_mountable(GMountUnmountFlags flags, const SlotAsyncReady& slot)
+File::unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -693,14 +693,25 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_file_unmount_mountable(gobj(),
-                           flags, 
+                           static_cast<GMountUnmountFlags>(flags), 
                            NULL,
                            &SignalProxy_async_callback,
                            slot_copy);
 }
 
 void
-File::eject_mountable(GMountUnmountFlags flags, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot)
+File::unmount_mountable(MountUnmountFlags flags)
+{
+  g_file_unmount_mountable(gobj(),
+                           static_cast<GMountUnmountFlags>(flags), 
+                           NULL,
+                           NULL,
+                           NULL);
+}
+
+
+void
+File::eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -708,14 +719,14 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_file_eject_mountable(gobj(),
-                         flags, 
+                         static_cast<GMountUnmountFlags>(flags), 
                          cancellable->gobj(),
                          &SignalProxy_async_callback,
                          slot_copy);
 }
 
 void
-File::eject_mountable(GMountUnmountFlags flags, const SlotAsyncReady& slot)
+File::eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -723,13 +734,23 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_file_eject_mountable(gobj(),
-                         flags, 
+                         static_cast<GMountUnmountFlags>(flags), 
                          NULL,
                          &SignalProxy_async_callback,
                          slot_copy);
 }
 
 void
+File::eject_mountable(MountUnmountFlags flags)
+{
+  g_file_eject_mountable(gobj(),
+                         static_cast<GMountUnmountFlags>(flags), 
+                         NULL,
+                         NULL,
+                         NULL);
+}
+
+void
 File::load_contents_async(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable)
 {
   // Create a copy of the slot.

Modified: trunk/gio/src/file.hg
==============================================================================
--- trunk/gio/src/file.hg	(original)
+++ trunk/gio/src/file.hg	Thu Jan 17 15:09:11 2008
@@ -29,7 +29,7 @@
 #include <giomm/filemonitor.h>
 #include <giomm/fileoutputstream.h>
 #include <giomm/mountoperation.h>
-#include <giomm/volume.h>
+//#include <giomm/volume.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/interface_p.h)
@@ -37,10 +37,13 @@
 namespace Gio
 {
 
+class Volume;
+
 _WRAP_ENUM(FileQueryInfoFlags, GFileQueryInfoFlags, NO_GTYPE)
 _WRAP_ENUM(FileCreateFlags, GFileCreateFlags, NO_GTYPE)
 _WRAP_ENUM(FileCopyFlags, GFileCopyFlags, NO_GTYPE)
 _WRAP_ENUM(FileMonitorFlags, GFileMonitorFlags, NO_GTYPE)
+_WRAP_ENUM(MountUnmountFlags, GMountUnmountFlags, NO_GTYPE)
 
 /** File and directory handling.
  * Gio::File is a high level abstraction for manipulating files on a virtual file system. Gio::Files are lightweight, immutable objects that do no 
@@ -559,23 +562,26 @@
    *
    * When the operation is finished, @a slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.
    *
-   * @param flags Flags affecting the operation.
-   * @param cancellable A Cancellable object which can be used to cancel the operation.
    * @param slot A callback slot which will be called when the request is satisfied.
+   * @param cancellable A Cancellable object which can be used to cancel the operation.
+   * @param flags Flags affecting the operation.
    */
-  void unmount_mountable(GMountUnmountFlags flags, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+  void unmount_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
   /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
    *
-   * The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error 
-   * IO_ERROR_CANCELLED will be returned.
-   *
    * When the operation is finished, @a slot will be called. You can then call unmount_mountable_finish() to get the result of the operation.
    *
-   * @param flags Flags affecting the operation.
    * @param slot A callback slot which will be called when the request is satisfied.
+   * @param flags Flags affecting the operation.
    */
-  void unmount_mountable(GMountUnmountFlags flags, const SlotAsyncReady& slot);
+  void unmount_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Unmounts a file of type FILE_TYPE_MOUNTABLE.
+   *
+   * @param flags Flags affecting the operation.
+   */
+  void unmount_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_file_unmount_mountable)
 
   _WRAP_METHOD(bool unmount_mountable_finish(const Glib::RefPtr<AsyncResult>& result),
@@ -593,19 +599,22 @@
    * @param cancellable A Cancellable object which can be used to cancel the operation.
    * @param slot A callback slot which will be called when the request is satisfied.
    */
-  void eject_mountable(GMountUnmountFlags flags, const Glib::RefPtr<Cancellable>& cancellable, const SlotAsyncReady& slot);
+  void eject_mountable(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
   /** Starts an asynchronous eject on a mountable.
    *
-   * The operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error 
-   * IO_ERROR_CANCELLED will be returned.
-   *
    * When the operation is finished, @a slot will be called. You can then call eject_mountable_finish() to get the result of the operation.
    *
-   * @param flags Flags affecting the operation.
    * @param slot A callback slot which will be called when the request is satisfied.
+   * @param flags Flags affecting the operation.
+   */
+  void eject_mountable(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
+
+  /** Starts an asynchronous eject on a mountable.
+   *
+   * @param flags Flags affecting the operation.
    */
-  void eject_mountable(GMountUnmountFlags flags, const SlotAsyncReady& slot);
+  void eject_mountable(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_file_eject_mountable)
 
   _WRAP_METHOD(bool eject_mountable_finish(const Glib::RefPtr<AsyncResult>& result),

Modified: trunk/gio/src/mount.ccg
==============================================================================
--- trunk/gio/src/mount.ccg	(original)
+++ trunk/gio/src/mount.ccg	Thu Jan 17 15:09:11 2008
@@ -17,6 +17,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <giomm/drive.h>
+#include <giomm/volume.h>
 #include <gio/gio.h>
 
 namespace Gio

Modified: trunk/gio/src/mount.hg
==============================================================================
--- trunk/gio/src/mount.hg	(original)
+++ trunk/gio/src/mount.hg	Thu Jan 17 15:09:11 2008
@@ -17,7 +17,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <giomm/drive.h>
+//#include <giomm/drive.h>
 #include <giomm/file.h>
 #include <giomm/volume.h>
 #include <glibmm/interface.h>
@@ -31,6 +31,9 @@
 namespace Gio
 {
 
+class Drive;
+//class Volume;
+
 /** TODO: 
  *
  * @newin2p16

Modified: trunk/gio/src/volume.ccg
==============================================================================
--- trunk/gio/src/volume.ccg	(original)
+++ trunk/gio/src/volume.ccg	Thu Jan 17 15:09:11 2008
@@ -17,10 +17,12 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <gio/gio.h>
+
 #include <glibmm/error.h>
 #include <glibmm/exceptionhandler.h>
 #include <giomm/file.h>
+#include <giomm/drive.h>
+#include <gio/gio.h>
 
 namespace {
 
@@ -102,7 +104,7 @@
 }
 
 
-void Volume::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, GMountUnmountFlags flags)
+void Volume::eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -110,13 +112,13 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_volume_eject(gobj(),
-                 flags, 
+                 static_cast<GMountUnmountFlags>(flags), 
                  cancellable->gobj(),
                  &SignalProxy_async_callback,
                  slot_copy);
 }
 
-void Volume::eject(const SlotAsyncReady& slot, GMountUnmountFlags flags)
+void Volume::eject(const SlotAsyncReady& slot, MountUnmountFlags flags)
 {
   // Create a copy of the slot.
   // A pointer to it will be passed through the callback's data parameter
@@ -124,16 +126,16 @@
   SlotAsyncReady* slot_copy = new SlotAsyncReady(slot);
 
   g_volume_eject(gobj(),
-                 flags, 
+                 static_cast<GMountUnmountFlags>(flags), 
                  NULL,
                  &SignalProxy_async_callback,
                  slot_copy);
 }
 
-void Volume::eject(GMountUnmountFlags flags)
+void Volume::eject(MountUnmountFlags flags)
 {
   g_volume_eject(gobj(),
-                 flags, 
+                 static_cast<GMountUnmountFlags>(flags), 
                  NULL,
                  NULL,
                  NULL);

Modified: trunk/gio/src/volume.hg
==============================================================================
--- trunk/gio/src/volume.hg	(original)
+++ trunk/gio/src/volume.hg	Thu Jan 17 15:09:11 2008
@@ -19,12 +19,10 @@
 
 #include <gio/gio.h>
 
-#include <glibmm/interface.h>
-#include <giomm/asyncresult.h>
-#include <giomm/cancellable.h>
-#include <giomm/drive.h>
-#include <giomm/icon.h>
+#include <giomm/file.h>
 #include <giomm/mountoperation.h>
+//#include <giomm/drive.h>
+//#include <giomm/icon.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/interface_p.h)
@@ -35,6 +33,7 @@
 // Making a forward declaration here to avoid circular dependency.
 // file.hg already includes volume.h.
 class File;
+class Drive;
 
 /** The Volume interface represents user-visible objects that can be mounted.
  * 
@@ -91,12 +90,11 @@
                errthrow)
 
   //TODO: Documentation.
-  //TODO: Use MountUnmountFlags instead of GMountUnmountFlags.
-  void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(const SlotAsyncReady& slot, const Glib::RefPtr<Cancellable>& cancellable, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
-  void eject(const SlotAsyncReady& slot, GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(const SlotAsyncReady& slot, MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
 
-  void eject(GMountUnmountFlags flags = G_MOUNT_UNMOUNT_NONE);
+  void eject(MountUnmountFlags flags = MOUNT_UNMOUNT_NONE);
   _IGNORE(g_volume_eject)
 
   _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result),

Modified: trunk/tools/m4/convert_gio.m4
==============================================================================
--- trunk/tools/m4/convert_gio.m4	(original)
+++ trunk/tools/m4/convert_gio.m4	Thu Jan 17 15:09:11 2008
@@ -1,5 +1,6 @@
 _CONV_ENUM(G,PasswordSave)
 _CONV_ENUM(G,MountOperationResult)
+_CONV_ENUM(G,MountUnmountFlags)
 _CONV_ENUM(G,FileAttributeType)
 _CONV_ENUM(G,FileAttributeInfoFlags)
 _CONV_ENUM(G,FileCopyFlags)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]