summaryrefslogtreecommitdiff
path: root/libcaja-extension
diff options
context:
space:
mode:
Diffstat (limited to 'libcaja-extension')
-rw-r--r--libcaja-extension/Makefile.am89
-rw-r--r--libcaja-extension/caja-column-provider.c74
-rw-r--r--libcaja-extension/caja-column-provider.h65
-rw-r--r--libcaja-extension/caja-column.c240
-rw-r--r--libcaja-extension/caja-column.h77
-rw-r--r--libcaja-extension/caja-extension-i18n.h24
-rw-r--r--libcaja-extension/caja-extension-private.h39
-rw-r--r--libcaja-extension/caja-extension-types.c59
-rw-r--r--libcaja-extension/caja-extension-types.h72
-rw-r--r--libcaja-extension/caja-file-info.c308
-rw-r--r--libcaja-extension/caja-file-info.h140
-rw-r--r--libcaja-extension/caja-info-provider.c122
-rw-r--r--libcaja-extension/caja-info-provider.h87
-rw-r--r--libcaja-extension/caja-location-widget-provider.c74
-rw-r--r--libcaja-extension/caja-location-widget-provider.h69
-rw-r--r--libcaja-extension/caja-menu-item.c342
-rw-r--r--libcaja-extension/caja-menu-item.h30
-rw-r--r--libcaja-extension/caja-menu-provider.c143
-rw-r--r--libcaja-extension/caja-menu-provider.h85
-rw-r--r--libcaja-extension/caja-menu.c112
-rw-r--r--libcaja-extension/caja-menu.h125
-rw-r--r--libcaja-extension/caja-property-page-provider.c89
-rw-r--r--libcaja-extension/caja-property-page-provider.h68
-rw-r--r--libcaja-extension/caja-property-page.c246
-rw-r--r--libcaja-extension/caja-property-page.h74
-rw-r--r--libcaja-extension/libcaja-extension-uninstalled.pc.in12
-rw-r--r--libcaja-extension/libcaja-extension.pc.in12
27 files changed, 2877 insertions, 0 deletions
diff --git a/libcaja-extension/Makefile.am b/libcaja-extension/Makefile.am
new file mode 100644
index 00000000..a3416204
--- /dev/null
+++ b/libcaja-extension/Makefile.am
@@ -0,0 +1,89 @@
+CLEANFILES = $(NULL)
+
+include $(top_srcdir)/Makefile.shared
+
+lib_LTLIBRARIES=libcaja-extension.la
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(LIBCAJA_EXTENSION_CFLAGS) \
+ $(WARNING_CFLAGS) \
+ $(DISABLE_DEPRECATED_CFLAGS) \
+ -DDATADIR=\""$(datadir)"\" \
+ $(UNIQUE_CFLAGS) \
+ $(NULL)
+
+libcaja_extension_la_LDFLAGS=\
+ -version-info @CAJA_EXTENSION_VERSION_INFO@ \
+ -no-undefined \
+ $(NULL)
+
+libcaja_extension_la_LIBADD = $(LIBCAJA_EXTENSION_LIBS)
+
+libcaja_extension_includedir=$(includedir)/caja/libcaja-extension
+
+libcaja_extension_include_HEADERS = \
+ caja-column-provider.h \
+ caja-column.h \
+ caja-extension-types.h \
+ caja-file-info.h \
+ caja-info-provider.h \
+ caja-location-widget-provider.h \
+ caja-menu-item.h \
+ caja-menu-provider.h \
+ caja-property-page-provider.h \
+ caja-property-page.h \
+ caja-menu.h \
+ $(NULL)
+
+libcaja_extension_la_SOURCES = \
+ caja-column-provider.c \
+ caja-column.c \
+ caja-extension-i18n.h \
+ caja-extension-types.c \
+ caja-extension-private.h \
+ caja-file-info.c \
+ caja-info-provider.c \
+ caja-location-widget-provider.c \
+ caja-menu-item.c \
+ caja-menu-provider.c \
+ caja-property-page-provider.c \
+ caja-property-page.c \
+ caja-menu.c \
+ $(NULL)
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA=libcaja-extension.pc
+
+EXTRA_DIST = \
+ libcaja-extension.pc.in \
+ $(NULL)
+
+-include $(INTROSPECTION_MAKEFILE)
+INTROSPECTION_GIRS =
+INTROSPECTION_SCANNER_ARGS = --add-include-path=$(srcdir)
+INTROSPECTION_COMPILER_ARGS = --includedir=$(srcdir)
+
+if HAVE_INTROSPECTION
+introspection_files = \
+ $(libcaja_extension_include_HEADERS) \
+ $(libcaja_extension_la_SOURCES)
+Caja-2.0.gir: libcaja-extension.la Makefile
+Caja_2_0_gir_INCLUDES = Gtk-2.0 Gio-2.0 GLib-2.0
+Caja_2_0_gir_CFLAGS = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(LIBCAJA_EXTENSION_CFLAGS)
+Caja_2_0_gir_LIBS = libcaja-extension.la
+Caja_2_0_gir_FILES = $(addprefix $(srcdir)/, $(introspection_files))
+INTROSPECTION_GIRS += Caja-2.0.gir
+
+girdir = $(datadir)/gir-1.0/
+gir_DATA = $(INTROSPECTION_GIRS)
+
+typelibsdir = $(libdir)/girepository-1.0/
+typelibs_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
+
+CLEANFILES += $(gir_DATA) $(typelibs_DATA)
+endif
diff --git a/libcaja-extension/caja-column-provider.c b/libcaja-extension/caja-column-provider.c
new file mode 100644
index 00000000..dac1fcaf
--- /dev/null
+++ b/libcaja-extension/caja-column-provider.c
@@ -0,0 +1,74 @@
+/*
+ * caja-column-provider.c - Interface for Caja extensions
+ * that provide column specifications.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-column-provider.h"
+
+#include <glib-object.h>
+
+static void
+caja_column_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+caja_column_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaColumnProviderIface),
+ caja_column_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaColumnProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GList *
+caja_column_provider_get_columns (CajaColumnProvider *provider)
+{
+ g_return_val_if_fail (CAJA_IS_COLUMN_PROVIDER (provider), NULL);
+ g_return_val_if_fail (CAJA_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns != NULL, NULL);
+
+ return CAJA_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns
+ (provider);
+}
+
+
diff --git a/libcaja-extension/caja-column-provider.h b/libcaja-extension/caja-column-provider.h
new file mode 100644
index 00000000..beb9b5ae
--- /dev/null
+++ b/libcaja-extension/caja-column-provider.h
@@ -0,0 +1,65 @@
+/*
+ * caja-column-provider.h - Interface for Caja extensions that
+ * provide column descriptions.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * add columns to the list view and details to the icon view.
+ * Extensions are asked for a list of columns to display. Each
+ * returned column refers to a string attribute which can be filled in
+ * by CajaInfoProvider */
+
+#ifndef CAJA_COLUMN_PROVIDER_H
+#define CAJA_COLUMN_PROVIDER_H
+
+#include <glib-object.h>
+#include "caja-extension-types.h"
+#include "caja-column.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+
+ struct _CajaColumnProviderIface
+ {
+ GTypeInterface g_iface;
+
+ GList *(*get_columns) (CajaColumnProvider *provider);
+ };
+
+ /* Interface Functions */
+ GType caja_column_provider_get_type (void);
+ GList *caja_column_provider_get_columns (CajaColumnProvider *provider);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-column.c b/libcaja-extension/caja-column.c
new file mode 100644
index 00000000..5a29550f
--- /dev/null
+++ b/libcaja-extension/caja-column.c
@@ -0,0 +1,240 @@
+/*
+ * caja-column.c - Info columns exported by CajaColumnProvider
+ * objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-column.h"
+#include "caja-extension-i18n.h"
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_ATTRIBUTE,
+ PROP_ATTRIBUTE_Q,
+ PROP_LABEL,
+ PROP_DESCRIPTION,
+ PROP_XALIGN,
+ LAST_PROP
+};
+
+struct _CajaColumnDetails
+{
+ char *name;
+ GQuark attribute;
+ char *label;
+ char *description;
+ float xalign;
+};
+
+G_DEFINE_TYPE (CajaColumn, caja_column, G_TYPE_OBJECT);
+
+/**
+ * caja_column_new:
+ * @name: identifier of the column
+ * @attribute: the file attribute to be displayed in the column
+ * @label: the user-visible label for the column
+ * @description: a user-visible description of the column
+ *
+ * Creates a new column
+ *
+ * Returns: a newly created #CajaColumn
+ */
+CajaColumn *
+caja_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description)
+{
+ CajaColumn *column;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (attribute != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (description != NULL, NULL);
+
+ column = g_object_new (CAJA_TYPE_COLUMN,
+ "name", name,
+ "attribute", attribute,
+ "label", label,
+ "description", description,
+ NULL);
+
+ return column;
+}
+
+static void
+caja_column_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ CajaColumn *column;
+
+ column = CAJA_COLUMN (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME :
+ g_value_set_string (value, column->details->name);
+ break;
+ case PROP_ATTRIBUTE :
+ g_value_set_string (value, g_quark_to_string (column->details->attribute));
+ break;
+ case PROP_ATTRIBUTE_Q :
+ g_value_set_uint (value, column->details->attribute);
+ break;
+ case PROP_LABEL :
+ g_value_set_string (value, column->details->label);
+ break;
+ case PROP_DESCRIPTION :
+ g_value_set_string (value, column->details->description);
+ break;
+ case PROP_XALIGN :
+ g_value_set_float (value, column->details->xalign);
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_column_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CajaColumn *column;
+
+ column = CAJA_COLUMN (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME :
+ g_free (column->details->name);
+ column->details->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
+ break;
+ case PROP_ATTRIBUTE :
+ column->details->attribute = g_quark_from_string (g_value_get_string (value));
+ g_object_notify (object, "attribute");
+ g_object_notify (object, "attribute_q");
+ break;
+ case PROP_LABEL :
+ g_free (column->details->label);
+ column->details->label = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "label");
+ break;
+ case PROP_DESCRIPTION :
+ g_free (column->details->description);
+ column->details->description = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "description");
+ break;
+ case PROP_XALIGN :
+ column->details->xalign = g_value_get_float (value);
+ g_object_notify (object, "xalign");
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_column_finalize (GObject *object)
+{
+ CajaColumn *column;
+
+ column = CAJA_COLUMN (object);
+
+ g_free (column->details->name);
+ g_free (column->details->label);
+ g_free (column->details->description);
+
+ g_free (column->details);
+
+ G_OBJECT_CLASS (caja_column_parent_class)->finalize (object);
+}
+
+static void
+caja_column_init (CajaColumn *column)
+{
+ column->details = g_new0 (CajaColumnDetails, 1);
+ column->details->xalign = 0.0;
+}
+
+static void
+caja_column_class_init (CajaColumnClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = caja_column_finalize;
+ G_OBJECT_CLASS (class)->get_property = caja_column_get_property;
+ G_OBJECT_CLASS (class)->set_property = caja_column_set_property;
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the column",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ATTRIBUTE,
+ g_param_spec_string ("attribute",
+ "Attribute",
+ "The attribute name to display",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ATTRIBUTE_Q,
+ g_param_spec_uint ("attribute_q",
+ "Attribute quark",
+ "The attribute name to display, in quark form",
+ 0, G_MAXUINT, 0,
+ G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Label to display in the column",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_DESCRIPTION,
+ g_param_spec_string ("description",
+ "Description",
+ "A user-visible description of the column",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_XALIGN,
+ g_param_spec_float ("xalign",
+ "xalign",
+ "The x-alignment of the column",
+ 0.0,
+ 1.0,
+ 0.0,
+ G_PARAM_READWRITE));
+}
+
diff --git a/libcaja-extension/caja-column.h b/libcaja-extension/caja-column.h
new file mode 100644
index 00000000..8bc80318
--- /dev/null
+++ b/libcaja-extension/caja-column.h
@@ -0,0 +1,77 @@
+/*
+ * caja-column.h - Info columns exported by
+ * CajaColumnProvider objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#ifndef CAJA_COLUMN_H
+#define CAJA_COLUMN_H
+
+#include <glib-object.h>
+#include "caja-extension-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define CAJA_TYPE_COLUMN (caja_column_get_type())
+#define CAJA_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAJA_TYPE_COLUMN, CajaColumn))
+#define CAJA_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_COLUMN, CajaColumnClass))
+#define CAJA_INFO_IS_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_COLUMN))
+#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;
+
+ struct _CajaColumn
+ {
+ GObject parent;
+
+ CajaColumnDetails *details;
+ };
+
+ 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);
+
+ /* 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
+
+#endif
diff --git a/libcaja-extension/caja-extension-i18n.h b/libcaja-extension/caja-extension-i18n.h
new file mode 100644
index 00000000..34e1b3e6
--- /dev/null
+++ b/libcaja-extension/caja-extension-i18n.h
@@ -0,0 +1,24 @@
+#ifndef CAJA_EXTENSION_I18N_H
+#define CAJA_EXTENSION_I18N_H
+
+#include "config.h"
+
+#ifdef ENABLE_NLS
+#include<libintl.h>
+#define _(String) dgettext(GETTEXT_PACKAGE,String)
+#ifdef gettext_noop
+#define N_(String) gettext_noop(String)
+#else
+#define N_(String) (String)
+#endif
+#else /* NLS is disabled */
+#define _(String) (String)
+#define N_(String) (String)
+#define textdomain(String) (String)
+#define gettext(String) (String)
+#define dgettext(Domain,String) (String)
+#define dcgettext(Domain,String,Type) (String)
+#define bindtextdomain(Domain,Directory) (Domain)
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-extension-private.h b/libcaja-extension/caja-extension-private.h
new file mode 100644
index 00000000..9babbb50
--- /dev/null
+++ b/libcaja-extension/caja-extension-private.h
@@ -0,0 +1,39 @@
+/*
+ * caja-extension-private.h - Type definitions for Caja extensions
+ *
+ * Copyright (C) 2009 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Alexander Larsson <[email protected]>
+ *
+ */
+
+#ifndef CAJA_EXTENSION_PRIVATE_H
+#define CAJA_EXTENSION_PRIVATE_H
+
+#include <libcaja-extension/caja-file-info.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ extern CajaFileInfo *(*caja_file_info_getter) (GFile *location, gboolean create);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-extension-types.c b/libcaja-extension/caja-extension-types.c
new file mode 100644
index 00000000..77b0506b
--- /dev/null
+++ b/libcaja-extension/caja-extension-types.c
@@ -0,0 +1,59 @@
+/*
+ * caja-extension-types.c - Type definitions for Caja extensions
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#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[] =
+ {
+ {
+ CAJA_OPERATION_COMPLETE,
+ "CAJA_OPERATION_COMPLETE",
+ "complete",
+ },
+ {
+ CAJA_OPERATION_FAILED,
+ "CAJA_OPERATION_FAILED",
+ "failed",
+ },
+ {
+ CAJA_OPERATION_IN_PROGRESS,
+ "CAJA_OPERATION_IN_PROGRESS",
+ "in_progress",
+ },
+ { 0, NULL, NULL }
+ };
+
+ type = g_enum_register_static ("CajaOperationResult",
+ values);
+ }
+
+ return type;
+}
diff --git a/libcaja-extension/caja-extension-types.h b/libcaja-extension/caja-extension-types.h
new file mode 100644
index 00000000..cb344ec3
--- /dev/null
+++ b/libcaja-extension/caja-extension-types.h
@@ -0,0 +1,72 @@
+/*
+ * caja-info-provider.h - Type definitions for Caja extensions
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * provide information about files. Extensions are called when Caja
+ * needs information about a file. They are passed a CajaFileInfo
+ * object which should be filled with relevant information */
+
+#ifndef CAJA_EXTENSION_TYPES_H
+#define CAJA_EXTENSION_TYPES_H
+
+#include <glib-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+
+ 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 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);
+
+ void caja_module_initialize (GTypeModule *module);
+ void caja_module_shutdown (void);
+ void caja_module_list_types (const GType **types,
+ int *num_types);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-file-info.c b/libcaja-extension/caja-file-info.c
new file mode 100644
index 00000000..f3947167
--- /dev/null
+++ b/libcaja-extension/caja-file-info.c
@@ -0,0 +1,308 @@
+/*
+ * caja-file-info.c - Information about a file
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#include <config.h>
+#include "caja-file-info.h"
+#include "caja-extension-private.h"
+
+CajaFileInfo *(*caja_file_info_getter) (GFile *location, gboolean create);
+
+GList *
+caja_file_info_list_copy (GList *files)
+{
+ GList *ret;
+ GList *l;
+
+ ret = g_list_copy (files);
+ for (l = ret; l != NULL; l = l->next)
+ {
+ g_object_ref (G_OBJECT (l->data));
+ }
+
+ return ret;
+}
+
+void
+caja_file_info_list_free (GList *files)
+{
+ GList *l;
+
+ for (l = files; l != NULL; l = l->next)
+ {
+ g_object_unref (G_OBJECT (l->data));
+ }
+
+ g_list_free (files);
+}
+
+static void
+caja_file_info_base_init (gpointer g_class)
+{
+}
+
+GType
+caja_file_info_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaFileInfoIface),
+ caja_file_info_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaFileInfo",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+gboolean
+caja_file_info_is_gone (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->is_gone != NULL, FALSE);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->is_gone (file);
+}
+
+GFileType
+caja_file_info_get_file_type (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), G_FILE_TYPE_UNKNOWN);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_file_type != NULL, G_FILE_TYPE_UNKNOWN);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_file_type (file);
+}
+
+char *
+caja_file_info_get_name (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_name != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_name (file);
+}
+
+GFile *
+caja_file_info_get_location (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_location != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_location (file);
+}
+char *
+caja_file_info_get_uri (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_uri != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_uri (file);
+}
+
+char *
+caja_file_info_get_activation_uri (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_activation_uri != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_activation_uri (file);
+}
+
+GFile *
+caja_file_info_get_parent_location (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_parent_location != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_parent_location (file);
+}
+
+char *
+caja_file_info_get_parent_uri (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_parent_uri != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_parent_uri (file);
+}
+
+CajaFileInfo *
+caja_file_info_get_parent_info (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_parent_info != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_parent_info (file);
+}
+
+GMount *
+caja_file_info_get_mount (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_mount != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_mount (file);
+}
+
+char *
+caja_file_info_get_uri_scheme (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_uri_scheme != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_uri_scheme (file);
+}
+
+char *
+caja_file_info_get_mime_type (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_mime_type != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_mime_type (file);
+}
+
+gboolean
+caja_file_info_is_mime_type (CajaFileInfo *file,
+ const char *mime_type)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (mime_type != NULL, FALSE);
+ 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);
+}
+
+gboolean
+caja_file_info_is_directory (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->is_directory != NULL, FALSE);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->is_directory (file);
+}
+
+gboolean
+caja_file_info_can_write (CajaFileInfo *file)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->can_write != NULL, FALSE);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->can_write (file);
+}
+
+void
+caja_file_info_add_emblem (CajaFileInfo *file,
+ const char *emblem_name)
+{
+ g_return_if_fail (CAJA_IS_FILE_INFO (file));
+ g_return_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->add_emblem != NULL);
+
+ CAJA_FILE_INFO_GET_IFACE (file)->add_emblem (file, emblem_name);
+}
+
+char *
+caja_file_info_get_string_attribute (CajaFileInfo *file,
+ const char *attribute_name)
+{
+ g_return_val_if_fail (CAJA_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->get_string_attribute != NULL, NULL);
+ g_return_val_if_fail (attribute_name != NULL, NULL);
+
+ return CAJA_FILE_INFO_GET_IFACE (file)->get_string_attribute
+ (file, attribute_name);
+}
+
+void
+caja_file_info_add_string_attribute (CajaFileInfo *file,
+ const char *attribute_name,
+ const char *value)
+{
+ g_return_if_fail (CAJA_IS_FILE_INFO (file));
+ g_return_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->add_string_attribute != NULL);
+ g_return_if_fail (attribute_name != NULL);
+ g_return_if_fail (value != NULL);
+
+ CAJA_FILE_INFO_GET_IFACE (file)->add_string_attribute
+ (file, attribute_name, value);
+}
+
+void
+caja_file_info_invalidate_extension_info (CajaFileInfo *file)
+{
+ g_return_if_fail (CAJA_IS_FILE_INFO (file));
+ g_return_if_fail (CAJA_FILE_INFO_GET_IFACE (file)->invalidate_extension_info != NULL);
+
+ CAJA_FILE_INFO_GET_IFACE (file)->invalidate_extension_info (file);
+}
+
+CajaFileInfo *
+caja_file_info_lookup (GFile *location)
+{
+ return caja_file_info_getter (location, FALSE);
+}
+
+CajaFileInfo *
+caja_file_info_create (GFile *location)
+{
+ return caja_file_info_getter (location, TRUE);
+}
+
+CajaFileInfo *
+caja_file_info_lookup_for_uri (const char *uri)
+{
+ GFile *location;
+ CajaFile *file;
+
+ location = g_file_new_for_uri (uri);
+ file = caja_file_info_lookup (location);
+ g_object_unref (location);
+
+ return file;
+}
+
+CajaFileInfo *
+caja_file_info_create_for_uri (const char *uri)
+{
+ GFile *location;
+ CajaFile *file;
+
+ location = g_file_new_for_uri (uri);
+ file = caja_file_info_create (location);
+ g_object_unref (location);
+
+ return file;
+}
diff --git a/libcaja-extension/caja-file-info.h b/libcaja-extension/caja-file-info.h
new file mode 100644
index 00000000..48cba602
--- /dev/null
+++ b/libcaja-extension/caja-file-info.h
@@ -0,0 +1,140 @@
+/*
+ * caja-file-info.h - Information about a file
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/* CajaFileInfo is an interface to the CajaFile object. It
+ * provides access to the asynchronous data in the CajaFile.
+ * Extensions are passed objects of this type for operations. */
+
+#ifndef CAJA_FILE_INFO_H
+#define CAJA_FILE_INFO_H
+
+#include <glib-object.h>
+#include <gio/gio.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+#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
+
+#endif
diff --git a/libcaja-extension/caja-info-provider.c b/libcaja-extension/caja-info-provider.c
new file mode 100644
index 00000000..0816142a
--- /dev/null
+++ b/libcaja-extension/caja-info-provider.c
@@ -0,0 +1,122 @@
+/*
+ * caja-info-provider.c - Interface for Caja extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-info-provider.h"
+
+#include <glib-object.h>
+
+static void
+caja_info_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+caja_info_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaInfoProviderIface),
+ caja_info_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaInfoProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+CajaOperationResult
+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),
+ CAJA_OPERATION_FAILED);
+ g_return_val_if_fail (CAJA_INFO_PROVIDER_GET_IFACE (provider)->update_file_info != NULL,
+ CAJA_OPERATION_FAILED);
+ g_return_val_if_fail (update_complete != NULL,
+ CAJA_OPERATION_FAILED);
+ g_return_val_if_fail (handle != NULL, CAJA_OPERATION_FAILED);
+
+ return CAJA_INFO_PROVIDER_GET_IFACE (provider)->update_file_info
+ (provider, file, update_complete, handle);
+}
+
+void
+caja_info_provider_cancel_update (CajaInfoProvider *provider,
+ CajaOperationHandle *handle)
+{
+ g_return_if_fail (CAJA_IS_INFO_PROVIDER (provider));
+ g_return_if_fail (CAJA_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL);
+ g_return_if_fail (CAJA_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL);
+ g_return_if_fail (handle != NULL);
+
+ CAJA_INFO_PROVIDER_GET_IFACE (provider)->cancel_update (provider,
+ handle);
+}
+
+void
+caja_info_provider_update_complete_invoke (GClosure *update_complete,
+ CajaInfoProvider *provider,
+ CajaOperationHandle *handle,
+ CajaOperationResult result)
+{
+ GValue args[3] = { { 0, } };
+ GValue return_val = { 0, };
+
+ g_return_if_fail (update_complete != NULL);
+ g_return_if_fail (CAJA_IS_INFO_PROVIDER (provider));
+
+ g_value_init (&args[0], CAJA_TYPE_INFO_PROVIDER);
+ g_value_init (&args[1], G_TYPE_POINTER);
+ g_value_init (&args[2], CAJA_TYPE_OPERATION_RESULT);
+
+ g_value_set_object (&args[0], provider);
+ g_value_set_pointer (&args[1], handle);
+ g_value_set_enum (&args[2], result);
+
+ g_closure_invoke (update_complete, &return_val, 3, args, NULL);
+
+ g_value_unset (&args[0]);
+ g_value_unset (&args[1]);
+ g_value_unset (&args[2]);
+}
+
+
diff --git a/libcaja-extension/caja-info-provider.h b/libcaja-extension/caja-info-provider.h
new file mode 100644
index 00000000..e4be7c47
--- /dev/null
+++ b/libcaja-extension/caja-info-provider.h
@@ -0,0 +1,87 @@
+/*
+ * caja-info-provider.h - Interface for Caja extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * provide information about files. Extensions are called when Caja
+ * needs information about a file. They are passed a CajaFileInfo
+ * object which should be filled with relevant information */
+
+#ifndef CAJA_INFO_PROVIDER_H
+#define CAJA_INFO_PROVIDER_H
+
+#include <glib-object.h>
+#include "caja-extension-types.h"
+#include "caja-file-info.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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
+
+#endif
diff --git a/libcaja-extension/caja-location-widget-provider.c b/libcaja-extension/caja-location-widget-provider.c
new file mode 100644
index 00000000..4a915b3b
--- /dev/null
+++ b/libcaja-extension/caja-location-widget-provider.c
@@ -0,0 +1,74 @@
+/*
+ * caja-location-widget-provider.c - Interface for Caja
+ extensions that provide extra widgets for a location
+ *
+ * Copyright (C) 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Alexander Larsson <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-location-widget-provider.h"
+
+#include <glib-object.h>
+
+static void
+caja_location_widget_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+caja_location_widget_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaLocationWidgetProviderIface),
+ caja_location_widget_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaLocationWidgetProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GtkWidget *
+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);
+
+ return CAJA_LOCATION_WIDGET_PROVIDER_GET_IFACE (provider)->get_widget
+ (provider, uri, window);
+
+}
diff --git a/libcaja-extension/caja-location-widget-provider.h b/libcaja-extension/caja-location-widget-provider.h
new file mode 100644
index 00000000..6d9af7a2
--- /dev/null
+++ b/libcaja-extension/caja-location-widget-provider.h
@@ -0,0 +1,69 @@
+/*
+ * caja-info-provider.h - Interface for Caja extensions that
+ * provide info about files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ * Copyright (C) 2005 Red Hat, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ * Alexander Larsson <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * provide extra location widgets for a particular location.
+ * Extensions are called when Caja displays a location.
+ */
+
+#ifndef CAJA_LOCATION_WIDGET_PROVIDER_H
+#define CAJA_LOCATION_WIDGET_PROVIDER_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include "caja-extension-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+
+ struct _CajaLocationWidgetProviderIface
+ {
+ GTypeInterface g_iface;
+
+ 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
+
+#endif
diff --git a/libcaja-extension/caja-menu-item.c b/libcaja-extension/caja-menu-item.c
new file mode 100644
index 00000000..967f8001
--- /dev/null
+++ b/libcaja-extension/caja-menu-item.c
@@ -0,0 +1,342 @@
+/*
+ * caja-menu-item.c - Menu items exported by CajaMenuProvider
+ * objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-menu.h"
+#include "caja-extension-i18n.h"
+
+enum
+{
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_TIP,
+ PROP_ICON,
+ PROP_SENSITIVE,
+ PROP_PRIORITY,
+ PROP_MENU,
+ LAST_PROP
+};
+
+struct _CajaMenuItemDetails
+{
+ char *name;
+ char *label;
+ char *tip;
+ char *icon;
+ CajaMenu *menu;
+ gboolean sensitive;
+ gboolean priority;
+};
+
+static guint signals[LAST_SIGNAL];
+
+static GObjectClass *parent_class = NULL;
+
+/**
+ * caja_menu_item_new:
+ * @name: the identifier for the menu item
+ * @label: the user-visible label of the menu item
+ * @tip: the tooltip of the menu item
+ * @icon: the name of the icon to display in the menu item
+ *
+ * Creates a new menu item that can be added to the toolbar or to a contextual menu.
+ *
+ * Returns: a newly create #CajaMenuItem
+ */
+CajaMenuItem *
+caja_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon)
+{
+ CajaMenuItem *item;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL, NULL);
+ g_return_val_if_fail (tip != NULL, NULL);
+
+ item = g_object_new (CAJA_TYPE_MENU_ITEM,
+ "name", name,
+ "label", label,
+ "tip", tip,
+ "icon", icon,
+ NULL);
+
+ return item;
+}
+
+/**
+ * caja_menu_item_activate:
+ * @item: pointer to a #CajaMenuItem
+ *
+ * emits the activate signal.
+ */
+void
+caja_menu_item_activate (CajaMenuItem *item)
+{
+ g_signal_emit (item, signals[ACTIVATE], 0);
+}
+
+/**
+ * caja_menu_item_set_submenu:
+ * @item: pointer to a #CajaMenuItem
+ * @menu: pointer to a #CajaMenu to attach to the button
+ *
+ * Attachs a menu to the given #CajaMenuItem.
+ */
+void
+caja_menu_item_set_submenu (CajaMenuItem *item, CajaMenu *menu)
+{
+ g_object_set (item, "menu", menu, NULL);
+}
+
+static void
+caja_menu_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ CajaMenuItem *item;
+
+ item = CAJA_MENU_ITEM (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME :
+ g_value_set_string (value, item->details->name);
+ break;
+ case PROP_LABEL :
+ g_value_set_string (value, item->details->label);
+ break;
+ case PROP_TIP :
+ g_value_set_string (value, item->details->tip);
+ break;
+ case PROP_ICON :
+ g_value_set_string (value, item->details->icon);
+ break;
+ case PROP_SENSITIVE :
+ g_value_set_boolean (value, item->details->sensitive);
+ break;
+ case PROP_PRIORITY :
+ g_value_set_boolean (value, item->details->priority);
+ break;
+ case PROP_MENU :
+ g_value_set_object (value, item->details->menu);
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_menu_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CajaMenuItem *item;
+
+ item = CAJA_MENU_ITEM (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME :
+ g_free (item->details->name);
+ item->details->name = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "name");
+ break;
+ case PROP_LABEL :
+ g_free (item->details->label);
+ item->details->label = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "label");
+ break;
+ case PROP_TIP :
+ g_free (item->details->tip);
+ item->details->tip = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "tip");
+ break;
+ case PROP_ICON :
+ g_free (item->details->icon);
+ item->details->icon = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "icon");
+ break;
+ case PROP_SENSITIVE :
+ item->details->sensitive = g_value_get_boolean (value);
+ g_object_notify (object, "sensitive");
+ break;
+ case PROP_PRIORITY :
+ item->details->priority = g_value_get_boolean (value);
+ g_object_notify (object, "priority");
+ break;
+ case PROP_MENU :
+ if (item->details->menu)
+ {
+ g_object_unref (item->details->menu);
+ }
+ item->details->menu = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "menu");
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_menu_item_finalize (GObject *object)
+{
+ CajaMenuItem *item;
+
+ item = CAJA_MENU_ITEM (object);
+
+ g_free (item->details->name);
+ g_free (item->details->label);
+ g_free (item->details->tip);
+ g_free (item->details->icon);
+ if (item->details->menu)
+ {
+ g_object_unref (item->details->menu);
+ }
+
+ g_free (item->details);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+caja_menu_item_instance_init (CajaMenuItem *item)
+{
+ item->details = g_new0 (CajaMenuItemDetails, 1);
+ item->details->sensitive = TRUE;
+ item->details->menu = NULL;
+}
+
+static void
+caja_menu_item_class_init (CajaMenuItemClass *class)
+{
+ parent_class = g_type_class_peek_parent (class);
+
+ G_OBJECT_CLASS (class)->finalize = caja_menu_item_finalize;
+ G_OBJECT_CLASS (class)->get_property = caja_menu_item_get_property;
+ G_OBJECT_CLASS (class)->set_property = caja_menu_item_set_property;
+
+ signals[ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (CajaMenuItemClass,
+ activate),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the item",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_LABEL,
+ g_param_spec_string ("label",
+ "Label",
+ "Label to display to the user",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_TIP,
+ g_param_spec_string ("tip",
+ "Tip",
+ "Tooltip for the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_ICON,
+ g_param_spec_string ("icon",
+ "Icon",
+ "Name of the icon to display in the menu item",
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_SENSITIVE,
+ g_param_spec_boolean ("sensitive",
+ "Sensitive",
+ "Whether the menu item is sensitive",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_PRIORITY,
+ g_param_spec_boolean ("priority",
+ "Priority",
+ "Show priority text in toolbars",
+ TRUE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_MENU,
+ g_param_spec_object ("menu",
+ "Menu",
+ "The menu belonging to this item. May be null.",
+ CAJA_TYPE_MENU,
+ G_PARAM_READWRITE));
+}
+
+GType
+caja_menu_item_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaMenuItemClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)caja_menu_item_class_init,
+ NULL,
+ NULL,
+ sizeof (CajaMenuItem),
+ 0,
+ (GInstanceInitFunc)caja_menu_item_instance_init
+ };
+
+ type = g_type_register_static
+ (G_TYPE_OBJECT,
+ "CajaMenuItem",
+ &info, 0);
+ }
+
+ return type;
+}
+
diff --git a/libcaja-extension/caja-menu-item.h b/libcaja-extension/caja-menu-item.h
new file mode 100644
index 00000000..c598b131
--- /dev/null
+++ b/libcaja-extension/caja-menu-item.h
@@ -0,0 +1,30 @@
+/*
+ * caja-menu-item.h - Menu items exported by CajaMenuProvider
+ * objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#ifndef CAJA_MENU_ITEM_H
+#define CAJA_MENU_ITEM_H
+
+#include "caja-menu.h"
+
+#endif
diff --git a/libcaja-extension/caja-menu-provider.c b/libcaja-extension/caja-menu-provider.c
new file mode 100644
index 00000000..98b3714d
--- /dev/null
+++ b/libcaja-extension/caja-menu-provider.c
@@ -0,0 +1,143 @@
+/*
+ * caja-property-page-provider.c - Interface for Caja extensions
+ * that provide context menu items
+ * for files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-menu-provider.h"
+
+#include <glib-object.h>
+
+static void
+caja_menu_provider_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ 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,
+ G_SIGNAL_RUN_LAST,
+ 0,
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+ initialized = TRUE;
+ }
+}
+
+GType
+caja_menu_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaMenuProviderIface),
+ caja_menu_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaMenuProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GList *
+caja_menu_provider_get_file_items (CajaMenuProvider *provider,
+ 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)
+ {
+ return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_file_items
+ (provider, window, files);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+GList *
+caja_menu_provider_get_background_items (CajaMenuProvider *provider,
+ 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_background_items)
+ {
+ return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_background_items
+ (provider, window, current_folder);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+GList *
+caja_menu_provider_get_toolbar_items (CajaMenuProvider *provider,
+ 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)
+ {
+ return CAJA_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items
+ (provider, window, current_folder);
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/* 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_return_if_fail (CAJA_IS_MENU_PROVIDER (provider));
+
+ g_signal_emit_by_name (provider, "items_updated");
+}
+
diff --git a/libcaja-extension/caja-menu-provider.h b/libcaja-extension/caja-menu-provider.h
new file mode 100644
index 00000000..0e947932
--- /dev/null
+++ b/libcaja-extension/caja-menu-provider.h
@@ -0,0 +1,85 @@
+/*
+ * caja-menu-provider.h - Interface for Caja extensions that
+ * provide context menu items.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * add context menu entries to files. Extensions are called when
+ * Caja constructs the context menu for a file. They are passed a
+ * list of CajaFileInfo objects which holds the current selection */
+
+#ifndef CAJA_MENU_PROVIDER_H
+#define CAJA_MENU_PROVIDER_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include "caja-extension-types.h"
+#include "caja-file-info.h"
+#include "caja-menu.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+
+ struct _CajaMenuProviderIface
+ {
+ GTypeInterface g_iface;
+
+ 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);
+ };
+
+ /* 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);
+
+ /* This function emit a signal to inform caja that its item list has changed. */
+ void caja_menu_provider_emit_items_updated_signal (CajaMenuProvider *provider);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-menu.c b/libcaja-extension/caja-menu.c
new file mode 100644
index 00000000..3b29b27b
--- /dev/null
+++ b/libcaja-extension/caja-menu.c
@@ -0,0 +1,112 @@
+/*
+ * caja-menu.h - Menus exported by CajaMenuProvider objects.
+ *
+ * Copyright (C) 2005 Raffaele Sandrini
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Raffaele Sandrini <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-menu.h"
+#include "caja-extension-i18n.h"
+
+#include <glib.h>
+
+#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
+{
+ GList *item_list;
+};
+
+void
+caja_menu_append_item (CajaMenu *menu, CajaMenuItem *item)
+{
+ g_return_if_fail (menu != NULL);
+ g_return_if_fail (item != NULL);
+
+ menu->priv->item_list = g_list_append (menu->priv->item_list, g_object_ref (item));
+}
+
+GList *
+caja_menu_get_items (CajaMenu *menu)
+{
+ GList *item_list;
+
+ g_return_val_if_fail (menu != NULL, NULL);
+
+ item_list = g_list_copy (menu->priv->item_list);
+ g_list_foreach (item_list, (GFunc)g_object_ref, NULL);
+
+ return item_list;
+}
+
+void
+caja_menu_item_list_free (GList *item_list)
+{
+ g_return_if_fail (item_list != NULL);
+
+ g_list_foreach (item_list, (GFunc)g_object_unref, NULL);
+ g_list_free (item_list);
+}
+
+/* Type initialization */
+
+static void
+caja_menu_finalize (GObject *object)
+{
+ CajaMenu *menu = CAJA_MENU (object);
+
+ if (menu->priv->item_list)
+ {
+ g_list_free (menu->priv->item_list);
+ }
+
+ G_OBJECT_CLASS (caja_menu_parent_class)->finalize (object);
+}
+
+static void
+caja_menu_init (CajaMenu *menu)
+{
+ menu->priv = CAJA_MENU_GET_PRIVATE (menu);
+
+ menu->priv->item_list = NULL;
+}
+
+static void
+caja_menu_class_init (CajaMenuClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (klass, sizeof (CajaMenuPrivate));
+
+ object_class->finalize = caja_menu_finalize;
+}
+
+/* public constructors */
+
+CajaMenu *
+caja_menu_new (void)
+{
+ CajaMenu *obj;
+
+ obj = CAJA_MENU (g_object_new (CAJA_TYPE_MENU, NULL));
+
+ return obj;
+}
diff --git a/libcaja-extension/caja-menu.h b/libcaja-extension/caja-menu.h
new file mode 100644
index 00000000..7d75e337
--- /dev/null
+++ b/libcaja-extension/caja-menu.h
@@ -0,0 +1,125 @@
+/*
+ * caja-menu.h - Menus exported by CajaMenuProvider objects.
+ *
+ * Copyright (C) 2005 Raffaele Sandrini
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ * Raffaele Sandrini <[email protected]>
+ *
+ */
+
+#ifndef CAJA_MENU_H
+#define CAJA_MENU_H
+
+#include <glib-object.h>
+#include "caja-extension-types.h"
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ /* 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 */
+#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))
+#define CAJA_MENU_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_MENU_ITEM))
+#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.
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* CAJA_MENU_H */
diff --git a/libcaja-extension/caja-property-page-provider.c b/libcaja-extension/caja-property-page-provider.c
new file mode 100644
index 00000000..da6ab1d0
--- /dev/null
+++ b/libcaja-extension/caja-property-page-provider.c
@@ -0,0 +1,89 @@
+/*
+ * caja-property-page-provider.c - Interface for Caja extensions
+ * that provide property pages for
+ * files.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-property-page-provider.h"
+
+#include <glib-object.h>
+
+static void
+caja_property_page_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+caja_property_page_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaPropertyPageProviderIface),
+ caja_property_page_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "CajaPropertyPageProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+/**
+ * caja_property_page_provider_get_pages:
+ * @provider: a #CajaPropertyPageProvider
+ * @files: a #GList of #CajaFileInfo
+ *
+ * This function is called by Caja when it wants property page
+ * items from the extension.
+ *
+ * This function is called in the main thread before a property page
+ * is shown, so it should return quickly.
+ *
+ * Returns: A #GList of allocated #CajaPropertyPage items.
+ */
+GList *
+caja_property_page_provider_get_pages (CajaPropertyPageProvider *provider,
+ GList *files)
+{
+ g_return_val_if_fail (CAJA_IS_PROPERTY_PAGE_PROVIDER (provider), NULL);
+ g_return_val_if_fail (CAJA_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages != NULL, NULL);
+
+ return CAJA_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages
+ (provider, files);
+}
+
+
diff --git a/libcaja-extension/caja-property-page-provider.h b/libcaja-extension/caja-property-page-provider.h
new file mode 100644
index 00000000..a9f0227c
--- /dev/null
+++ b/libcaja-extension/caja-property-page-provider.h
@@ -0,0 +1,68 @@
+/*
+ * caja-property-page-provider.h - Interface for Caja extensions
+ * that provide property pages.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+/* This interface is implemented by Caja extensions that want to
+ * add property page to property dialogs. Extensions are called when
+ * Caja needs property pages for a selection. They are passed a
+ * list of CajaFileInfo objects for which information should
+ * be displayed */
+
+#ifndef CAJA_PROPERTY_PAGE_PROVIDER_H
+#define CAJA_PROPERTY_PAGE_PROVIDER_H
+
+#include <glib-object.h>
+#include "caja-extension-types.h"
+#include "caja-file-info.h"
+#include "caja-property-page.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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;
+
+ struct _CajaPropertyPageProviderIface
+ {
+ GTypeInterface g_iface;
+
+ GList *(*get_pages) (CajaPropertyPageProvider *provider,
+ GList *files);
+ };
+
+ /* Interface Functions */
+ GType caja_property_page_provider_get_type (void);
+ GList *caja_property_page_provider_get_pages (CajaPropertyPageProvider *provider,
+ GList *files);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/caja-property-page.c b/libcaja-extension/caja-property-page.c
new file mode 100644
index 00000000..2ad869c4
--- /dev/null
+++ b/libcaja-extension/caja-property-page.c
@@ -0,0 +1,246 @@
+/*
+ * caja-property-page.h - Property pages exported by
+ * CajaPropertyProvider objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#include <config.h>
+#include "caja-property-page.h"
+
+#include "caja-extension-i18n.h"
+
+enum
+{
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_PAGE,
+ LAST_PROP
+};
+
+struct _CajaPropertyPageDetails
+{
+ char *name;
+ GtkWidget *label;
+ GtkWidget *page;
+};
+
+static GObjectClass *parent_class = NULL;
+
+/**
+ * caja_property_page_new:
+ * @name: the identifier for the property page
+ * @label: the user-visible label of the property page
+ * @page: the property page to display
+ *
+ * Creates a new #CajaPropertyPage from page_widget.
+ *
+ * Returns: a newly created #CajaPropertyPage
+ */
+CajaPropertyPage *
+caja_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page_widget)
+{
+ CajaPropertyPage *page;
+
+ g_return_val_if_fail (name != NULL, NULL);
+ g_return_val_if_fail (label != NULL && GTK_IS_WIDGET (label), NULL);
+ g_return_val_if_fail (page_widget != NULL && GTK_IS_WIDGET (page_widget),
+ NULL);
+
+ page = g_object_new (CAJA_TYPE_PROPERTY_PAGE,
+ "name", name,
+ "label", label,
+ "page", page_widget,
+ NULL);
+
+ return page;
+}
+
+static void
+caja_property_page_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ CajaPropertyPage *page;
+
+ page = CAJA_PROPERTY_PAGE (object);
+
+ switch (param_id)
+ {
+ case PROP_NAME :
+ g_value_set_string (value, page->details->name);
+ break;
+ case PROP_LABEL :
+ g_value_set_object (value, page->details->label);
+ break;
+ case PROP_PAGE :
+ g_value_set_object (value, page->details->page);
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_property_page_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ CajaPropertyPage *page;
+
+ page = CAJA_PROPERTY_PAGE (object);
+
+ 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)
+ {
+ g_object_unref (page->details->label);
+ }
+
+ page->details->label = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "label");
+ break;
+ case PROP_PAGE :
+ if (page->details->page)
+ {
+ g_object_unref (page->details->page);
+ }
+
+ page->details->page = g_object_ref (g_value_get_object (value));
+ g_object_notify (object, "page");
+ break;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+caja_property_page_dispose (GObject *object)
+{
+ CajaPropertyPage *page;
+
+ page = CAJA_PROPERTY_PAGE (object);
+
+ if (page->details->label)
+ {
+ g_object_unref (page->details->label);
+ page->details->label = NULL;
+ }
+ if (page->details->page)
+ {
+ g_object_unref (page->details->page);
+ page->details->page = NULL;
+ }
+}
+
+static void
+caja_property_page_finalize (GObject *object)
+{
+ CajaPropertyPage *page;
+
+ page = CAJA_PROPERTY_PAGE (object);
+
+ g_free (page->details->name);
+
+ g_free (page->details);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+}
+
+static void
+caja_property_page_instance_init (CajaPropertyPage *page)
+{
+ page->details = g_new0 (CajaPropertyPageDetails, 1);
+}
+
+static void
+caja_property_page_class_init (CajaPropertyPageClass *class)
+{
+ parent_class = g_type_class_peek_parent (class);
+
+ G_OBJECT_CLASS (class)->finalize = caja_property_page_finalize;
+ G_OBJECT_CLASS (class)->dispose = caja_property_page_dispose;
+ G_OBJECT_CLASS (class)->get_property = caja_property_page_get_property;
+ G_OBJECT_CLASS (class)->set_property = caja_property_page_set_property;
+
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_NAME,
+ g_param_spec_string ("name",
+ "Name",
+ "Name of the page",
+ NULL,
+ G_PARAM_CONSTRUCT_ONLY | G_PARAM_WRITABLE | G_PARAM_READABLE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_LABEL,
+ g_param_spec_object ("label",
+ "Label",
+ "Label widget to display in the notebook tab",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (class),
+ PROP_PAGE,
+ g_param_spec_object ("page",
+ "Page",
+ "Widget for the property page",
+ GTK_TYPE_WIDGET,
+ G_PARAM_READWRITE));
+}
+
+GType
+caja_property_page_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type)
+ {
+ const GTypeInfo info =
+ {
+ sizeof (CajaPropertyPageClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)caja_property_page_class_init,
+ NULL,
+ NULL,
+ sizeof (CajaPropertyPage),
+ 0,
+ (GInstanceInitFunc)caja_property_page_instance_init
+ };
+
+ type = g_type_register_static
+ (G_TYPE_OBJECT,
+ "CajaPropertyPage",
+ &info, 0);
+ }
+
+ return type;
+}
diff --git a/libcaja-extension/caja-property-page.h b/libcaja-extension/caja-property-page.h
new file mode 100644
index 00000000..1e9e8b3a
--- /dev/null
+++ b/libcaja-extension/caja-property-page.h
@@ -0,0 +1,74 @@
+/*
+ * caja-property-page.h - Property pages exported by
+ * CajaPropertyProvider objects.
+ *
+ * Copyright (C) 2003 Novell, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * Author: Dave Camp <[email protected]>
+ *
+ */
+
+#ifndef CAJA_PROPERTY_PAGE_H
+#define CAJA_PROPERTY_PAGE_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+#include "caja-extension-types.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#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))
+#define CAJA_PROPERTY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAJA_TYPE_PROPERTY_PAGE, CajaPropertyPageClass))
+#define CAJA_IS_PROPERTY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAJA_TYPE_PROPERTY_PAGE))
+#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;
+
+ struct _CajaPropertyPage
+ {
+ GObject parent;
+
+ CajaPropertyPageDetails *details;
+ };
+
+ struct _CajaPropertyPageClass
+ {
+ GObjectClass parent;
+ };
+
+ 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
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/libcaja-extension/libcaja-extension-uninstalled.pc.in b/libcaja-extension/libcaja-extension-uninstalled.pc.in
new file mode 100644
index 00000000..0a6eb259
--- /dev/null
+++ b/libcaja-extension/libcaja-extension-uninstalled.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+extensiondir=@libdir@/caja/extensions-2.0
+
+Name: libcaja-extension
+Description: A library to create Caja view extensions
+Version: @VERSION@
+Requires: glib-2.0 gtk+-2.0
+Libs: ${pc_top_builddir}/${pcfiledir}/libcaja-extension.la
+Cflags: -I${pc_top_builddir}/${pcfiledir}/..
diff --git a/libcaja-extension/libcaja-extension.pc.in b/libcaja-extension/libcaja-extension.pc.in
new file mode 100644
index 00000000..c043c397
--- /dev/null
+++ b/libcaja-extension/libcaja-extension.pc.in
@@ -0,0 +1,12 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+extensiondir=@libdir@/caja/extensions-2.0
+
+Name: libcaja-extension
+Description: A library to create Caja view extensions
+Version: @VERSION@
+Requires: glib-2.0 gio-2.0 gtk+-2.0
+Libs: -L${libdir} -lcaja-extension
+Cflags: -I${includedir}/caja