diff options
Diffstat (limited to 'fiv-io-model.h')
-rw-r--r-- | fiv-io-model.h | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/fiv-io-model.h b/fiv-io-model.h index 2fb9ad7..c785130 100644 --- a/fiv-io-model.h +++ b/fiv-io-model.h @@ -20,15 +20,39 @@ #include <gio/gio.h> #include <glib.h> +// Avoid glib-mkenums. typedef enum _FivIoModelSort { - FIV_IO_MODEL_SORT_NAME, - FIV_IO_MODEL_SORT_MTIME, - FIV_IO_MODEL_SORT_COUNT, - - FIV_IO_MODEL_SORT_MIN = 0, - FIV_IO_MODEL_SORT_MAX = FIV_IO_MODEL_SORT_COUNT - 1 +#define FIV_IO_MODEL_SORTS(XX) \ + XX(NAME) \ + XX(MTIME) +#define XX(name) FIV_IO_MODEL_SORT_ ## name, + FIV_IO_MODEL_SORTS(XX) +#undef XX + FIV_IO_MODEL_SORT_COUNT } FivIoModelSort; +GType fiv_io_model_sort_get_type(void) G_GNUC_CONST; +#define FIV_TYPE_IO_MODEL_SORT (fiv_io_model_sort_get_type()) + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +typedef struct { + const char *uri; ///< GIO URI + const char *target_uri; ///< GIO URI for any target + const char *display_name; ///< Label for the file + const char *collate_key; ///< Collate key for the filename + guint64 filesize; ///< Filesize in bytes + gint64 mtime_msec; ///< Modification time in milliseconds +} FivIoModelEntry; + +GType fiv_io_model_entry_get_type(void) G_GNUC_CONST; +#define FIV_TYPE_IO_MODEL_ENTRY (fiv_io_model_entry_get_type()) + +FivIoModelEntry *fiv_io_model_entry_ref(FivIoModelEntry *self); +void fiv_io_model_entry_unref(FivIoModelEntry *self); + +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + #define FIV_TYPE_IO_MODEL (fiv_io_model_get_type()) G_DECLARE_FINAL_TYPE(FivIoModel, fiv_io_model, FIV, IO_MODEL, GObject) @@ -44,18 +68,5 @@ GFile *fiv_io_model_get_previous_directory(FivIoModel *self); /// Returns the next VFS directory in order, or NULL. GFile *fiv_io_model_get_next_directory(FivIoModel *self); -// These objects are reference-counted using GRcBox. -typedef struct { - const char *uri; ///< GIO URI - const char *target_uri; ///< GIO URI for any target - const char *display_name; ///< Label for the file - const char *collate_key; ///< Collate key for the filename - guint64 filesize; ///< Filesize in bytes - gint64 mtime_msec; ///< Modification time in milliseconds -} FivIoModelEntry; - -#define fiv_io_model_entry_ref(e) g_rc_box_acquire(e) -#define fiv_io_model_entry_unref(e) g_rc_box_release(e) - FivIoModelEntry *const *fiv_io_model_get_files(FivIoModel *self, gsize *len); FivIoModelEntry *const *fiv_io_model_get_subdirs(FivIoModel *self, gsize *len); |