diff options
-rw-r--r-- | ChangeLog | 17 | ||||
-rw-r--r-- | gio/src/drive.hg | 5 | ||||
-rw-r--r-- | gio/src/file.ccg | 21 | ||||
-rw-r--r-- | gio/src/file.hg | 29 | ||||
-rw-r--r-- | gio/src/filterinputstream.hg | 2 | ||||
-rw-r--r-- | gio/src/filteroutputstream.hg | 2 | ||||
-rw-r--r-- | gio/src/gio_signals.defs | 228 | ||||
-rw-r--r-- | gio/src/mount.hg | 1 | ||||
-rw-r--r-- | gio/src/mountoperation.hg | 19 | ||||
-rw-r--r-- | gio/src/volume.hg | 4 | ||||
-rw-r--r-- | gio/src/volumemonitor.hg | 19 | ||||
-rw-r--r-- | tools/extra_defs_gen/generate_defs_gio.cc | 11 | ||||
-rw-r--r-- | tools/m4/convert_gio.m4 | 7 |
13 files changed, 357 insertions, 8 deletions
@@ -1,5 +1,22 @@ 2008-02-03 Murray Cumming <murrayc@murrayc.com> + * tools/extra_defs_gen/generate_defs_gio.cc: Added types. + * gio/src/gio_signals.defs: Regenerated. + + * tools/m4/convert_gio.m4: + * gio/src/drive.hg: + * gio/src/filterinputstream.hg: + * gio/src/filteroutputstream.hg: + * gio/src/mount.hg: + * gio/src/mountoperation.hg: + * gio/src/volume.hg: + * gio/src/volumemonitor.hg: Added signals and properties. + + * gio/src/file.ccg: + * gio/src/file.hg: Added query_filesystem_info() without a cancellable. + +2008-02-03 Murray Cumming <murrayc@murrayc.com> + * gio/src/filemonitor.hg: Add class documentation, now that there is some in gio. * gio/src/volumemonitor.hg: Add class documentation. diff --git a/gio/src/drive.hg b/gio/src/drive.hg index 520ddff6..db48ccf6 100644 --- a/gio/src/drive.hg +++ b/gio/src/drive.hg @@ -109,10 +109,11 @@ public: g_drive_poll_for_media_finish, errthrow) - /* vfuncs */ + _WRAP_METHOD(std::string get_identifier(const std::string& kind) const, g_drive_get_identifier) + _WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, g_drive_enumerate_identifiers) _WRAP_VFUNC(Glib::ustring get_name() const, get_name) - //TODO: Careful of ref-countign: _WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, get_icon) + //TODO: Careful of ref-counting: _WRAP_VFUNC(Glib::RefPtr<Icon> get_icon() const, get_icon) _WRAP_VFUNC(bool has_volumes() const, has_volumes) //TODO: finish }; diff --git a/gio/src/file.ccg b/gio/src/file.ccg index 36f0a2b3..017dedab 100644 --- a/gio/src/file.ccg +++ b/gio/src/file.ccg @@ -375,6 +375,27 @@ Glib::RefPtr<FileInfo> File::query_filesystem_info(const Glib::RefPtr<Cancellabl } #ifdef GLIBMM_EXCEPTIONS_ENABLED +Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes) +#else +Glib::RefPtr<FileInfo> File::query_filesystem_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error) +#endif //GLIBMM_EXCEPTIONS_ENABLED +{ + GError* gerror = 0; + Glib::RefPtr<FileInfo> retvalue = Glib::wrap(g_file_query_filesystem_info(gobj(), attributes.c_str(), 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 + + if(retvalue) + retvalue->reference(); //The function does not do a ref for us. + return retvalue; +} + +#ifdef GLIBMM_EXCEPTIONS_ENABLED Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags) #else Glib::RefPtr<FileEnumerator> File::enumerate_children(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, FileQueryInfoFlags flags, std::auto_ptr<Glib::Error>& error) diff --git a/gio/src/file.hg b/gio/src/file.hg index 70cfa2b8..19884835 100644 --- a/gio/src/file.hg +++ b/gio/src/file.hg @@ -626,7 +626,7 @@ public: g_file_query_info_finish, refreturn, errthrow) - /** Similar to g_file_query_info(), but obtains information + /** Similar to query_info(), but obtains information * about the filesystem the file is on, rather than the file itself. * For instance the amount of space availible and the type of * the filesystem. @@ -656,6 +656,33 @@ public: #else Glib::RefPtr<FileInfo> query_filesystem_info(const Glib::RefPtr<Cancellable>& cancellable, const std::string& attributes, std::auto_ptr<Glib::Error>& error); #endif //GLIBMM_EXCEPTIONS_ENABLED + + /** Similar to query_info(), but obtains information + * about the filesystem the file is on, rather than the file itself. + * For instance the amount of space availible and the type of + * the filesystem. + * + * The @a attribute value is a string that specifies the file attributes that + * should be gathered. It is not an error if its not possible to read a particular + * requested attribute from a file, it just won't be set. @a attribute should + * be a comma-separated list of attribute or attribute wildcards. The wildcard "*" + * means all attributes, and a wildcard like "fs:*" means all attributes in the fs + * namespace. The standard namespace for filesystem attributes is "fs". + * Common attributes of interest are FILE_ATTRIBUTE_FILESYSTEM_SIZE + * (the total size of the filesystem in bytes), FILE_ATTRIBUTE_FILESYSTEM_FREE (number of + * bytes availible), and FILE_ATTRIBUTE_FILESYSTEM_TYPE (type of the filesystem). + * + * + * If the file does not exist, the G_IO_ERROR_NOT_FOUND error will be returned. + * Other errors are possible too, and depend on what kind of filesystem the file is on. + * @param attributes An attribute query string. + * @return A FileInfo or an empty RefPtr if there was an error. + */ +#ifdef GLIBMM_EXCEPTIONS_ENABLED + Glib::RefPtr<FileInfo> query_filesystem_info(const std::string& attributes = "*"); +#else + Glib::RefPtr<FileInfo> query_filesystem_info(const std::string& attributes, std::auto_ptr<Glib::Error>& error); +#endif //GLIBMM_EXCEPTIONS_ENABLED _IGNORE(g_file_query_filesystem_info) _WRAP_METHOD(Glib::RefPtr<Mount> find_enclosing_mount(const Glib::RefPtr<Cancellable>& cancellable), diff --git a/gio/src/filterinputstream.hg b/gio/src/filterinputstream.hg index 5f2ca6ff..9508ec37 100644 --- a/gio/src/filterinputstream.hg +++ b/gio/src/filterinputstream.hg @@ -37,6 +37,8 @@ public: _WRAP_METHOD(Glib::RefPtr<const InputStream> get_base_stream() const, g_filter_input_stream_get_base_stream, refreturn, constversion) + + _WRAP_PROPERTY("base-stream", Glib::RefPtr<InputStream>) }; } // namespace Gio diff --git a/gio/src/filteroutputstream.hg b/gio/src/filteroutputstream.hg index 1faa8e3c..fe0907ed 100644 --- a/gio/src/filteroutputstream.hg +++ b/gio/src/filteroutputstream.hg @@ -37,6 +37,8 @@ public: _WRAP_METHOD(Glib::RefPtr<const OutputStream> get_base_stream() const, g_filter_output_stream_get_base_stream, refreturn, constversion) + + _WRAP_PROPERTY("base-stream", Glib::RefPtr<InputStream>) }; } // namespace Gio diff --git a/gio/src/gio_signals.defs b/gio/src/gio_signals.defs index 7a8f127d..7617dade 100644 --- a/gio/src/gio_signals.defs +++ b/gio/src/gio_signals.defs @@ -8,6 +8,113 @@ (when "last") ) +;; From GBufferedInputStream + +(define-property base-stream + (of-object "GBufferedInputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property buffer-size + (of-object "GBufferedInputStream") + (prop-type "GParamUInt") + (docs "The size of the backend buffer") + (readable #t) + (writable #t) + (construct-only #f) +) + +;; From GBufferedOutputStream + +(define-property base-stream + (of-object "GBufferedOutputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property buffer-size + (of-object "GBufferedOutputStream") + (prop-type "GParamUInt") + (docs "The size of the backend buffer") + (readable #t) + (writable #t) + (construct-only #f) +) + +(define-property auto-grow + (of-object "GBufferedOutputStream") + (prop-type "GParamBoolean") + (docs "Whether the buffer should automatically grow") + (readable #t) + (writable #t) + (construct-only #f) +) + +;; From GDataInputStream + +(define-property base-stream + (of-object "GDataInputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property buffer-size + (of-object "GDataInputStream") + (prop-type "GParamUInt") + (docs "The size of the backend buffer") + (readable #t) + (writable #t) + (construct-only #f) +) + +(define-property byte-order + (of-object "GDataInputStream") + (prop-type "GParamEnum") + (docs "The byte order") + (readable #t) + (writable #t) + (construct-only #f) +) + +(define-property newline-type + (of-object "GDataInputStream") + (prop-type "GParamEnum") + (docs "The accepted types of line ending") + (readable #t) + (writable #t) + (construct-only #f) +) + +;; From GDataOutputStream + +(define-property base-stream + (of-object "GDataOutputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + +(define-property byte-order + (of-object "GDataOutputStream") + (prop-type "GParamEnum") + (docs "The byte order") + (readable #t) + (writable #t) + (construct-only #f) +) + ;; From GDrive ;; From GFile @@ -53,10 +160,36 @@ ;; From GFileOutputStream +;; From GFilterInputStream + +(define-property base-stream + (of-object "GFilterInputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + +;; From GFilterOutputStream + +(define-property base-stream + (of-object "GFilterOutputStream") + (prop-type "GParamObject") + (docs "The underlying base stream the io ops will be done on") + (readable #t) + (writable #t) + (construct-only #t) +) + ;; From GInputStream ;; From GLoadableIcon +;; From GMemoryInputStream + +;; From GMemoryOutputStream + ;; From GMount ;; From GMountOperation @@ -146,9 +279,102 @@ (construct-only #f) ) +;; From GSeekable + ;; From GSimpleAsyncResult ;; From GVolume -;; Warning: g_object_interface_list_properties() returned NULL for GVolume +;; From GVolumeMonitor + +(define-signal volume-added + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GVolume*" "p0") + ) +) + +(define-signal volume-removed + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GVolume*" "p0") + ) +) + +(define-signal volume-changed + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GVolume*" "p0") + ) +) + +(define-signal mount-added + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GMount*" "p0") + ) +) + +(define-signal mount-removed + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GMount*" "p0") + ) +) + +(define-signal mount-pre-unmount + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GMount*" "p0") + ) +) + +(define-signal mount-changed + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GMount*" "p0") + ) +) + +(define-signal drive-connected + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GDrive*" "p0") + ) +) + +(define-signal drive-disconnected + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GDrive*" "p0") + ) +) + +(define-signal drive-changed + (of-object "GVolumeMonitor") + (return-type "void") + (when "last") + (parameters + '("GDrive*" "p0") + ) +) + diff --git a/gio/src/mount.hg b/gio/src/mount.hg index 9d1371c7..3abb72f6 100644 --- a/gio/src/mount.hg +++ b/gio/src/mount.hg @@ -165,6 +165,7 @@ public: _WRAP_METHOD(bool eject_finish(const Glib::RefPtr<AsyncResult>& result), g_mount_eject_finish, errthrow) + //TODO: For some reason these are not in gio_signals.defs. We may need to hand-write them in gio_others.defs. murrayc. _WRAP_SIGNAL(void changed(), changed) _WRAP_SIGNAL(void unmounted(), unmounted) diff --git a/gio/src/mountoperation.hg b/gio/src/mountoperation.hg index e3bf510e..9d9323d1 100644 --- a/gio/src/mountoperation.hg +++ b/gio/src/mountoperation.hg @@ -21,11 +21,12 @@ _DEFS(giomm,gio) _PINCLUDE(glibmm/private/object_p.h) +_PINCLUDE(gio/gio.h) namespace Gio { -_WRAP_ENUM(PasswordFlags, GPasswordFlags, NO_GTYPE) +_WRAP_ENUM(AskPasswordFlags, GAskPasswordFlags, NO_GTYPE) _WRAP_ENUM(PasswordSave, GPasswordSave, NO_GTYPE) _WRAP_ENUM(MountOperationResult, GMountOperationResult, NO_GTYPE) @@ -74,6 +75,22 @@ public: _WRAP_METHOD(int get_choice() const, g_mount_operation_get_choice) _WRAP_METHOD(void set_choice(int choice), g_mount_operation_set_choice) _WRAP_METHOD(void reply(MountOperationResult result), g_mount_operation_reply) + +#m4 _CONVERSION(`const char*',`const Glib::ustring&',__GCHARP_TO_USTRING) + _WRAP_SIGNAL(void ask_password(const Glib::ustring& message, const Glib::ustring& default_user, const Glib::ustring& default_domain, AskPasswordFlags flags), ask_password) + //TODO:_WRAP_SIGNAL(void ask_question(const Glib::ustring& message, const Glib::ustring& choices[]), ask_question) + _WRAP_SIGNAL(void reply(MountOperationResult result), reply) + + + _WRAP_PROPERTY("username", Glib::ustring) + _WRAP_PROPERTY("password", Glib::ustring) + _WRAP_PROPERTY("anonymous", bool) + _WRAP_PROPERTY("domain", Glib::ustring) + _WRAP_PROPERTY("password-save", PasswordSave) + _WRAP_PROPERTY("choice", int) + + //TODO: vfuncs + }; } // namespace Gio diff --git a/gio/src/volume.hg b/gio/src/volume.hg index 28919d07..3746be55 100644 --- a/gio/src/volume.hg +++ b/gio/src/volume.hg @@ -151,7 +151,9 @@ public: _WRAP_METHOD(Glib::StringArrayHandle enumerate_identifiers() const, g_volume_enumerate_identifiers) - _WRAP_SIGNAL(void changed(), "changed") + //TODO: For some reason these are not in gio_signals.defs. We may need to hand-write them in gio_others.defs. murrayc. + _WRAP_SIGNAL(void changed(), changed) + _WRAP_SIGNAL(void removed(), removed) /* vfuncs */ //TODO diff --git a/gio/src/volumemonitor.hg b/gio/src/volumemonitor.hg index c813c198..a28dd9a2 100644 --- a/gio/src/volumemonitor.hg +++ b/gio/src/volumemonitor.hg @@ -57,8 +57,23 @@ public: _WRAP_METHOD(static Glib::RefPtr<Volume> adopt_orphan_mount(const Glib::RefPtr<Mount>& mount), g_volume_monitor_adopt_orphan_mount) - - //TODO: signals, vfuncs +#m4 _CONVERSION(`GVolume*',`const Glib::RefPtr<Volume>&',`Glib::wrap($3, true)') + _WRAP_SIGNAL(void volume_added(const Glib::RefPtr<Volume>& volume), volume_added) + _WRAP_SIGNAL(void volume_removed(const Glib::RefPtr<Volume>& volume), volume_removed) + _WRAP_SIGNAL(void volume_changed(const Glib::RefPtr<Volume>& volume), volume_changed) + +#m4 _CONVERSION(`GMount*',`const Glib::RefPtr<Mount>&',`Glib::wrap($3, true)') + _WRAP_SIGNAL(void mount_added(const Glib::RefPtr<Mount>& mount), mount_added) + _WRAP_SIGNAL(void mount_removed(const Glib::RefPtr<Mount>& mount), mount_removed) + _WRAP_SIGNAL(void mount_pre_unmount(const Glib::RefPtr<Mount>& mount), mount_pre_unmount) + _WRAP_SIGNAL(void mount_changed(const Glib::RefPtr<Mount>& mount), mount_changed) + +#m4 _CONVERSION(`GDrive*',`const Glib::RefPtr<Drive>&',`Glib::wrap($3, true)') + _WRAP_SIGNAL(void drive_connected(const Glib::RefPtr<Drive>& drive), drive_connected) + _WRAP_SIGNAL(void drive_disconnected(const Glib::RefPtr<Drive>& drive), drive_disconnected) + _WRAP_SIGNAL(void drive_changed(const Glib::RefPtr<Drive>& drive), drive_changed) + + //TODO: vfuncs //There are no properties. }; diff --git a/tools/extra_defs_gen/generate_defs_gio.cc b/tools/extra_defs_gen/generate_defs_gio.cc index 981696fd..b17e24d8 100644 --- a/tools/extra_defs_gen/generate_defs_gio.cc +++ b/tools/extra_defs_gen/generate_defs_gio.cc @@ -27,6 +27,10 @@ int main (int argc, char** argv) std::cout << get_defs(G_TYPE_ASYNC_RESULT) << get_defs(G_TYPE_CANCELLABLE) + << get_defs(G_TYPE_BUFFERED_INPUT_STREAM) + << get_defs(G_TYPE_BUFFERED_OUTPUT_STREAM) + << get_defs(G_TYPE_DATA_INPUT_STREAM) + << get_defs(G_TYPE_DATA_OUTPUT_STREAM) << get_defs(G_TYPE_DRIVE) << get_defs(G_TYPE_FILE) << get_defs(G_TYPE_FILE_ENUMERATOR) @@ -37,17 +41,24 @@ int main (int argc, char** argv) // << get_defs(G_TYPE_FILE_ATTRIBUTE_MATCHER) << get_defs(G_TYPE_FILE_INPUT_STREAM) << get_defs(G_TYPE_FILE_OUTPUT_STREAM) + << get_defs(G_TYPE_FILTER_INPUT_STREAM) + << get_defs(G_TYPE_FILTER_OUTPUT_STREAM) << get_defs(G_TYPE_INPUT_STREAM) << get_defs(G_TYPE_LOADABLE_ICON) + << get_defs(G_TYPE_MEMORY_INPUT_STREAM) + << get_defs(G_TYPE_MEMORY_OUTPUT_STREAM) << get_defs(G_TYPE_MOUNT) << get_defs(G_TYPE_MOUNT_OPERATION) + << get_defs(G_TYPE_SEEKABLE) << get_defs(G_TYPE_SIMPLE_ASYNC_RESULT) //TODO: This causes a g_warning: //GLib-GObject-CRITICAL **: g_param_spec_pool_list: assertion `pool != NULL' failed" << get_defs(G_TYPE_VOLUME) + << get_defs(G_TYPE_VOLUME_MONITOR) + << std::endl; return 0; diff --git a/tools/m4/convert_gio.m4 b/tools/m4/convert_gio.m4 index 99c0497d..5557b6c1 100644 --- a/tools/m4/convert_gio.m4 +++ b/tools/m4/convert_gio.m4 @@ -1,4 +1,5 @@ _CONV_ENUM(G,PasswordSave) +_CONV_ENUM(G,AskPasswordFlags) _CONV_ENUM(G,MountOperationResult) _CONV_ENUM(G,MountUnmountFlags) _CONV_ENUM(G,FileAttributeType) @@ -90,6 +91,9 @@ _CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P) _CONVERSION(`GPasswordSave',`PasswordSave',`($2)$3') _CONVERSION(`PasswordSave',`GPasswordSave',`($2)$3') +#MountOperation +#_CONVERSION(`GAskPasswordFlags',`AskPasswordFlags',`($2)$3') + # OutputStream _CONVERSION(`GOutputStream*',`Glib::RefPtr<OutputStream>',`Glib::wrap($3)') _CONVERSION(`const Glib::RefPtr<OutputStream>&',`GOutputStream*',__CONVERT_CONST_REFPTR_TO_P) @@ -99,4 +103,7 @@ _CONVERSION(`GVolume*',`Glib::RefPtr<Volume>',`Glib::wrap($3)') # VolumeMonitor _CONVERSION(`GVolumeMonitor*',`Glib::RefPtr<VolumeMonitor>',`Glib::wrap($3)') +_CONVERSION(`const Glib::RefPtr<Drive>&',`GDrive*',__CONVERT_CONST_REFPTR_TO_P) +_CONVERSION(`const Glib::RefPtr<Mount>&',`GMount*',__CONVERT_CONST_REFPTR_TO_P) +_CONVERSION(`const Glib::RefPtr<Volume>&',`GVolume*',__CONVERT_CONST_REFPTR_TO_P) |