glibmm r516 - in trunk: . gio/src tools/extra_defs_gen tools/m4



Author: murrayc
Date: Wed Jan 16 21:10:11 2008
New Revision: 516
URL: http://svn.gnome.org/viewvc/glibmm?rev=516&view=rev

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

* tools/extra_defs_gen/generate_defs_gio.cc: Added Mount and 
VolumeMonitor.
* gio/src/gio_signals.defs: Regenerated.

* gio/src/Makefile_list_of_hg.am_fragment:
* gio/src/mount.ccg:
* gio/src/mount.hg: Added Mount
* gio/src/volumemonitor.hg:
* gio/src/volumemonitor.ccg: Added VolumeMonitor.

* tools/m4/convert_gio.m4: Added necessary conversions.

Added:
   trunk/gio/src/mount.ccg
      - copied, changed from r514, /trunk/gio/src/seekable.ccg
   trunk/gio/src/mount.hg
      - copied, changed from r514, /trunk/gio/src/seekable.hg
   trunk/gio/src/volumemonitor.ccg
      - copied unchanged from r515, /trunk/gio/src/filemonitor.ccg
   trunk/gio/src/volumemonitor.hg
      - copied, changed from r515, /trunk/gio/src/filemonitor.hg
Modified:
   trunk/ChangeLog
   trunk/gio/src/Makefile_list_of_hg.am_fragment
   trunk/gio/src/filemonitor.ccg
   trunk/gio/src/filemonitor.hg
   trunk/gio/src/gio_signals.defs
   trunk/gio/src/seekable.hg
   trunk/tools/extra_defs_gen/generate_defs_gio.cc
   trunk/tools/m4/convert_gio.m4

Modified: trunk/gio/src/Makefile_list_of_hg.am_fragment
==============================================================================
--- trunk/gio/src/Makefile_list_of_hg.am_fragment	(original)
+++ trunk/gio/src/Makefile_list_of_hg.am_fragment	Wed Jan 16 21:10:11 2008
@@ -7,8 +7,8 @@
 files_win32_hg =
 files_general_hg = appinfo.hg asyncresult.hg cancellable.hg drive.hg file.hg fileattribute.hg \
                    fileenumerator.hg fileicon.hg fileinfo.hg fileinputstream.hg fileoutputstream.hg filemonitor.hg \
-                   icon.hg inputstream.hg loadableicon.hg mountoperation.hg outputstream.hg seekable.hg \
-                   simpleasyncresult.hg volume.hg
+                   icon.hg inputstream.hg loadableicon.hg mount.hg mountoperation.hg outputstream.hg seekable.hg \
+                   simpleasyncresult.hg volume.hg volumemonitor.hg
 
 include $(top_srcdir)/build_shared/Makefile_build_gensrc.am_fragment
 

