summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/reference/libcaja-extension/libcaja-extension-docs.xml1
-rw-r--r--docs/reference/libcaja-extension/libcaja-extension-sections.txt47
-rw-r--r--libcaja-extension/caja-column-provider.c17
-rw-r--r--libcaja-extension/caja-column-provider.h36
-rw-r--r--libcaja-extension/caja-column.c25
-rw-r--r--libcaja-extension/caja-column.h56
-rw-r--r--libcaja-extension/caja-extension-types.c7
-rw-r--r--libcaja-extension/caja-extension-types.h75
-rw-r--r--libcaja-extension/caja-file-info.c21
-rw-r--r--libcaja-extension/caja-file-info.h232
-rw-r--r--libcaja-extension/caja-info-provider.c35
-rw-r--r--libcaja-extension/caja-info-provider.h92
-rw-r--r--libcaja-extension/caja-location-widget-provider.c22
-rw-r--r--libcaja-extension/caja-location-widget-provider.h43
-rw-r--r--libcaja-extension/caja-menu-item.c41
-rw-r--r--libcaja-extension/caja-menu-provider.c65
-rw-r--r--libcaja-extension/caja-menu-provider.h76
-rw-r--r--libcaja-extension/caja-menu.c17
-rw-r--r--libcaja-extension/caja-menu.h143
-rw-r--r--libcaja-extension/caja-property-page-provider.c16
-rw-r--r--libcaja-extension/caja-property-page-provider.h40
-rw-r--r--libcaja-extension/caja-property-page.c43
-rw-r--r--libcaja-extension/caja-property-page.h48
23 files changed, 663 insertions, 535 deletions
diff --git a/docs/reference/libcaja-extension/libcaja-extension-docs.xml b/docs/reference/libcaja-extension/libcaja-extension-docs.xml
index c9c0f118..b0b6cf03 100644
--- a/docs/reference/libcaja-extension/libcaja-extension-docs.xml
+++ b/docs/reference/libcaja-extension/libcaja-extension-docs.xml
@@ -24,6 +24,7 @@
<xi:include href="xml/caja-location-widget-provider.xml" />
<xi:include href="xml/caja-menu-provider.xml" />
<xi:include href="xml/caja-menu.xml" />
+ <xi:include href="xml/caja-menu-item.xml" />
<xi:include href="xml/caja-property-page-provider.xml" />
<xi:include href="xml/caja-property-page.xml" />
</chapter>
diff --git a/docs/reference/libcaja-extension/libcaja-extension-sections.txt b/docs/reference/libcaja-extension/libcaja-extension-sections.txt
index 9de8dbfe..1e899c4c 100644
--- a/docs/reference/libcaja-extension/libcaja-extension-sections.txt
+++ b/docs/reference/libcaja-extension/libcaja-extension-sections.txt
@@ -29,26 +29,12 @@ CAJA_MENU_PROVIDER_GET_IFACE
<SECTION>
<FILE>caja-menu</FILE>
-CAJA_TYPE_MENU_ITEM
-CAJA_MENU_ITEM
-CAJA_MENU_ITEM_CLASS
-CAJA_MENU_IS_ITEM
-CAJA_MENU_IS_ITEM_CLASS
-CAJA_MENU_ITEM_GET_CLASS
CajaMenuPrivate
-CajaMenuItemDetails
-<TITLE>CajaMenu</TITLE>
CajaMenu
-<TITLE>CajaMenuItem</TITLE>
-CajaMenuItem
caja_menu_new
caja_menu_append_item
caja_menu_get_items
caja_menu_item_list_free
-caja_menu_item_get_type
-caja_menu_item_new
-caja_menu_item_activate
-caja_menu_item_set_submenu
<SUBSECTION Standard>
CAJA_MENU
CAJA_IS_MENU
@@ -60,6 +46,23 @@ CAJA_MENU_GET_CLASS
</SECTION>
<SECTION>
+<FILE>caja-menu-item</FILE>
+CajaMenuItem
+caja_menu_item_get_type
+caja_menu_item_new
+caja_menu_item_activate
+caja_menu_item_set_submenu
+<SUBSECTION Standard>
+CAJA_TYPE_MENU_ITEM
+CAJA_MENU_ITEM
+CAJA_MENU_ITEM_CLASS
+CAJA_MENU_IS_ITEM
+CAJA_MENU_IS_ITEM_CLASS
+CAJA_MENU_ITEM_GET_CLASS
+CajaMenuItemDetails
+</SECTION>
+
+<SECTION>
<FILE>caja-column-provider</FILE>
CajaColumnProvider
CajaColumnProviderIface
@@ -91,8 +94,13 @@ CAJA_FILE_DEFINED
CajaFile
CajaFileInfo
CajaFileInfoIface
+caja_file_info_create
+caja_file_info_create_for_uri
+caja_file_info_getter
caja_file_info_list_copy
caja_file_info_list_free
+caja_file_info_lookup
+caja_file_info_lookup_for_uri
caja_file_info_is_gone
caja_file_info_get_file_type
caja_file_info_get_location
@@ -122,8 +130,6 @@ CAJA_FILE_INFO_GET_IFACE
<SECTION>
<FILE>caja-column</FILE>
-CajaColumnDetails
-<TITLE>CajaColumn</TITLE>
CajaColumn
caja_column_new
<SUBSECTION Standard>
@@ -134,6 +140,7 @@ caja_column_get_type
CAJA_COLUMN_CLASS
CAJA_INFO_IS_COLUMN_CLASS
CAJA_COLUMN_GET_CLASS
+CajaColumnDetails
</SECTION>
<SECTION>
@@ -154,8 +161,6 @@ CAJA_INFO_PROVIDER_GET_IFACE
<SECTION>
<FILE>caja-property-page</FILE>
-CajaPropertyPageDetails
-<TITLE>CajaPropertyPage</TITLE>
CajaPropertyPage
caja_property_page_new
<SUBSECTION Standard>
@@ -166,6 +171,7 @@ caja_property_page_get_type
CAJA_PROPERTY_PAGE_CLASS
CAJA_IS_PROPERTY_PAGE_CLASS
CAJA_PROPERTY_PAGE_GET_CLASS
+CajaPropertyPageDetails
</SECTION>
<SECTION>
@@ -177,9 +183,6 @@ caja_operation_result_get_type
caja_module_initialize
caja_module_shutdown
caja_module_list_types
-</SECTION>
-
-<SECTION>
-<FILE>caja-menu-item</FILE>
+caja_module_list_pyfiles
</SECTION>
diff --git a/libcaja-extension/caja-column-provider.c b/libcaja-extension/caja-column-provider.c
index 87833c90..bc1ee98c 100644
--- a/libcaja-extension/caja-column-provider.c
+++ b/libcaja-extension/caja-column-provider.c
@@ -27,6 +27,16 @@
#include <glib-object.h>
+/**
+ * SECTION:caja-column-provider
+ * @title: CajaColumnProvider
+ * @short_description: Interface to provide additional list view columns
+ * @include: libcaja-extension/caja-column-provider.h
+ *
+ * #CajaColumnProvider allows extension to provide additional columns
+ * in the file manager list view.
+ */
+
static void
caja_column_provider_base_init (gpointer g_class)
{
@@ -37,10 +47,8 @@ caja_column_provider_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaColumnProviderIface),
caja_column_provider_base_init,
NULL,
@@ -77,4 +85,3 @@ caja_column_provider_get_columns (CajaColumnProvider *provider)
(provider);
}
-
diff --git a/libcaja-extension/caja-column-provider.h b/libcaja-extension/caja-column-provider.h
index c3ba919f..78902a74 100644
--- a/libcaja-extension/caja-column-provider.h
+++ b/libcaja-extension/caja-column-provider.h
@@ -35,31 +35,35 @@
#include "caja-extension-types.h"
#include "caja-column.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_COLUMN_PROVIDER (caja_column_provider_get_type ())
#define CAJA_COLUMN_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_COLUMN_PROVIDER, CajaColumnProvider))
#define CAJA_IS_COLUMN_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_COLUMN_PROVIDER))
#define CAJA_COLUMN_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_COLUMN_PROVIDER, CajaColumnProviderIface))
- typedef struct _CajaColumnProvider CajaColumnProvider;
- typedef struct _CajaColumnProviderIface CajaColumnProviderIface;
+typedef struct _CajaColumnProvider CajaColumnProvider;
+typedef struct _CajaColumnProviderIface CajaColumnProviderIface;
- struct _CajaColumnProviderIface
- {
- GTypeInterface g_iface;
+/**
+ * CajaColumnProviderIface:
+ * @g_iface: The parent interface.
+ * @get_columns: Returns a #GList of #CajaColumn.
+ * See caja_column_provider_get_columns() for details.
+ *
+ * Interface for extensions to provide additional list view columns.
+ */
- GList *(*get_columns) (CajaColumnProvider *provider);
- };
+struct _CajaColumnProviderIface {
+ GTypeInterface g_iface;
- /* Interface Functions */
- GType caja_column_provider_get_type (void);
- GList *caja_column_provider_get_columns (CajaColumnProvider *provider);
+ GList *(*get_columns) (CajaColumnProvider *provider);
+};
-#ifdef __cplusplus
-}
-#endif
+/* Interface Functions */
+GType caja_column_provider_get_type (void);
+GList *caja_column_provider_get_columns (CajaColumnProvider *provider);
+
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-column.c b/libcaja-extension/caja-column.c
index ce0d2c33..bd3a23f3 100644
--- a/libcaja-extension/caja-column.c
+++ b/libcaja-extension/caja-column.c
@@ -26,8 +26,7 @@
#include "caja-column.h"
#include "caja-extension-i18n.h"
-enum
-{
+enum {
PROP_0,
PROP_NAME,
PROP_ATTRIBUTE,
@@ -38,8 +37,7 @@ enum
LAST_PROP
};
-struct _CajaColumnDetails
-{
+struct _CajaColumnDetails {
char *name;
GQuark attribute;
char *label;
@@ -50,6 +48,19 @@ struct _CajaColumnDetails
G_DEFINE_TYPE (CajaColumn, caja_column, G_TYPE_OBJECT);
/**
+ * SECTION:caja-column
+ * @title: CajaColumn
+ * @short_description: List view column descriptor object
+ * @include: libcaja-extension/caja-column.h
+ *
+ * #CajaColumn is an object that describes a column in the file manager
+ * list view. Extensions can provide #CajaColumn by registering a
+ * #CajaColumnProvider and returning them from
+ * caja_column_provider_get_columns(), which will be called by the main
+ * application when creating a view.
+ */
+
+/**
* caja_column_new:
* @name: identifier of the column
* @attribute: the file attribute to be displayed in the column
@@ -93,8 +104,7 @@ caja_column_get_property (GObject *object,
column = CAJA_COLUMN (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_value_set_string (value, column->details->name);
break;
@@ -129,8 +139,7 @@ caja_column_set_property (GObject *object,
column = CAJA_COLUMN (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_free (column->details->name);
column->details->name = g_strdup (g_value_get_string (value));
diff --git a/libcaja-extension/caja-column.h b/libcaja-extension/caja-column.h
index e60f7889..9f282816 100644
--- a/libcaja-extension/caja-column.h
+++ b/libcaja-extension/caja-column.h
@@ -28,9 +28,7 @@
#include <glib-object.h>
#include "caja-extension-types.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_COLUMN (caja_column_get_type())
#define CAJA_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_COLUMN, CajaColumn))
@@ -39,39 +37,35 @@ extern "C" {
#define CAJA_INFO_IS_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CAJA_TYPE_COLUMN))
#define CAJA_COLUMN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CAJA_TYPE_COLUMN, CajaColumnClass))
- typedef struct _CajaColumn CajaColumn;
- typedef struct _CajaColumnDetails CajaColumnDetails;
- typedef struct _CajaColumnClass CajaColumnClass;
+typedef struct _CajaColumn CajaColumn;
+typedef struct _CajaColumnDetails CajaColumnDetails;
+typedef struct _CajaColumnClass CajaColumnClass;
- struct _CajaColumn
- {
- GObject parent;
+struct _CajaColumn {
+ GObject parent;
- CajaColumnDetails *details;
- };
+ CajaColumnDetails *details;
+};
- struct _CajaColumnClass
- {
- GObjectClass parent;
- };
+struct _CajaColumnClass {
+ GObjectClass parent;
+};
- GType caja_column_get_type (void);
- CajaColumn * caja_column_new (const char *name,
- const char *attribute,
- const char *label,
- const char *description);
+GType caja_column_get_type (void);
+CajaColumn *caja_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description);
- /* CajaColumn has the following properties:
- * name (string) - the identifier for the column
- * attribute (string) - the file attribute to be displayed in the
- * column
- * label (string) - the user-visible label for the column
- * description (string) - a user-visible description of the column
- * xalign (float) - x-alignment of the column
- */
+/* CajaColumn has the following properties:
+ * name (string) - the identifier for the column
+ * attribute (string) - the file attribute to be displayed in the
+ * column
+ * label (string) - the user-visible label for the column
+ * description (string) - a user-visible description of the column
+ * xalign (float) - x-alignment of the column
+ */
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-extension-types.c b/libcaja-extension/caja-extension-types.c
index adc977ab..af6f692e 100644
--- a/libcaja-extension/caja-extension-types.c
+++ b/libcaja-extension/caja-extension-types.c
@@ -24,15 +24,12 @@
#include <config.h>
#include "caja-extension-types.h"
-
GType
caja_operation_result_get_type (void)
{
static GType type = 0;
- if (type == 0)
- {
- static const GEnumValue values[] =
- {
+ if (type == 0) {
+ static const GEnumValue values[] = {
{
CAJA_OPERATION_COMPLETE,
"CAJA_OPERATION_COMPLETE",
diff --git a/libcaja-extension/caja-extension-types.h b/libcaja-extension/caja-extension-types.h
index ddfbd233..691d0f11 100644
--- a/libcaja-extension/caja-extension-types.h
+++ b/libcaja-extension/caja-extension-types.h
@@ -31,43 +31,60 @@
#include <glib-object.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_OPERATION_RESULT (caja_operation_result_get_type ())
- /* Handle for asynchronous interfaces. These are opaque handles that must
- * be unique within an extension object. These are returned by operations
- * that return CAJA_OPERATION_IN_PROGRESS */
- typedef struct _CajaOperationHandle CajaOperationHandle;
+/**
+ * CajaOperationHandle:
+ *
+ * Handle for asynchronous interfaces. These are opaque handles that must
+ * be unique within an extension object. These are returned by operations
+ * that return CAJA_OPERATION_IN_PROGRESS.
+ */
+typedef struct _CajaOperationHandle CajaOperationHandle;
+
+/**
+ * CajaOperationResult:
+ * @CAJA_OPERATION_COMPLETE: the operation succeeded, and the extension
+ * is done with the request.
+ * @CAJA_OPERATION_FAILED: the operation failed.
+ * @CAJA_OPERATION_IN_PROGRESS: the extension has begin an async operation.
+ * When this value is returned, the extension must set the handle parameter
+ * and call the callback closure when the operation is complete.
+ */
+typedef enum {
+ /* Returned if the call succeeded, and the extension is done
+ * with the request */
+ CAJA_OPERATION_COMPLETE,
- typedef enum
- {
- /* Returned if the call succeeded, and the extension is done
- * with the request */
- CAJA_OPERATION_COMPLETE,
+ /* Returned if the call failed */
+ CAJA_OPERATION_FAILED,
- /* Returned if the call failed */
- CAJA_OPERATION_FAILED,
+ /* Returned if the extension has begun an async operation.
+ * If this is returned, the extension must set the handle
+ * parameter and call the callback closure when the
+ * operation is complete. */
+ CAJA_OPERATION_IN_PROGRESS
+} CajaOperationResult;
- /* Returned if the extension has begun an async operation.
- * If this is returned, the extension must set the handle
- * parameter and call the callback closure when the
- * operation is complete. */
- CAJA_OPERATION_IN_PROGRESS
- } CajaOperationResult;
+GType caja_operation_result_get_type (void);
- GType caja_operation_result_get_type (void);
+/**
+ * SECTION:caja-extension-types
+ * @title: CajaModule
+ * @short_description: Initialize an extension
+ * @include: libcaja-extension/caja-extension-types.h
+ *
+ * Methods that each extension implements.
+ */
- void caja_module_initialize (GTypeModule *module);
- void caja_module_shutdown (void);
- void caja_module_list_types (const GType **types,
- int *num_types);
- void caja_module_list_pyfiles (GList **pyfiles);
+void caja_module_initialize (GTypeModule *module);
+void caja_module_shutdown (void);
+void caja_module_list_types (const GType **types,
+ int *num_types);
+void caja_module_list_pyfiles (GList **pyfiles);
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-file-info.c b/libcaja-extension/caja-file-info.c
index 17a96908..61f37b6d 100644
--- a/libcaja-extension/caja-file-info.c
+++ b/libcaja-extension/caja-file-info.c
@@ -26,6 +26,16 @@
CajaFileInfo *(*caja_file_info_getter) (GFile *location, gboolean create);
/**
+ * SECTION:caja-file-info
+ * @title: CajaFileInfo
+ * @short_description: File interface for caja extensions
+ * @include: libcaja-extension/caja-file-info.h
+ *
+ * #CajaFileInfo provides methods to get and modify information
+ * about file objects in the file manager.
+ */
+
+/**
* caja_file_info_list_copy:
* @files: (element-type CajaFileInfo): the files to copy
*
@@ -76,10 +86,8 @@ caja_file_info_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaFileInfoIface),
caja_file_info_base_init,
NULL,
@@ -141,6 +149,7 @@ caja_file_info_get_location (CajaFileInfo *file)
return CAJA_FILE_INFO_GET_IFACE (file)->get_location (file);
}
+
char *
caja_file_info_get_uri (CajaFileInfo *file)
{
@@ -243,7 +252,7 @@ caja_file_info_is_mime_type (CajaFileInfo *file,
g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->is_mime_type != NULL, FALSE);
return CAJA_FILE_INFO_GET_IFACE (file)->is_mime_type (file,
- mime_type);
+ mime_type);
}
gboolean
@@ -297,7 +306,7 @@ caja_file_info_add_string_attribute (CajaFileInfo *file,
g_return_if_fail (value != NULL);
CAJA_FILE_INFO_GET_IFACE (file)->add_string_attribute
- (file, attribute_name, value);
+ (file, attribute_name, value);
}
void
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
diff --git a/libcaja-extension/caja-info-provider.c b/libcaja-extension/caja-info-provider.c
index 76c67157..0451de23 100644
--- a/libcaja-extension/caja-info-provider.c
+++ b/libcaja-extension/caja-info-provider.c
@@ -27,6 +27,18 @@
#include <glib-object.h>
+/**
+ * SECTION:caja-info-provider
+ * @title: CajaInfoProvider
+ * @short_description: Interface to provide additional information about files
+ * @include: libcaja-extension/caja-column-provider.h
+ *
+ * #CajaInfoProvider allows extension to provide additional information about
+ * files. When caja_info_provider_update_file_info() is called by the application,
+ * extensions will know that it's time to add extra information to the provided
+ * #CajaFileInfo.
+ */
+
static void
caja_info_provider_base_init (gpointer g_class)
{
@@ -37,10 +49,8 @@ caja_info_provider_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaInfoProviderIface),
caja_info_provider_base_init,
NULL,
@@ -62,9 +72,9 @@ caja_info_provider_get_type (void)
}
CajaOperationResult
-caja_info_provider_update_file_info (CajaInfoProvider *provider,
- CajaFileInfo *file,
- GClosure *update_complete,
+caja_info_provider_update_file_info (CajaInfoProvider *provider,
+ CajaFileInfo *file,
+ GClosure *update_complete,
CajaOperationHandle **handle)
{
g_return_val_if_fail (CAJA_IS_INFO_PROVIDER (provider),
@@ -80,7 +90,7 @@ caja_info_provider_update_file_info (CajaInfoProvider *provider,
}
void
-caja_info_provider_cancel_update (CajaInfoProvider *provider,
+caja_info_provider_cancel_update (CajaInfoProvider *provider,
CajaOperationHandle *handle)
{
g_return_if_fail (CAJA_IS_INFO_PROVIDER (provider));
@@ -93,10 +103,10 @@ caja_info_provider_cancel_update (CajaInfoProvider *provider,
}
void
-caja_info_provider_update_complete_invoke (GClosure *update_complete,
- CajaInfoProvider *provider,
- CajaOperationHandle *handle,
- CajaOperationResult result)
+caja_info_provider_update_complete_invoke (GClosure *update_complete,
+ CajaInfoProvider *provider,
+ CajaOperationHandle *handle,
+ CajaOperationResult result)
{
GValue args[3] = { { 0, } };
GValue return_val = { 0, };
@@ -119,4 +129,3 @@ caja_info_provider_update_complete_invoke (GClosure *update_complete,
g_value_unset (&args[2]);
}
-
diff --git a/libcaja-extension/caja-info-provider.h b/libcaja-extension/caja-info-provider.h
index 69371f96..4377687f 100644
--- a/libcaja-extension/caja-info-provider.h
+++ b/libcaja-extension/caja-info-provider.h
@@ -34,54 +34,60 @@
#include "caja-extension-types.h"
#include "caja-file-info.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_INFO_PROVIDER (caja_info_provider_get_type ())
#define CAJA_INFO_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_INFO_PROVIDER, CajaInfoProvider))
#define CAJA_IS_INFO_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_INFO_PROVIDER))
#define CAJA_INFO_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_INFO_PROVIDER, CajaInfoProviderIface))
- typedef struct _CajaInfoProvider CajaInfoProvider;
- typedef struct _CajaInfoProviderIface CajaInfoProviderIface;
-
- typedef void (*CajaInfoProviderUpdateComplete) (CajaInfoProvider *provider,
- CajaOperationHandle *handle,
- CajaOperationResult result,
- gpointer user_data);
-
- struct _CajaInfoProviderIface
- {
- GTypeInterface g_iface;
-
- CajaOperationResult (*update_file_info) (CajaInfoProvider *provider,
- CajaFileInfo *file,
- GClosure *update_complete,
- CajaOperationHandle **handle);
- void (*cancel_update) (CajaInfoProvider *provider,
- CajaOperationHandle *handle);
- };
-
- /* Interface Functions */
- GType caja_info_provider_get_type (void);
- CajaOperationResult caja_info_provider_update_file_info (CajaInfoProvider *provider,
- CajaFileInfo *file,
- GClosure *update_complete,
- CajaOperationHandle **handle);
- void caja_info_provider_cancel_update (CajaInfoProvider *provider,
- CajaOperationHandle *handle);
-
-
-
- /* Helper functions for implementations */
- void caja_info_provider_update_complete_invoke (GClosure *update_complete,
- CajaInfoProvider *provider,
- CajaOperationHandle *handle,
- CajaOperationResult result);
-
-#ifdef __cplusplus
-}
-#endif
+typedef struct _CajaInfoProvider CajaInfoProvider;
+typedef struct _CajaInfoProviderIface CajaInfoProviderIface;
+
+typedef void (*CajaInfoProviderUpdateComplete) (CajaInfoProvider *provider,
+ CajaOperationHandle *handle,
+ CajaOperationResult result,
+ gpointer user_data);
+
+/**
+ * CajaInfoProviderIface:
+ * @g_iface: The parent interface.
+ * @update_file_info: Returns a #CajaOperationResult.
+ * See caja_info_provider_update_file_info() for details.
+ * @cancel_update: Cancels a previous call to caja_info_provider_update_file_info().
+ * See caja_info_provider_cancel_update() for details.
+ *
+ * Interface for extensions to provide additional information about files.
+ */
+
+struct _CajaInfoProviderIface {
+ GTypeInterface g_iface;
+
+ CajaOperationResult (*update_file_info) (CajaInfoProvider *provider,
+ CajaFileInfo *file,
+ GClosure *update_complete,
+ CajaOperationHandle **handle);
+ void (*cancel_update) (CajaInfoProvider *provider,
+ CajaOperationHandle *handle);
+};
+
+/* Interface Functions */
+GType caja_info_provider_get_type (void);
+CajaOperationResult caja_info_provider_update_file_info (CajaInfoProvider *provider,
+ CajaFileInfo *file,
+ GClosure *update_complete,
+ CajaOperationHandle **handle);
+void caja_info_provider_cancel_update (CajaInfoProvider *provider,
+ CajaOperationHandle *handle);
+
+
+
+/* Helper functions for implementations */
+void caja_info_provider_update_complete_invoke (GClosure *update_complete,
+ CajaInfoProvider *provider,
+ CajaOperationHandle *handle,
+ CajaOperationResult result);
+
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-location-widget-provider.c b/libcaja-extension/caja-location-widget-provider.c
index b605dd43..aebf870f 100644
--- a/libcaja-extension/caja-location-widget-provider.c
+++ b/libcaja-extension/caja-location-widget-provider.c
@@ -27,6 +27,16 @@
#include <glib-object.h>
+/**
+ * SECTION:caja-location-widget-provider
+ * @title: CajaLocationWidgetProvider
+ * @short_description: Interface to provide additional location widgets
+ * @include: libcaja-extension/caja-location-widget-provider.h
+ *
+ * #CajaLocationWidgetProvider allows extension to provide additional location
+ * widgets in the file manager views.
+ */
+
static void
caja_location_widget_provider_base_init (gpointer g_class)
{
@@ -37,10 +47,8 @@ caja_location_widget_provider_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaLocationWidgetProviderIface),
caja_location_widget_provider_base_init,
NULL,
@@ -70,9 +78,9 @@ caja_location_widget_provider_get_type (void)
* Returns: (transfer none): the location widget for @provider at @uri
*/
GtkWidget *
-caja_location_widget_provider_get_widget (CajaLocationWidgetProvider *provider,
- const char *uri,
- GtkWidget *window)
+caja_location_widget_provider_get_widget (CajaLocationWidgetProvider *provider,
+ const char *uri,
+ GtkWidget *window)
{
g_return_val_if_fail (CAJA_IS_LOCATION_WIDGET_PROVIDER (provider), NULL);
diff --git a/libcaja-extension/caja-location-widget-provider.h b/libcaja-extension/caja-location-widget-provider.h
index 9b3ade46..df23fda9 100644
--- a/libcaja-extension/caja-location-widget-provider.h
+++ b/libcaja-extension/caja-location-widget-provider.h
@@ -36,34 +36,37 @@
#include <gtk/gtk.h>
#include "caja-extension-types.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_LOCATION_WIDGET_PROVIDER (caja_location_widget_provider_get_type ())
#define CAJA_LOCATION_WIDGET_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_LOCATION_WIDGET_PROVIDER, CajaLocationWidgetProvider))
#define CAJA_IS_LOCATION_WIDGET_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_LOCATION_WIDGET_PROVIDER))
#define CAJA_LOCATION_WIDGET_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_LOCATION_WIDGET_PROVIDER, CajaLocationWidgetProviderIface))
- typedef struct _CajaLocationWidgetProvider CajaLocationWidgetProvider;
- typedef struct _CajaLocationWidgetProviderIface CajaLocationWidgetProviderIface;
+typedef struct _CajaLocationWidgetProvider CajaLocationWidgetProvider;
+typedef struct _CajaLocationWidgetProviderIface CajaLocationWidgetProviderIface;
- struct _CajaLocationWidgetProviderIface
- {
- GTypeInterface g_iface;
+/**
+ * CajaLocationWidgetProviderIface:
+ * @g_iface: The parent interface.
+ * @get_widget: Returns a #GtkWidget.
+ * See caja_location_widget_provider_get_widget() for details.
+ *
+ * Interface for extensions to provide additional location widgets.
+ */
+struct _CajaLocationWidgetProviderIface {
+ GTypeInterface g_iface;
- GtkWidget * (*get_widget) (CajaLocationWidgetProvider *provider,
- const char *uri,
- GtkWidget *window);
- };
+ GtkWidget *(*get_widget) (CajaLocationWidgetProvider *provider,
+ const char *uri,
+ GtkWidget *window);
+};
- /* Interface Functions */
- GType caja_location_widget_provider_get_type (void);
- GtkWidget * caja_location_widget_provider_get_widget (CajaLocationWidgetProvider *provider,
- const char *uri,
- GtkWidget *window);
-#ifdef __cplusplus
-}
-#endif
+/* Interface Functions */
+GType caja_location_widget_provider_get_type (void);
+GtkWidget *caja_location_widget_provider_get_widget (CajaLocationWidgetProvider *provider,
+ const char *uri,
+ GtkWidget *window);
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-menu-item.c b/libcaja-extension/caja-menu-item.c
index 693fa41f..054dd767 100644
--- a/libcaja-extension/caja-menu-item.c
+++ b/libcaja-extension/caja-menu-item.c
@@ -26,14 +26,12 @@
#include "caja-menu.h"
#include "caja-extension-i18n.h"
-enum
-{
+enum {
ACTIVATE,
LAST_SIGNAL
};
-enum
-{
+enum {
PROP_0,
PROP_NAME,
PROP_LABEL,
@@ -45,8 +43,7 @@ enum
LAST_PROP
};
-struct _CajaMenuItemDetails
-{
+struct _CajaMenuItemDetails {
char *name;
char *label;
char *tip;
@@ -61,6 +58,20 @@ static guint signals[LAST_SIGNAL] = { 0 };
static GObjectClass *parent_class = NULL;
/**
+ * SECTION:caja-menu-item
+ * @title: CajaMenuItem
+ * @short_description: Menu item descriptor object
+ * @include: libcaja-extension/caja-menu-item.h
+ *
+ * #CajaMenuItem is an object that describes an item in a file manager
+ * menu. Extensions can provide #CajaMenuItem objects by registering a
+ * #CajaMenuProvider and returning them from
+ * caja_menu_provider_get_file_items(), or
+ * caja_menu_provider_get_background_items(), which will be called by the
+ * main application when creating menus.
+ */
+
+/**
* caja_menu_item_new:
* @name: the identifier for the menu item
* @label: the user-visible label of the menu item
@@ -128,8 +139,7 @@ caja_menu_item_get_property (GObject *object,
item = CAJA_MENU_ITEM (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_value_set_string (value, item->details->name);
break;
@@ -167,8 +177,7 @@ caja_menu_item_set_property (GObject *object,
item = CAJA_MENU_ITEM (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_free (item->details->name);
item->details->name = g_strdup (g_value_get_string (value));
@@ -198,8 +207,7 @@ caja_menu_item_set_property (GObject *object,
g_object_notify (object, "priority");
break;
case PROP_MENU :
- if (item->details->menu)
- {
+ if (item->details->menu) {
g_object_unref (item->details->menu);
}
item->details->menu = g_object_ref (g_value_get_object (value));
@@ -222,8 +230,7 @@ caja_menu_item_finalize (GObject *object)
g_free (item->details->label);
g_free (item->details->tip);
g_free (item->details->icon);
- if (item->details->menu)
- {
+ if (item->details->menu) {
g_object_unref (item->details->menu);
}
@@ -316,10 +323,8 @@ caja_menu_item_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaMenuItemClass),
NULL,
NULL,
diff --git a/libcaja-extension/caja-menu-provider.c b/libcaja-extension/caja-menu-provider.c
index 7198b8c3..c0d0400d 100644
--- a/libcaja-extension/caja-menu-provider.c
+++ b/libcaja-extension/caja-menu-provider.c
@@ -28,13 +28,22 @@
#include <glib-object.h>
+/**
+ * SECTION:caja-menu-provider
+ * @title: CajaMenuProvider
+ * @short_description: Interface to provide additional menu items
+ * @include: libcaja-extension/caja-menu-provider.h
+ *
+ * #CajaMenuProvider allows extension to provide additional menu items
+ * in the file manager menus.
+ */
+
static void
caja_menu_provider_base_init (gpointer g_class)
{
static gboolean initialized = FALSE;
- if (!initialized)
- {
+ if (!initialized) {
/* This signal should be emited each time the extension modify the list of menu items */
g_signal_new ("items_updated",
CAJA_TYPE_MENU_PROVIDER,
@@ -52,10 +61,8 @@ caja_menu_provider_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaMenuProviderIface),
caja_menu_provider_base_init,
NULL,
@@ -86,18 +93,15 @@ caja_menu_provider_get_type (void)
*/
GList *
caja_menu_provider_get_file_items (CajaMenuProvider *provider,
- GtkWidget *window,
- GList *files)
+ GtkWidget *window,
+ GList *files)
{
g_return_val_if_fail (CAJA_IS_MENU_PROVIDER (provider), NULL);
- if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_file_items)
- {
+ if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_file_items) {
return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_file_items
(provider, window, files);
- }
- else
- {
+ } else {
return NULL;
}
}
@@ -112,41 +116,40 @@ caja_menu_provider_get_file_items (CajaMenuProvider *provider,
*/
GList *
caja_menu_provider_get_background_items (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder)
+ GtkWidget *window,
+ CajaFileInfo *current_folder)
{
- if (!CAJA_IS_MENU_PROVIDER (provider)) {
- return NULL;
- }
-
+ g_return_val_if_fail (CAJA_IS_MENU_PROVIDER (provider), NULL);
g_return_val_if_fail (CAJA_IS_FILE_INFO (current_folder), NULL);
- if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_background_items)
- {
+ if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_background_items) {
return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_background_items
(provider, window, current_folder);
- }
- else
- {
+ } else {
return NULL;
}
}
+/**
+ * caja_menu_provider_get_toolbar_items:
+ * @provider: a #CajaMenuProvider
+ * @window: the parent #GtkWidget window
+ * @current_folder: the folder for which toolbar items are requested
+ *
+ * Returns: (element-type CajaMenuItem) (transfer full): the provided list of #CajaMenuItem
+ */
GList *
caja_menu_provider_get_toolbar_items (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder)
+ GtkWidget *window,
+ CajaFileInfo *current_folder)
{
g_return_val_if_fail (CAJA_IS_MENU_PROVIDER (provider), NULL);
g_return_val_if_fail (CAJA_IS_FILE_INFO (current_folder), NULL);
- if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items)
- {
+ if (CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items) {
return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items
(provider, window, current_folder);
- }
- else
- {
+ } else {
return NULL;
}
}
diff --git a/libcaja-extension/caja-menu-provider.h b/libcaja-extension/caja-menu-provider.h
index 2177a8cc..71104797 100644
--- a/libcaja-extension/caja-menu-provider.h
+++ b/libcaja-extension/caja-menu-provider.h
@@ -36,50 +36,58 @@
#include "caja-file-info.h"
#include "caja-menu.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_MENU_PROVIDER (caja_menu_provider_get_type ())
#define CAJA_MENU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_MENU_PROVIDER, CajaMenuProvider))
#define CAJA_IS_MENU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_MENU_PROVIDER))
#define CAJA_MENU_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_MENU_PROVIDER, CajaMenuProviderIface))
- typedef struct _CajaMenuProvider CajaMenuProvider;
- typedef struct _CajaMenuProviderIface CajaMenuProviderIface;
+typedef struct _CajaMenuProvider CajaMenuProvider;
+typedef struct _CajaMenuProviderIface CajaMenuProviderIface;
- struct _CajaMenuProviderIface
- {
- GTypeInterface g_iface;
+/**
+ * CajaMenuProviderIface:
+ * @g_iface: The parent interface.
+ * @get_file_items: Returns a #GList of #CajaMenuItem.
+ * See caja_menu_provider_get_file_items() for details.
+ * @get_background_items: Returns a #GList of #CajaMenuItem.
+ * See caja_menu_provider_get_background_items() for details.
+ * @get_toolbar_items: Returns a #GList of #CajaMenuItem.
+ * See caja_menu_provider_get_toolbar_items() for details.
+ *
+ * Interface for extensions to provide additional menu items.
+ */
- GList *(*get_file_items) (CajaMenuProvider *provider,
- GtkWidget *window,
- GList *files);
- GList *(*get_background_items) (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder);
- GList *(*get_toolbar_items) (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder);
- };
+struct _CajaMenuProviderIface {
+ GTypeInterface g_iface;
- /* Interface Functions */
- GType caja_menu_provider_get_type (void);
- GList *caja_menu_provider_get_file_items (CajaMenuProvider *provider,
- GtkWidget *window,
- GList *files);
- GList *caja_menu_provider_get_background_items (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder);
- GList *caja_menu_provider_get_toolbar_items (CajaMenuProvider *provider,
- GtkWidget *window,
- CajaFileInfo *current_folder);
+ GList *(*get_file_items) (CajaMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
+ GList *(*get_background_items) (CajaMenuProvider *provider,
+ GtkWidget *window,
+ CajaFileInfo *current_folder);
+ GList *(*get_toolbar_items) (CajaMenuProvider *provider,
+ GtkWidget *window,
+ CajaFileInfo *current_folder);
+};
- /* This function emit a signal to inform caja that its item list has changed. */
- void caja_menu_provider_emit_items_updated_signal (CajaMenuProvider *provider);
+/* Interface Functions */
+GType caja_menu_provider_get_type (void);
+GList *caja_menu_provider_get_file_items (CajaMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
+GList *caja_menu_provider_get_background_items (CajaMenuProvider *provider,
+ GtkWidget *window,
+ CajaFileInfo *current_folder);
+GList *caja_menu_provider_get_toolbar_items (CajaMenuProvider *provider,
+ GtkWidget *window,
+ CajaFileInfo *current_folder);
-#ifdef __cplusplus
-}
-#endif
+/* This function emit a signal to inform caja that its item list has changed. */
+void caja_menu_provider_emit_items_updated_signal (CajaMenuProvider *provider);
+
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-menu.c b/libcaja-extension/caja-menu.c
index f6f15f20..f7918184 100644
--- a/libcaja-extension/caja-menu.c
+++ b/libcaja-extension/caja-menu.c
@@ -27,11 +27,21 @@
#include <glib.h>
+/**
+ * SECTION:caja-menu
+ * @title: CajaMenu
+ * @short_description: Menu descriptor object
+ * @include: libcaja-extension/caja-menu.h
+ *
+ * #CajaMenu is an object that describes a submenu in a file manager
+ * menu. Extensions can provide #CajaMenu objects by attaching them to
+ * #CajaMenuItem objects, using caja_menu_item_set_submenu().
+ */
+
#define CAJA_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), CAJA_TYPE_MENU, CajaMenuPrivate))
G_DEFINE_TYPE (CajaMenu, caja_menu, G_TYPE_OBJECT);
-struct _CajaMenuPrivate
-{
+struct _CajaMenuPrivate {
GList *item_list;
};
@@ -84,8 +94,7 @@ caja_menu_finalize (GObject *object)
{
CajaMenu *menu = CAJA_MENU (object);
- if (menu->priv->item_list)
- {
+ if (menu->priv->item_list) {
g_list_free (menu->priv->item_list);
}
diff --git a/libcaja-extension/caja-menu.h b/libcaja-extension/caja-menu.h
index 58a5e158..e4345465 100644
--- a/libcaja-extension/caja-menu.h
+++ b/libcaja-extension/caja-menu.h
@@ -29,19 +29,16 @@
#include <glib-object.h>
#include "caja-extension-types.h"
+G_BEGIN_DECLS
-#ifdef __cplusplus
-extern "C" {
-#endif
-
- /* CajaMenu defines */
+/* CajaMenu defines */
#define CAJA_TYPE_MENU (caja_menu_get_type ())
#define CAJA_MENU(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), CAJA_TYPE_MENU, CajaMenu))
#define CAJA_MENU_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), CAJA_TYPE_MENU, CajaMenuClass))
#define CAJA_IS_MENU(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), CAJA_TYPE_MENU))
#define CAJA_IS_MENU_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), CAJA_TYPE_MENU))
#define CAJA_MENU_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), CAJA_TYPE_MENU, CajaMenuClass))
- /* CajaMenuItem defines */
+/* CajaMenuItem defines */
#define CAJA_TYPE_MENU_ITEM (caja_menu_item_get_type())
#define CAJA_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_MENU_ITEM, CajaMenuItem))
#define CAJA_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_MENU_ITEM, CajaMenuItemClass))
@@ -49,77 +46,69 @@ extern "C" {
#define CAJA_MENU_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CAJA_TYPE_MENU_ITEM))
#define CAJA_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CAJA_TYPE_MENU_ITEM, CajaMenuItemClass))
+/* CajaMenu types */
+typedef struct _CajaMenu CajaMenu;
+typedef struct _CajaMenuPrivate CajaMenuPrivate;
+typedef struct _CajaMenuClass CajaMenuClass;
+/* CajaMenuItem types */
+typedef struct _CajaMenuItem CajaMenuItem;
+typedef struct _CajaMenuItemDetails CajaMenuItemDetails;
+typedef struct _CajaMenuItemClass CajaMenuItemClass;
+
+/* CajaMenu structs */
+struct _CajaMenu {
+ GObject parent;
+ CajaMenuPrivate *priv;
+};
+
+struct _CajaMenuClass {
+ GObjectClass parent_class;
+};
+
+/* CajaMenuItem structs */
+struct _CajaMenuItem {
+ GObject parent;
+
+ CajaMenuItemDetails *details;
+};
+
+struct _CajaMenuItemClass {
+ GObjectClass parent;
+
+ void (*activate) (CajaMenuItem *item);
+};
+
+/* CajaMenu methods */
+GType caja_menu_get_type (void);
+CajaMenu *caja_menu_new (void);
+
+void caja_menu_append_item (CajaMenu *menu,
+ CajaMenuItem *item);
+GList *caja_menu_get_items (CajaMenu *menu);
+void caja_menu_item_list_free (GList *item_list);
+
+/* CajaMenuItem methods */
+GType caja_menu_item_get_type (void);
+CajaMenuItem *caja_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon);
+
+void caja_menu_item_activate (CajaMenuItem *item);
+void caja_menu_item_set_submenu (CajaMenuItem *item,
+ CajaMenu *menu);
+
+/* CajaMenuItem has the following properties:
+ * name (string) - the identifier for the menu item
+ * label (string) - the user-visible label of the menu item
+ * tip (string) - the tooltip of the menu item
+ * icon (string) - the name of the icon to display in the menu item
+ * sensitive (boolean) - whether the menu item is sensitive or not
+ * priority (boolean) - used for toolbar items, whether to show priority
+ * text.
+ * menu (CajaMenu) - The menu belonging to this item. May be null.
+ */
- /* CajaMenu types */
- typedef struct _CajaMenu CajaMenu;
- typedef struct _CajaMenuPrivate CajaMenuPrivate;
- typedef struct _CajaMenuClass CajaMenuClass;
- /* CajaMenuItem types */
- typedef struct _CajaMenuItem CajaMenuItem;
- typedef struct _CajaMenuItemDetails CajaMenuItemDetails;
- typedef struct _CajaMenuItemClass CajaMenuItemClass;
-
-
- /* CajaMenu structs */
- struct _CajaMenu
- {
- GObject parent;
- CajaMenuPrivate *priv;
- };
-
- struct _CajaMenuClass
- {
- GObjectClass parent_class;
- };
-
- /* CajaMenuItem structs */
- struct _CajaMenuItem
- {
- GObject parent;
-
- CajaMenuItemDetails *details;
- };
-
- struct _CajaMenuItemClass
- {
- GObjectClass parent;
-
- void (*activate) (CajaMenuItem *item);
- };
-
-
- /* CajaMenu methods */
- GType caja_menu_get_type (void);
- CajaMenu * caja_menu_new (void);
-
- void caja_menu_append_item (CajaMenu *menu,
- CajaMenuItem *item);
- GList* caja_menu_get_items (CajaMenu *menu);
- void caja_menu_item_list_free (GList *item_list);
-
- /* CajaMenuItem methods */
- GType caja_menu_item_get_type (void);
- CajaMenuItem *caja_menu_item_new (const char *name,
- const char *label,
- const char *tip,
- const char *icon);
-
- void caja_menu_item_activate (CajaMenuItem *item);
- void caja_menu_item_set_submenu (CajaMenuItem *item,
- CajaMenu *menu);
- /* CajaMenuItem has the following properties:
- * name (string) - the identifier for the menu item
- * label (string) - the user-visible label of the menu item
- * tip (string) - the tooltip of the menu item
- * icon (string) - the name of the icon to display in the menu item
- * sensitive (boolean) - whether the menu item is sensitive or not
- * priority (boolean) - used for toolbar items, whether to show priority
- * text.
- * menu (CajaMenu) - The menu belonging to this item. May be null.
- */
-
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif /* CAJA_MENU_H */
diff --git a/libcaja-extension/caja-property-page-provider.c b/libcaja-extension/caja-property-page-provider.c
index cd3fc176..8556eeea 100644
--- a/libcaja-extension/caja-property-page-provider.c
+++ b/libcaja-extension/caja-property-page-provider.c
@@ -28,6 +28,16 @@
#include <glib-object.h>
+/**
+ * SECTION:caja-property-page-provider
+ * @title: CajaPropertyPageProvider
+ * @short_description: Interface to provide additional property pages
+ * @include: libcaja-extension/caja-property-page-provider.h
+ *
+ * #CajaPropertyPageProvider allows extension to provide additional pages
+ * for the file properties dialog.
+ */
+
static void
caja_property_page_provider_base_init (gpointer g_class)
{
@@ -38,10 +48,8 @@ caja_property_page_provider_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaPropertyPageProviderIface),
caja_property_page_provider_base_init,
NULL,
diff --git a/libcaja-extension/caja-property-page-provider.h b/libcaja-extension/caja-property-page-provider.h
index 6dd82625..6bab3ad4 100644
--- a/libcaja-extension/caja-property-page-provider.h
+++ b/libcaja-extension/caja-property-page-provider.h
@@ -36,33 +36,37 @@
#include "caja-file-info.h"
#include "caja-property-page.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_PROPERTY_PAGE_PROVIDER (caja_property_page_provider_get_type ())
#define CAJA_PROPERTY_PAGE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_PROPERTY_PAGE_PROVIDER, CajaPropertyPageProvider))
#define CAJA_IS_PROPERTY_PAGE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_PROPERTY_PAGE_PROVIDER))
#define CAJA_PROPERTY_PAGE_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), CAJA_TYPE_PROPERTY_PAGE_PROVIDER, CajaPropertyPageProviderIface))
- typedef struct _CajaPropertyPageProvider CajaPropertyPageProvider;
- typedef struct _CajaPropertyPageProviderIface CajaPropertyPageProviderIface;
+typedef struct _CajaPropertyPageProvider CajaPropertyPageProvider;
+typedef struct _CajaPropertyPageProviderIface CajaPropertyPageProviderIface;
- struct _CajaPropertyPageProviderIface
- {
- GTypeInterface g_iface;
+/**
+ * CajaPropertyPageProviderIface:
+ * @g_iface: The parent interface.
+ * @get_pages: Returns a #GList of #CajaPropertyPage.
+ * See caja_property_page_provider_get_pages() for details.
+ *
+ * Interface for extensions to provide additional property pages.
+ */
- GList *(*get_pages) (CajaPropertyPageProvider *provider,
- GList *files);
- };
+struct _CajaPropertyPageProviderIface {
+ GTypeInterface g_iface;
- /* Interface Functions */
- GType caja_property_page_provider_get_type (void);
- GList *caja_property_page_provider_get_pages (CajaPropertyPageProvider *provider,
- GList *files);
+ GList *(*get_pages) (CajaPropertyPageProvider *provider,
+ GList *files);
+};
-#ifdef __cplusplus
-}
-#endif
+/* Interface Functions */
+GType caja_property_page_provider_get_type (void);
+GList *caja_property_page_provider_get_pages (CajaPropertyPageProvider *provider,
+ GList *files);
+
+G_END_DECLS
#endif
diff --git a/libcaja-extension/caja-property-page.c b/libcaja-extension/caja-property-page.c
index ad3313c8..461e19ea 100644
--- a/libcaja-extension/caja-property-page.c
+++ b/libcaja-extension/caja-property-page.c
@@ -27,8 +27,7 @@
#include "caja-extension-i18n.h"
-enum
-{
+enum {
PROP_0,
PROP_NAME,
PROP_LABEL,
@@ -36,8 +35,7 @@ enum
LAST_PROP
};
-struct _CajaPropertyPageDetails
-{
+struct _CajaPropertyPageDetails {
char *name;
GtkWidget *label;
GtkWidget *page;
@@ -46,6 +44,19 @@ struct _CajaPropertyPageDetails
static GObjectClass *parent_class = NULL;
/**
+ * SECTION:caja-property-page
+ * @title: CajaPropertyPage
+ * @short_description: Property page descriptor object
+ * @include: libcaja-extension/caja-property-page.h
+ *
+ * #CajaPropertyPage is an object that describes a page in the file
+ * properties dialog. Extensions can provide #CajaPropertyPage objects
+ * by registering a #CajaPropertyPageProvider and returning them from
+ * caja_property_page_provider_get_pages(), which will be called by the
+ * main application when creating file properties dialogs.
+ */
+
+/**
* caja_property_page_new:
* @name: the identifier for the property page
* @label: the user-visible label of the property page
@@ -86,8 +97,7 @@ caja_property_page_get_property (GObject *object,
page = CAJA_PROPERTY_PAGE (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_value_set_string (value, page->details->name);
break;
@@ -113,16 +123,14 @@ caja_property_page_set_property (GObject *object,
page = CAJA_PROPERTY_PAGE (object);
- switch (param_id)
- {
+ switch (param_id) {
case PROP_NAME :
g_free (page->details->name);
page->details->name = g_strdup (g_value_get_string (value));
g_object_notify (object, "name");
break;
case PROP_LABEL :
- if (page->details->label)
- {
+ if (page->details->label) {
g_object_unref (page->details->label);
}
@@ -130,8 +138,7 @@ caja_property_page_set_property (GObject *object,
g_object_notify (object, "label");
break;
case PROP_PAGE :
- if (page->details->page)
- {
+ if (page->details->page) {
g_object_unref (page->details->page);
}
@@ -151,13 +158,11 @@ caja_property_page_dispose (GObject *object)
page = CAJA_PROPERTY_PAGE (object);
- if (page->details->label)
- {
+ if (page->details->label) {
g_object_unref (page->details->label);
page->details->label = NULL;
}
- if (page->details->page)
- {
+ if (page->details->page) {
g_object_unref (page->details->page);
page->details->page = NULL;
}
@@ -221,10 +226,8 @@ caja_property_page_get_type (void)
{
static GType type = 0;
- if (!type)
- {
- const GTypeInfo info =
- {
+ if (!type) {
+ const GTypeInfo info = {
sizeof (CajaPropertyPageClass),
NULL,
NULL,
diff --git a/libcaja-extension/caja-property-page.h b/libcaja-extension/caja-property-page.h
index 1de9f9ea..4b24337b 100644
--- a/libcaja-extension/caja-property-page.h
+++ b/libcaja-extension/caja-property-page.h
@@ -29,9 +29,7 @@
#include <gtk/gtk.h>
#include "caja-extension-types.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
+G_BEGIN_DECLS
#define CAJA_TYPE_PROPERTY_PAGE (caja_property_page_get_type())
#define CAJA_PROPERTY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_PROPERTY_PAGE, CajaPropertyPage))
@@ -40,35 +38,31 @@ extern "C" {
#define CAJA_IS_PROPERTY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CAJA_TYPE_PROPERTY_PAGE))
#define CAJA_PROPERTY_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CAJA_TYPE_PROPERTY_PAGE, CajaPropertyPageClass))
- typedef struct _CajaPropertyPage CajaPropertyPage;
- typedef struct _CajaPropertyPageDetails CajaPropertyPageDetails;
- typedef struct _CajaPropertyPageClass CajaPropertyPageClass;
+typedef struct _CajaPropertyPage CajaPropertyPage;
+typedef struct _CajaPropertyPageDetails CajaPropertyPageDetails;
+typedef struct _CajaPropertyPageClass CajaPropertyPageClass;
- struct _CajaPropertyPage
- {
- GObject parent;
+struct _CajaPropertyPage {
+ GObject parent;
- CajaPropertyPageDetails *details;
- };
+ CajaPropertyPageDetails *details;
+};
- struct _CajaPropertyPageClass
- {
- GObjectClass parent;
- };
+struct _CajaPropertyPageClass {
+ GObjectClass parent;
+};
- GType caja_property_page_get_type (void);
- CajaPropertyPage *caja_property_page_new (const char *name,
- GtkWidget *label,
- GtkWidget *page);
+GType caja_property_page_get_type (void);
+CajaPropertyPage *caja_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page);
- /* CajaPropertyPage has the following properties:
- * name (string) - the identifier for the property page
- * label (widget) - the user-visible label of the property page
- * page (widget) - the property page to display
- */
+/* CajaPropertyPage has the following properties:
+ * name (string) - the identifier for the property page
+ * label (widget) - the user-visible label of the property page
+ * page (widget) - the property page to display
+ */
-#ifdef __cplusplus
-}
-#endif
+G_END_DECLS
#endif