summaryrefslogtreecommitdiff
path: root/libcaja-extension/caja-file-info.h
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-extension/caja-file-info.h')
-rw-r--r--libcaja-extension/caja-file-info.h232
1 files changed, 135 insertions, 97 deletions
diff --git a/libcaja-extension/caja-file-info.h b/libcaja-extension/caja-file-info.h
index 6ad2d10f..24892d73 100644
--- a/libcaja-extension/caja-file-info.h
+++ b/libcaja-extension/caja-file-info.h
@@ -29,112 +29,150 @@
#include <glib-object.h>
#include <gio/gio.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_FILE_INFO (caja_file_info_get_type ())
#define CAJA_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_FILE_INFO, CajaFileInfo))
#define CAJA_IS_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_FILE_INFO))
#define CAJA_FILE_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_FILE_INFO, CajaFileInfoIface))
-
#ifndef CAJA_FILE_DEFINED
#define CAJA_FILE_DEFINED
- /* Using CajaFile for the vtable to make implementing this in
- * CajaFile easier */
- typedef struct CajaFile CajaFile;
+/* Using CajaFile for the vtable to make implementing this in
+ * CajaFile easier */
+typedef struct CajaFile CajaFile;
#endif
- typedef CajaFile CajaFileInfo;
- typedef struct _CajaFileInfoIface CajaFileInfoIface;
-
-
- struct _CajaFileInfoIface
- {
- GTypeInterface g_iface;
-
- gboolean (*is_gone) (CajaFileInfo *file);
-
- char * (*get_name) (CajaFileInfo *file);
- char * (*get_uri) (CajaFileInfo *file);
- char * (*get_parent_uri) (CajaFileInfo *file);
- char * (*get_uri_scheme) (CajaFileInfo *file);
-
- char * (*get_mime_type) (CajaFileInfo *file);
- gboolean (*is_mime_type) (CajaFileInfo *file,
- const char *mime_Type);
- gboolean (*is_directory) (CajaFileInfo *file);
-
- void (*add_emblem) (CajaFileInfo *file,
- const char *emblem_name);
- char * (*get_string_attribute) (CajaFileInfo *file,
- const char *attribute_name);
- void (*add_string_attribute) (CajaFileInfo *file,
- const char *attribute_name,
- const char *value);
- void (*invalidate_extension_info) (CajaFileInfo *file);
-
- char * (*get_activation_uri) (CajaFileInfo *file);
-
- GFileType (*get_file_type) (CajaFileInfo *file);
- GFile * (*get_location) (CajaFileInfo *file);
- GFile * (*get_parent_location) (CajaFileInfo *file);
- CajaFileInfo* (*get_parent_info) (CajaFileInfo *file);
- GMount * (*get_mount) (CajaFileInfo *file);
- gboolean (*can_write) (CajaFileInfo *file);
-
- };
-
- GList *caja_file_info_list_copy (GList *files);
- void caja_file_info_list_free (GList *files);
- GType caja_file_info_get_type (void);
-
- /* Return true if the file has been deleted */
- gboolean caja_file_info_is_gone (CajaFileInfo *file);
-
- /* Name and Location */
- GFileType caja_file_info_get_file_type (CajaFileInfo *file);
- GFile * caja_file_info_get_location (CajaFileInfo *file);
- char * caja_file_info_get_name (CajaFileInfo *file);
- char * caja_file_info_get_uri (CajaFileInfo *file);
- char * caja_file_info_get_activation_uri (CajaFileInfo *file);
- GFile * caja_file_info_get_parent_location (CajaFileInfo *file);
- char * caja_file_info_get_parent_uri (CajaFileInfo *file);
- GMount * caja_file_info_get_mount (CajaFileInfo *file);
- char * caja_file_info_get_uri_scheme (CajaFileInfo *file);
- /* It's not safe to call this recursively multiple times, as it works
- * only for files already cached by Caja.
- */
- CajaFileInfo* caja_file_info_get_parent_info (CajaFileInfo *file);
-
- /* File Type */
- char * caja_file_info_get_mime_type (CajaFileInfo *file);
- gboolean caja_file_info_is_mime_type (CajaFileInfo *file,
- const char *mime_type);
- gboolean caja_file_info_is_directory (CajaFileInfo *file);
- gboolean caja_file_info_can_write (CajaFileInfo *file);
-
-
- /* Modifying the CajaFileInfo */
- void caja_file_info_add_emblem (CajaFileInfo *file,
- const char *emblem_name);
- char * caja_file_info_get_string_attribute (CajaFileInfo *file,
- const char *attribute_name);
- void caja_file_info_add_string_attribute (CajaFileInfo *file,
- const char *attribute_name,
- const char *value);
-
- /* Invalidating file info */
- void caja_file_info_invalidate_extension_info (CajaFileInfo *file);
-
- CajaFileInfo *caja_file_info_lookup (GFile *location);
- CajaFileInfo *caja_file_info_create (GFile *location);
- CajaFileInfo *caja_file_info_lookup_for_uri (const char *uri);
- CajaFileInfo *caja_file_info_create_for_uri (const char *uri);
-
-#ifdef __cplusplus
-}
-#endif
+typedef CajaFile CajaFileInfo;
+typedef struct _CajaFileInfoIface CajaFileInfoIface;
+
+/**
+ * CajaFileInfoIface:
+ * @g_iface: The parent interface.
+ * @is_gone: Returns whether the file info is gone.
+ * See caja_file_info_is_gone() for details.
+ * @get_name: Returns the file name as a string.
+ * See caja_file_info_get_name() for details.
+ * @get_uri: Returns the file URI as a string.
+ * See caja_file_info_get_uri() for details.
+ * @get_parent_uri: Returns the file parent URI as a string.
+ * See caja_file_info_get_parent_uri() for details.
+ * @get_uri_scheme: Returns the file URI scheme as a string.
+ * See caja_file_info_get_uri_scheme() for details.
+ * @get_mime_type: Returns the file mime type as a string.
+ * See caja_file_info_get_mime_type() for details.
+ * @is_mime_type: Returns whether the file is the given mime type.
+ * See caja_file_info_is_mime_type() for details.
+ * @is_directory: Returns whether the file is a directory.
+ * See caja_file_info_is_directory() for details.
+ * @add_emblem: Adds an emblem to this file.
+ * See caja_file_info_add_emblem() for details.
+ * @get_string_attribute: Returns the specified file attribute as a string.
+ * See caja_file_info_get_string_attribute() for details.
+ * @add_string_attribute: Sets the specified string file attribute value.
+ * See caja_file_info_add_string_attribute() for details.
+ * @invalidate_extension_info: Invalidates information of the file provided by extensions.
+ * See caja_file_info_invalidate_extension_info() for details.
+ * @get_activation_uri: Returns the file activation URI as a string.
+ * See caja_file_info_get_activation_uri() for details.
+ * @get_file_type: Returns the file type.
+ * See caja_file_info_get_file_type() for details.
+ * @get_location: Returns the file location as a #GFile.
+ * See caja_file_info_get_location() for details.
+ * @get_parent_location: Returns the file parent location as a #GFile.
+ * See caja_file_info_get_parent_location() for details.
+ * @get_parent_info: Returns the file parent #CajaFileInfo.
+ * See caja_file_info_get_parent_info() for details.
+ * @get_mount: Returns the file mount as a #GMount.
+ * See caja_file_info_get_mount() for details.
+ * @can_write: Returns whether the file is writable.
+ * See caja_file_info_can_write() for details.
+ *
+ * Interface for extensions to get and modify information
+ * about file objects.
+ */
+
+struct _CajaFileInfoIface {
+ GTypeInterface g_iface;
+
+ gboolean (*is_gone) (CajaFileInfo *file);
+
+ char *(*get_name) (CajaFileInfo *file);
+ char *(*get_uri) (CajaFileInfo *file);
+ char *(*get_parent_uri) (CajaFileInfo *file);
+ char *(*get_uri_scheme) (CajaFileInfo *file);
+
+ char *(*get_mime_type) (CajaFileInfo *file);
+ gboolean (*is_mime_type) (CajaFileInfo *file,
+ const char *mime_Type);
+ gboolean (*is_directory) (CajaFileInfo *file);
+
+ void (*add_emblem) (CajaFileInfo *file,
+ const char *emblem_name);
+ char *(*get_string_attribute) (CajaFileInfo *file,
+ const char *attribute_name);
+ void (*add_string_attribute) (CajaFileInfo *file,
+ const char *attribute_name,
+ const char *value);
+ void (*invalidate_extension_info) (CajaFileInfo *file);
+
+ char *(*get_activation_uri) (CajaFileInfo *file);
+
+ GFileType (*get_file_type) (CajaFileInfo *file);
+ GFile *(*get_location) (CajaFileInfo *file);
+ GFile *(*get_parent_location) (CajaFileInfo *file);
+ CajaFileInfo *(*get_parent_info) (CajaFileInfo *file);
+ GMount *(*get_mount) (CajaFileInfo *file);
+ gboolean (*can_write) (CajaFileInfo *file);
+};
+
+GList *caja_file_info_list_copy (GList *files);
+void caja_file_info_list_free (GList *files);
+GType caja_file_info_get_type (void);
+
+/* Return true if the file has been deleted */
+gboolean caja_file_info_is_gone (CajaFileInfo *file);
+
+/* Name and Location */
+GFileType caja_file_info_get_file_type (CajaFileInfo *file);
+GFile *caja_file_info_get_location (CajaFileInfo *file);
+char *caja_file_info_get_name (CajaFileInfo *file);
+char *caja_file_info_get_uri (CajaFileInfo *file);
+char *caja_file_info_get_activation_uri (CajaFileInfo *file);
+GFile *caja_file_info_get_parent_location (CajaFileInfo *file);
+char *caja_file_info_get_parent_uri (CajaFileInfo *file);
+GMount *caja_file_info_get_mount (CajaFileInfo *file);
+char *caja_file_info_get_uri_scheme (CajaFileInfo *file);
+/* It's not safe to call this recursively multiple times, as it works
+ * only for files already cached by Caja.
+ */
+CajaFileInfo *caja_file_info_get_parent_info (CajaFileInfo *file);
+
+/* File Type */
+char *caja_file_info_get_mime_type (CajaFileInfo *file);
+gboolean caja_file_info_is_mime_type (CajaFileInfo *file,
+ const char *mime_type);
+gboolean caja_file_info_is_directory (CajaFileInfo *file);
+gboolean caja_file_info_can_write (CajaFileInfo *file);
+
+
+/* Modifying the CajaFileInfo */
+void caja_file_info_add_emblem (CajaFileInfo *file,
+ const char *emblem_name);
+char *caja_file_info_get_string_attribute (CajaFileInfo *file,
+ const char *attribute_name);
+void caja_file_info_add_string_attribute (CajaFileInfo *file,
+ const char *attribute_name,
+ const char *value);
+
+/* Invalidating file info */
+void caja_file_info_invalidate_extension_info (CajaFileInfo *file);
+
+CajaFileInfo *caja_file_info_lookup (GFile *location);
+CajaFileInfo *caja_file_info_create (GFile *location);
+CajaFileInfo *caja_file_info_lookup_for_uri (const char *uri);
+CajaFileInfo *caja_file_info_create_for_uri (const char *uri);
+
+G_END_DECLS
#endif