Modified: trunk/gio/src/filemonitor.ccg
==============================================================================
--- trunk/gio/src/filemonitor.ccg	(original)
+++ trunk/gio/src/filemonitor.ccg	Wed Jan 16 21:10:11 2008
@@ -17,6 +17,7 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+#include <giomm/file.h>
 #include <gio/gio.h>
 
 namespace Gio {

Modified: trunk/gio/src/filemonitor.hg
==============================================================================
--- trunk/gio/src/filemonitor.hg	(original)
+++ trunk/gio/src/filemonitor.hg	Wed Jan 16 21:10:11 2008
@@ -17,16 +17,20 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
+//#include <giomm/file.h>
 #include <glibmm/object.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
+_PINCLUDE(gio/gio.h)
 
 namespace Gio
 {
 
 _WRAP_ENUM(FileMonitorEvent, GFileMonitorEvent, NO_GTYPE)
 
+class File;
+
 /** Monitors a file or directory for changes.
  * TODO: Documentation: See http://bugzilla.gnome.org/show_bug.cgi?id=509994.
  * @newin2p16
@@ -45,6 +49,7 @@
   //g_file_monitor_emit_event is for implementations.
   _IGNORE(g_file_monitor_emit_event)
 
+#m4 _CONVERSION(`GFile*',`const Glib::RefPtr<File>&',`Glib::wrap($3, true)')
   _WRAP_SIGNAL(void changed(const Glib::RefPtr<File>& file, const Glib::RefPtr<File>& other_file, FileMonitorEvent event_type), "changed")
   
   //TODO: Write .defs for the vfunc:

Modified: trunk/gio/src/gio_signals.defs
==============================================================================
--- trunk/gio/src/gio_signals.defs	(original)
+++ trunk/gio/src/gio_signals.defs	Wed Jan 16 21:10:11 2008
@@ -18,6 +18,37 @@
 
 ;; From GFileIcon
 
+;; From GFileMonitor
+
+(define-signal changed
+  (of-object "GFileMonitor")
+  (return-type "void")
+  (when "last")
+  (parameters
+    '("GFile*" "p0")
+    '("GFile*" "p1")
+    '("GFileMonitorEvent" "p2")
+  )
+)
+
+(define-property rate-limit
+  (of-object "GFileMonitor")
+  (prop-type "GParamInt")
+  (docs "The limit of the monitor to watch for changes, in milliseconds")
+  (readable #t)
+  (writable #t)
+  (construct-only #f)
+)
+
+(define-property cancelled
+  (of-object "GFileMonitor")
+  (prop-type "GParamBoolean")
+  (docs "Whether the monitor has been cancelled")
+  (readable #t)
+  (writable #f)
+  (construct-only #f)
+)
+
 ;; From GFileInputStream
 
 ;; From GFileOutputStream
@@ -26,6 +57,8 @@
 
 ;; From GLoadableIcon
 
+;; From GMount
+
 ;; From GMountOperation
 
 (define-signal ask-password

Copied: trunk/gio/src/mount.ccg (from r514, /trunk/gio/src/seekable.ccg)
==============================================================================
--- /trunk/gio/src/seekable.ccg	(original)
+++ trunk/gio/src/mount.ccg	Wed Jan 16 21:10:11 2008
@@ -23,45 +23,5 @@
 {
 
 
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-bool Seekable::seek(goffset offset, Glib::SeekType type)
-#else
-bool Seekable::seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error)
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-{
-  GError* gerror = 0;
-  bool retvalue = g_seekable_seek(gobj(), offset, ((GSeekType)(type)), NULL, &(gerror));
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-#else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  return retvalue;
-}
-
-
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-bool Seekable::truncate(goffset offset)
-#else
-bool Seekable::truncate(goffset offset, std::auto_ptr<Glib::Error>& error)
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-{
-  GError* gerror = 0;
-  bool retvalue = g_seekable_truncate(gobj(), offset, NULL, &(gerror));
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  if(gerror)
-    ::Glib::Error::throw_exception(gerror);
-#else
-  if(gerror)
-    error = ::Glib::Error::throw_exception(gerror);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  return retvalue;
-}
-
-
 } // namespace Gio
 

Copied: trunk/gio/src/mount.hg (from r514, /trunk/gio/src/seekable.hg)
==============================================================================
--- /trunk/gio/src/seekable.hg	(original)
+++ trunk/gio/src/mount.hg	Wed Jan 16 21:10:11 2008
@@ -17,72 +17,89 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <gio/gio.h>
-#include <giomm/cancellable.h>
+#include <giomm/drive.h>
+#include <giomm/file.h>
+#include <giomm/volume.h>
 #include <glibmm/interface.h>
 
+#include <gio/gio.h>
+
+
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/interface_p.h)
 
 namespace Gio
 {
 
-/** Stream seeking interface.
- * Seekable is implemented by streams (implementations of InputStream or OutputStream) that support seeking.
+/** TODO: 
  *
  * @newin2p16
  */
-class Seekable : public Glib::Interface
+class Mount : public Glib::Interface
 {
-  _CLASS_INTERFACE(Seekable, GSeekable, G_Seekable, GSeekableIface)
+  _CLASS_INTERFACE(Mount, GMount, G_MOUNT, GMountIface)
 
 public:
-  _WRAP_METHOD(goffset tell() const, g_seekable_tell)
-  _WRAP_METHOD(bool can_seek() const, g_seekable_can_seek)
 
-  _WRAP_METHOD(bool seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_seek, errthrow)
+  _WRAP_METHOD(Glib::RefPtr<File> get_root(), g_mount_get_root, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const File> get_root() const, g_mount_get_root, refreturn, constversion)
+
+  _WRAP_METHOD(std::string get_name() const, g_mount_get_name)
+
+  _WRAP_METHOD(Glib::RefPtr<Icon> get_icon(), g_mount_get_icon, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Icon> get_icon() const, g_mount_get_icon, refreturn, constversion)
+
+  _WRAP_METHOD(std::string get_uuid() const, g_mount_get_uuid)
+
+  _WRAP_METHOD(Glib::RefPtr<Volume> get_volume(), g_mount_get_volume, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Volume> get_volume() const, g_mount_get_volume, refreturn, constversion)
+
+  _WRAP_METHOD(Glib::RefPtr<Drive> get_drive(), g_mount_get_drive, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<const Drive> get_drive() const, g_mount_get_drive, refreturn, constversion)
+
+  _WRAP_METHOD(bool can_unmount() const, g_mount_can_unmount)
+  _WRAP_METHOD(bool can_eject() const, g_mount_can_eject)
+
+//TODO:
+/*
+  _WRAP_METHOD(void               g_mount_unmount              (GMount              *mount,
+						 GMountUnmountFlags   flags,
+                                                 GCancellable        *cancellable,
+                                                 GAsyncReadyCallback  callback,
+                                                 gpointer             user_data);
+*/
+  _WRAP_METHOD(bool unmount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_unmount_finish, errthrow)
+
+//TODO:
+/*
+  _WRAP_METHOD(void               g_mount_eject                (GMount              *mount,
+						 GMountUnmountFlags   flags,
+                                                 GCancellable        *cancellable,
+                                                 GAsyncReadyCallback  callback,
+                                                 gpointer             user_data);
+*/
+  _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_finish, errthrow)
+
+
+//TODO:
+/*
+  _WRAP_METHOD(void               g_mount_remount              (GMount              *mount,
+						 GMountOperation     *mount_operation,
+                                                 GCancellable        *cancellable,
+                                                 GAsyncReadyCallback  callback,
+                                                 gpointer             user_data);
+*/
+  _WRAP_METHOD(bool remount_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_remount_finish, errthrow)
+
+
+
+  _WRAP_SIGNAL(void changed(), changed)
+  _WRAP_SIGNAL(void unmounted(), unmounted)
 
-  //TODO: Document the exception: http://bugzilla.gnome.org/show_bug.cgi?id=509990
-  /** Seeks in the stream by the given @a offset, modified by @a type .
-   * 
-   * @param offset A #goffset.
-   * @param type A G::SeekType.
-   * @return <tt>true</tt> if successful. If an error
-   * has occurred, this function will return <tt>false</tt>.
-   */
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  bool seek(goffset offset, Glib::SeekType type);
-#else
-  bool seek(goffset offset, Glib::SeekType type, std::auto_ptr<Glib::Error>& error);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-  _WRAP_METHOD(bool can_truncate() const, g_seekable_can_truncate)
-
-  _WRAP_METHOD(bool truncate(goffset offset, const Glib::RefPtr<Cancellable>& cancellable), g_seekable_truncate, errthrow)
-
-  //TODO: Document the exception: http://bugzilla.gnome.org/show_bug.cgi?id=509990
-  /** Truncates a stream with a given #offset. 
-   * 
-   * @param offset A #goffset.
-   * @return <tt>true</tt> if successful. If an error
-   * has occured, this function will return <tt>false</tt>.
-   */
-#ifdef GLIBMM_EXCEPTIONS_ENABLED
-  bool truncate(goffset offset);
-#else
-  bool truncate(goffset offset, std::auto_ptr<Glib::Error>& error);
-#endif //GLIBMM_EXCEPTIONS_ENABLED
-
-//TODO: Write the .defs for these:
-  _WRAP_VFUNC(goffset tell() const, tell)
-  _WRAP_VFUNC(goffset can_seek(), can_seek)
-  _WRAP_VFUNC(goffset seek(goffset offset, Glib::SeekType type, const Glib::RefPtr<Cancellable>& cancellable, GError** error), seek)
-  _WRAP_VFUNC(goffset can_truncate(), can_truncate)
+  //There are no properties.
 
-  //TODO: Rename to truncate()?
-  _WRAP_VFUNC(goffset truncate_fn(goffset offset, const Glib::RefPtr<Cancellable>& cancellable, GError** error), truncate_fn)
+  //TODO: vfuncs.
 
-  //There are no properties or signals.
 };
 
 } // namespace Gio

Modified: trunk/gio/src/seekable.hg
==============================================================================
--- trunk/gio/src/seekable.hg	(original)
+++ trunk/gio/src/seekable.hg	Wed Jan 16 21:10:11 2008
@@ -34,7 +34,7 @@
  */
 class Seekable : public Glib::Interface
 {
-  _CLASS_INTERFACE(Seekable, GSeekable, G_Seekable, GSeekableIface)
+  _CLASS_INTERFACE(Seekable, GSeekable, G_SEEKABLE, GSeekableIface)
 
 public:
   _WRAP_METHOD(goffset tell() const, g_seekable_tell)

Copied: trunk/gio/src/volumemonitor.hg (from r515, /trunk/gio/src/filemonitor.hg)
==============================================================================
--- /trunk/gio/src/filemonitor.hg	(original)
+++ trunk/gio/src/volumemonitor.hg	Wed Jan 16 21:10:11 2008
@@ -17,7 +17,8 @@
  * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include <glibmm/object.h>
+#include <giomm/volume.h>
+#include <giomm/mount.h>
 
 _DEFS(giomm,gio)
 _PINCLUDE(glibmm/private/object_p.h)
@@ -25,33 +26,32 @@
 namespace Gio
 {
 
-_WRAP_ENUM(FileMonitorEvent, GFileMonitorEvent, NO_GTYPE)
+_WRAP_ENUM(VolumeMonitorEvent, GVolumeMonitorEvent, NO_GTYPE)
 
 /** Monitors a file or directory for changes.
  * TODO: Documentation: See http://bugzilla.gnome.org/show_bug.cgi?id=509994.
  * @newin2p16
  */
-class FileMonitor : public Glib::Object
+class VolumeMonitor : public Glib::Object
 {
-  _CLASS_GOBJECT(FileMonitor, GFileMonitor, G_FILE_MONITOR, Glib::Object, GObject)
+  _CLASS_GOBJECT(VolumeMonitor, GVolumeMonitor, G_VOLUME_MONITOR, Glib::Object, GObject)
 protected:
 
 public:
-  
-  _WRAP_METHOD(bool cancel(), g_file_monitor_cancel)
-  _WRAP_METHOD(bool is_cancelled() const, g_file_monitor_is_cancelled)
-  _WRAP_METHOD(void set_rate_limit(int limit_msecs), g_file_monitor_set_rate_limit)
 
-  //g_file_monitor_emit_event is for implementations.
-  _IGNORE(g_file_monitor_emit_event)
+  _WRAP_METHOD(static Glib::RefPtr<VolumeMonitor> get(), g_volume_monitor_get)
+//TODO: GList *         g_volume_monitor_get_connected_drives    (GVolumeMonitor  *volume_monitor);
+//TODO: GList *         g_volume_monitor_get_volumes             (GVolumeMonitor  *volume_monitor);
+//TODO: GList *         g_volume_monitor_get_mounts              (GVolumeMonitor  *volume_monitor);
+  _WRAP_METHOD(Glib::RefPtr<Volume> get_volume_for_uuid(const std::string& uuid), g_volume_monitor_get_volume_for_uuid, refreturn)
+  _WRAP_METHOD(Glib::RefPtr<Mount> get_mount_for_uuid(const std::string& uuid), g_volume_monitor_get_mount_for_uuid, refreturn)
+
+  _WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount), g_volume_monitor_adopt_orphan_mount)
 
-  _WRAP_SIGNAL(void changed(const Glib::RefPtr<File>& file, const Glib::RefPtr<File>& other_file, FileMonitorEvent event_type), "changed")
   
-  //TODO: Write .defs for the vfunc:
-  _WRAP_VFUNC(bool cancel(), cancel);
+  //TODO: vfuncs and signals.
 
-  _WRAP_PROPERTY("rate-limit", int)
-  _WRAP_PROPERTY("cancelled", bool)
+  //There are no properties.
 };
 
 } // namespace Gio

Modified: trunk/tools/extra_defs_gen/generate_defs_gio.cc
==============================================================================
--- trunk/tools/extra_defs_gen/generate_defs_gio.cc	(original)
+++ trunk/tools/extra_defs_gen/generate_defs_gio.cc	Wed Jan 16 21:10:11 2008
@@ -40,6 +40,7 @@
 
             << get_defs(G_TYPE_INPUT_STREAM)
             << get_defs(G_TYPE_LOADABLE_ICON)
+            << get_defs(G_TYPE_MOUNT)
             << get_defs(G_TYPE_MOUNT_OPERATION)
             << get_defs(G_TYPE_SIMPLE_ASYNC_RESULT)
 

Modified: trunk/tools/m4/convert_gio.m4
==============================================================================
--- trunk/tools/m4/convert_gio.m4	(original)
+++ trunk/tools/m4/convert_gio.m4	Wed Jan 16 21:10:11 2008
@@ -5,6 +5,7 @@
 _CONV_ENUM(G,FileCopyFlags)
 _CONV_ENUM(G,FileCreateFlags)
 _CONV_ENUM(G,FileMonitorFlags)
+_CONV_ENUM(G,FileMonitorEvent)
 _CONV_ENUM(G,FileQueryInfoFlags)
 _CONV_ENUM(G,FileType)
 _CONV_ENUM(G,OutputStreamSpliceFlags)
@@ -71,9 +72,17 @@
 # InputStream
 _CONVERSION(`const Glib::RefPtr<InputStream>&',`GInputStream*',__CONVERT_CONST_REFPTR_TO_P)
 
+#Mount
+_CONVERSION(`GMount*',`Glib::RefPtr<Mount>',`Glib::wrap($3)')
+_CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P)
+
 # MountOptions
 _CONVERSION(`GPasswordSave',`PasswordSave',`($2)$3')
 _CONVERSION(`PasswordSave',`GPasswordSave',`($2)$3')
 
 #Volume
 _CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)')
+
+# VolumeMonitor
+_CONVERSION(`GVolumeMonitor*',`Glib::RefPtr<VolumeMonitor>',`Glib::wrap($3)')
+



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