summaryrefslogtreecommitdiff
path: root/libnautilus-extension
diff options
context:
space:
mode:
authorDave Camp <dave@ximian.com>2004-01-11 20:35:02 +0000
committerDave Camp <campd@src.gnome.org>2004-01-11 20:35:02 +0000
commit7cb9107c85bef29b5b8edc5fb7b06b52a041cc04 (patch)
tree6f1044bdbab09b99a8e595be0d4d8d16d27a1d47 /libnautilus-extension
parentb92ee1501d6afcd2993f468aa21e2976accd8519 (diff)
downloadnautilus-7cb9107c85bef29b5b8edc5fb7b06b52a041cc04.tar.gz
Merged from nautilus-extensions-branch.
2004-01-11 Dave Camp <dave@ximian.com> * Merged from nautilus-extensions-branch.
Diffstat (limited to 'libnautilus-extension')
-rw-r--r--libnautilus-extension/Makefile.am50
-rw-r--r--libnautilus-extension/libnautilus-extension.pc.in11
-rw-r--r--libnautilus-extension/nautilus-column-provider.c72
-rw-r--r--libnautilus-extension/nautilus-column-provider.h60
-rw-r--r--libnautilus-extension/nautilus-column.c237
-rw-r--r--libnautilus-extension/nautilus-column.h71
-rw-r--r--libnautilus-extension/nautilus-extension-i18n.h24
-rw-r--r--libnautilus-extension/nautilus-extension-types.c57
-rw-r--r--libnautilus-extension/nautilus-extension-types.h67
-rw-r--r--libnautilus-extension/nautilus-file-info.c202
-rw-r--r--libnautilus-extension/nautilus-file-info.h113
-rw-r--r--libnautilus-extension/nautilus-info-provider.c120
-rw-r--r--libnautilus-extension/nautilus-info-provider.h82
-rw-r--r--libnautilus-extension/nautilus-menu-item.c274
-rw-r--r--libnautilus-extension/nautilus-menu-item.h77
-rw-r--r--libnautilus-extension/nautilus-menu-provider.c110
-rw-r--r--libnautilus-extension/nautilus-menu-provider.h77
-rw-r--r--libnautilus-extension/nautilus-property-page-provider.c74
-rw-r--r--libnautilus-extension/nautilus-property-page-provider.h63
-rw-r--r--libnautilus-extension/nautilus-property-page.c221
-rw-r--r--libnautilus-extension/nautilus-property-page.h70
21 files changed, 2132 insertions, 0 deletions
diff --git a/libnautilus-extension/Makefile.am b/libnautilus-extension/Makefile.am
new file mode 100644
index 000000000..743f691d8
--- /dev/null
+++ b/libnautilus-extension/Makefile.am
@@ -0,0 +1,50 @@
+include $(top_srcdir)/Makefile.shared
+
+lib_LTLIBRARIES=libnautilus-extension.la
+
+INCLUDES=\
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(LIBNAUTILUS_EXTENSION_CFLAGS) \
+ $(DISABLE_DEPRECATED_CFLAGS) \
+ -DDATADIR=\""$(datadir)"\" \
+ $(NULL)
+
+libnautilus_extension_la_LDFLAGS=\
+ -version-info 1:0:0 \
+ $(LIBNAUTILUS_EXTENSION_LIBS) \
+ -no-undefined \
+ $(NULL)
+
+libnautilus_extension_includedir=$(includedir)/nautilus/libnautilus-extension
+
+libnautilus_extension_include_HEADERS= \
+ nautilus-column.h \
+ nautilus-column-provider.h \
+ nautilus-extension-types.h \
+ nautilus-file-info.h \
+ nautilus-menu-item.h \
+ nautilus-menu-provider.h \
+ nautilus-property-page.h \
+ nautilus-property-page-provider.h \
+ nautilus-info-provider.h \
+ $(NULL)
+
+libnautilus_extension_la_SOURCES= \
+ nautilus-column.c \
+ nautilus-column-provider.c \
+ nautilus-extension-types.c \
+ nautilus-file-info.c \
+ nautilus-menu-item.c \
+ nautilus-menu-provider.c \
+ nautilus-property-page.c \
+ nautilus-property-page-provider.c \
+ nautilus-info-provider.c \
+ $(NULL)
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA=libnautilus-extension.pc
+
+EXTRA_DIST = \
+ libnautilus-extension.pc.in \
+ $(NULL)
diff --git a/libnautilus-extension/libnautilus-extension.pc.in b/libnautilus-extension/libnautilus-extension.pc.in
new file mode 100644
index 000000000..5286e9b9b
--- /dev/null
+++ b/libnautilus-extension/libnautilus-extension.pc.in
@@ -0,0 +1,11 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libnautilus-extension
+Description: A library to create Nautilus view extensions
+Version: @VERSION@
+Requires: glib-2.0 gtk+-2.0 gnome-vfs-2.0
+Libs: -L${libdir} -lnautilus-extension
+Cflags: -I${includedir}/nautilus
diff --git a/libnautilus-extension/nautilus-column-provider.c b/libnautilus-extension/nautilus-column-provider.c
new file mode 100644
index 000000000..eff660ad0
--- /dev/null
+++ b/libnautilus-extension/nautilus-column-provider.c
@@ -0,0 +1,72 @@
+/*
+ * nautilus-column-provider.c - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-column-provider.h"
+
+#include <glib-object.h>
+
+static void
+nautilus_column_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_column_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusColumnProviderIface),
+ nautilus_column_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusColumnProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GList *
+nautilus_column_provider_get_columns (NautilusColumnProvider *provider)
+{
+ g_return_val_if_fail (NAUTILUS_IS_COLUMN_PROVIDER (provider), NULL);
+ g_return_val_if_fail (NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns != NULL, NULL);
+
+ return NAUTILUS_COLUMN_PROVIDER_GET_IFACE (provider)->get_columns
+ (provider);
+}
+
+
diff --git a/libnautilus-extension/nautilus-column-provider.h b/libnautilus-extension/nautilus-column-provider.h
new file mode 100644
index 000000000..630e88ac4
--- /dev/null
+++ b/libnautilus-extension/nautilus-column-provider.h
@@ -0,0 +1,60 @@
+/*
+ * nautilus-column-provider.h - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus 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 NautilusInfoProvider */
+
+#ifndef NAUTILUS_COLUMN_PROVIDER_H
+#define NAUTILUS_COLUMN_PROVIDER_H
+
+#include <glib-object.h>
+#include "nautilus-extension-types.h"
+#include "nautilus-column.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_COLUMN_PROVIDER (nautilus_column_provider_get_type ())
+#define NAUTILUS_COLUMN_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_COLUMN_PROVIDER, NautilusColumnProvider))
+#define NAUTILUS_IS_COLUMN_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_COLUMN_PROVIDER))
+#define NAUTILUS_COLUMN_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_COLUMN_PROVIDER, NautilusColumnProviderIface))
+
+typedef struct _NautilusColumnProvider NautilusColumnProvider;
+typedef struct _NautilusColumnProviderIface NautilusColumnProviderIface;
+
+struct _NautilusColumnProviderIface {
+ GTypeInterface g_iface;
+
+ GList *(*get_columns) (NautilusColumnProvider *provider);
+};
+
+/* Interface Functions */
+GType nautilus_column_provider_get_type (void);
+GList *nautilus_column_provider_get_columns (NautilusColumnProvider *provider);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-column.c b/libnautilus-extension/nautilus-column.c
new file mode 100644
index 000000000..1679f0ca8
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.c
@@ -0,0 +1,237 @@
+/*
+ * nautilus-column.c - Info columns exported by NautilusColumnProvider
+ * 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-column.h"
+#include "nautilus-extension-i18n.h"
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_ATTRIBUTE,
+ PROP_LABEL,
+ PROP_DESCRIPTION,
+ PROP_XALIGN,
+ LAST_PROP
+};
+
+struct _NautilusColumnDetails {
+ char *name;
+ char *attribute;
+ char *label;
+ char *description;
+ float xalign;
+};
+
+NautilusColumn *
+nautilus_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description)
+{
+ NautilusColumn *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 (NAUTILUS_TYPE_COLUMN,
+ "name", name,
+ "attribute", attribute,
+ "label", label,
+ "description", description,
+ NULL);
+
+ return column;
+}
+
+static void
+nautilus_column_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_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, 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
+nautilus_column_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_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 :
+ g_free (column->details->attribute);
+ column->details->attribute = g_strdup (g_value_get_string (value));
+ g_object_notify (object, "attribute");
+ 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
+nautilus_column_finalize (GObject *object)
+{
+ NautilusColumn *column;
+
+ column = NAUTILUS_COLUMN (object);
+
+ g_free (column->details->name);
+ g_free (column->details->attribute);
+ g_free (column->details->label);
+ g_free (column->details->description);
+
+ g_free (column->details);
+}
+
+static void
+nautilus_column_instance_init (NautilusColumn *column)
+{
+ column->details = g_new0 (NautilusColumnDetails, 1);
+ column->details->xalign = 0.0;
+}
+
+static void
+nautilus_column_class_init (NautilusColumnClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_column_finalize;
+ G_OBJECT_CLASS (class)->get_property = nautilus_column_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_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_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));
+}
+
+GType
+nautilus_column_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusColumnClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)nautilus_column_class_init,
+ NULL,
+ NULL,
+ sizeof (NautilusColumn),
+ 0,
+ (GInstanceInitFunc)nautilus_column_instance_init
+ };
+
+ type = g_type_register_static
+ (G_TYPE_OBJECT,
+ "NautilusColumn",
+ &info, 0);
+ }
+
+ return type;
+}
diff --git a/libnautilus-extension/nautilus-column.h b/libnautilus-extension/nautilus-column.h
new file mode 100644
index 000000000..8ad627a9b
--- /dev/null
+++ b/libnautilus-extension/nautilus-column.h
@@ -0,0 +1,71 @@
+/*
+ * nautilus-column.h - Info columns exported by
+ * NautilusColumnProvider 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 <dave@ximian.com>
+ *
+ */
+
+#ifndef NAUTILUS_COLUMN_H
+#define NAUTILUS_COLUMN_H
+
+#include <glib-object.h>
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_COLUMN (nautilus_column_get_type())
+#define NAUTILUS_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_COLUMN, NautilusColumn))
+#define NAUTILUS_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_COLUMN, NautilusColumnClass))
+#define NAUTILUS_INFO_IS_COLUMN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_COLUMN))
+#define NAUTILUS_INFO_IS_COLUMN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_COLUMN))
+#define NAUTILUS_COLUMN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NAUTILUS_TYPE_COLUMN, NautilusColumnClass))
+
+typedef struct _NautilusColumn NautilusColumn;
+typedef struct _NautilusColumnDetails NautilusColumnDetails;
+typedef struct _NautilusColumnClass NautilusColumnClass;
+
+struct _NautilusColumn {
+ GObject parent;
+
+ NautilusColumnDetails *details;
+};
+
+struct _NautilusColumnClass {
+ GObjectClass parent;
+};
+
+GType nautilus_column_get_type (void);
+NautilusColumn * nautilus_column_new (const char *name,
+ const char *attribute,
+ const char *label,
+ const char *description);
+
+/* NautilusColumn 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
+ */
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-extension-i18n.h b/libnautilus-extension/nautilus-extension-i18n.h
new file mode 100644
index 000000000..97fa0ab4c
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension-i18n.h
@@ -0,0 +1,24 @@
+#ifndef NAUTILUS_EXTENSION_I18N_H
+#define NAUTILUS_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/libnautilus-extension/nautilus-extension-types.c b/libnautilus-extension/nautilus-extension-types.c
new file mode 100644
index 000000000..ee815fc10
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension-types.c
@@ -0,0 +1,57 @@
+/*
+ * nautilus-extension-types.c - Type definitions for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-extension-types.h"
+
+
+GType
+nautilus_operation_result_get_type (void)
+{
+ static GType type = 0;
+ if (type == 0) {
+ static const GEnumValue values[] = {
+ {
+ NAUTILUS_OPERATION_COMPLETE,
+ "NAUTILUS_OPERATION_COMPLETE",
+ "complete",
+ },
+ {
+ NAUTILUS_OPERATION_FAILED,
+ "NAUTILUS_OPERATION_FAILED",
+ "failed",
+ },
+ {
+ NAUTILUS_OPERATION_IN_PROGRESS,
+ "NAUTILUS_OPERATION_IN_PROGRESS",
+ "in_progress",
+ },
+ { 0, NULL, NULL }
+ };
+
+ type = g_enum_register_static ("NautilusOperationResult",
+ values);
+ }
+
+ return type;
+}
diff --git a/libnautilus-extension/nautilus-extension-types.h b/libnautilus-extension/nautilus-extension-types.h
new file mode 100644
index 000000000..806d17118
--- /dev/null
+++ b/libnautilus-extension/nautilus-extension-types.h
@@ -0,0 +1,67 @@
+/*
+ * nautilus-info-provider.h - Type definitions for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * provide information about files. Extensions are called when Nautilus
+ * needs information about a file. They are passed a NautilusFileInfo
+ * object which should be filled with relevant information */
+
+#ifndef NAUTILUS_EXTENSION_TYPES_H
+#define NAUTILUS_EXTENSION_TYPES_H
+
+#include <glib-object.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_OPERATION_RESULT (nautilus_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 NAUTILUS_OPERATION_IN_PROGRESS */
+typedef struct _NautilusOperationHandle NautilusOperationHandle;
+
+typedef enum {
+ /* Returned if the call succeeded, and the extension is done
+ * with the request */
+ NAUTILUS_OPERATION_COMPLETE,
+
+ /* Returned if the call failed */
+ NAUTILUS_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. */
+ NAUTILUS_OPERATION_IN_PROGRESS,
+} NautilusOperationResult;
+
+GType nautilus_operation_result_get_type (void);
+
+void nautilus_module_initialize (GTypeModule *module);
+void nautilus_module_shutdown (void);
+void nautilus_module_list_types (const GType **types,
+ int *num_types);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-file-info.c b/libnautilus-extension/nautilus-file-info.c
new file mode 100644
index 000000000..e245de9d7
--- /dev/null
+++ b/libnautilus-extension/nautilus-file-info.c
@@ -0,0 +1,202 @@
+/*
+ * nautilus-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 "nautilus-file-info.h"
+
+
+GList *
+nautilus_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
+nautilus_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
+nautilus_file_info_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_file_info_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusFileInfoIface),
+ nautilus_file_info_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusFileInfo",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+gboolean
+nautilus_file_info_is_gone (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone != NULL, FALSE);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_gone (file);
+}
+
+char *
+nautilus_file_info_get_name (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_name (file);
+}
+
+char *
+nautilus_file_info_get_uri (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri (file);
+}
+
+char *
+nautilus_file_info_get_parent_uri (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_parent_uri (file);
+}
+
+char *
+nautilus_file_info_get_uri_scheme (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_uri_scheme (file);
+}
+
+char *
+nautilus_file_info_get_mime_type (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_mime_type (file);
+}
+
+gboolean
+nautilus_file_info_is_mime_type (NautilusFileInfo *file,
+ const char *mime_type)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (mime_type != NULL, FALSE);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type != NULL, FALSE);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_mime_type (file,
+ mime_type);
+}
+
+gboolean
+nautilus_file_info_is_directory (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), FALSE);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory != NULL, FALSE);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->is_directory (file);
+}
+
+GnomeVFSFileInfo *
+nautilus_file_info_get_vfs_file_info (NautilusFileInfo *file)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_vfs_file_info != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_vfs_file_info (file);
+}
+
+void
+nautilus_file_info_add_emblem (NautilusFileInfo *file,
+ const char *emblem_name)
+{
+ g_return_if_fail (NAUTILUS_IS_FILE_INFO (file));
+ g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_vfs_file_info != NULL);
+
+ NAUTILUS_FILE_INFO_GET_IFACE (file)->add_emblem (file, emblem_name);
+}
+
+char *
+nautilus_file_info_get_string_attribute (NautilusFileInfo *file,
+ const char *attribute_name)
+{
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (file), NULL);
+ g_return_val_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute != NULL, NULL);
+ g_return_val_if_fail (attribute_name != NULL, NULL);
+
+ return NAUTILUS_FILE_INFO_GET_IFACE (file)->get_string_attribute
+ (file, attribute_name);
+}
+
+void
+nautilus_file_info_add_string_attribute (NautilusFileInfo *file,
+ const char *attribute_name,
+ const char *value)
+{
+ g_return_if_fail (NAUTILUS_IS_FILE_INFO (file));
+ g_return_if_fail (NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute != NULL);
+ g_return_if_fail (attribute_name != NULL);
+ g_return_if_fail (value != NULL);
+
+ NAUTILUS_FILE_INFO_GET_IFACE (file)->add_string_attribute
+ (file, attribute_name, value);
+}
diff --git a/libnautilus-extension/nautilus-file-info.h b/libnautilus-extension/nautilus-file-info.h
new file mode 100644
index 000000000..49d7d588b
--- /dev/null
+++ b/libnautilus-extension/nautilus-file-info.h
@@ -0,0 +1,113 @@
+/*
+ * nautilus-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.
+ *
+ */
+
+/* NautilusFileInfo is an interface to the NautilusFile object. It
+ * provides access to the asynchronous data in the NautilusFile.
+ * Extensions are passed objects of this type for operations. */
+
+#ifndef NAUTILUS_FILE_INFO_H
+#define NAUTILUS_FILE_INFO_H
+
+#include <glib-object.h>
+#include <libgnomevfs/gnome-vfs-file-info.h>
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_FILE_INFO (nautilus_file_info_get_type ())
+#define NAUTILUS_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_FILE_INFO, NautilusFileInfo))
+#define NAUTILUS_IS_FILE_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_FILE_INFO))
+#define NAUTILUS_FILE_INFO_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_FILE_INFO, NautilusFileInfoIface))
+
+
+#ifndef NAUTILUS_FILE_DEFINED
+#define NAUTILUS_FILE_DEFINED
+/* Using NautilusFile for the vtable to make implementing this in
+ * NautilusFile easier */
+typedef struct NautilusFile NautilusFile;
+#endif
+
+typedef NautilusFile NautilusFileInfo;
+typedef struct _NautilusFileInfoIface NautilusFileInfoIface;
+
+
+struct _NautilusFileInfoIface
+{
+ gboolean (*is_gone) (NautilusFileInfo *file);
+
+ char * (*get_name) (NautilusFileInfo *file);
+ char * (*get_uri) (NautilusFileInfo *file);
+ char * (*get_parent_uri) (NautilusFileInfo *file);
+ char * (*get_uri_scheme) (NautilusFileInfo *file);
+
+ char * (*get_mime_type) (NautilusFileInfo *file);
+ gboolean (*is_mime_type) (NautilusFileInfo *file,
+ const char *mime_Type);
+ gboolean (*is_directory) (NautilusFileInfo *file);
+
+ GnomeVFSFileInfo *(*get_vfs_file_info) (NautilusFileInfo *file);
+
+ void (*add_emblem) (NautilusFileInfo *file,
+ const char *emblem_name);
+ char * (*get_string_attribute) (NautilusFileInfo *file,
+ const char *attribute_name);
+ void (*add_string_attribute) (NautilusFileInfo *file,
+ const char *attribute_name,
+ const char *value);
+};
+
+GList *nautilus_file_info_list_copy (GList *files);
+void nautilus_file_info_list_free (GList *files);
+GType nautilus_file_info_get_type (void);
+
+/* Return true if the file has been deleted */
+gboolean nautilus_file_info_is_gone (NautilusFileInfo *file);
+
+/* Name and Location */
+char * nautilus_file_info_get_name (NautilusFileInfo *file);
+char * nautilus_file_info_get_uri (NautilusFileInfo *file);
+char * nautilus_file_info_get_parent_uri (NautilusFileInfo *file);
+char * nautilus_file_info_get_uri_scheme (NautilusFileInfo *file);
+
+/* File Type */
+char * nautilus_file_info_get_mime_type (NautilusFileInfo *file);
+gboolean nautilus_file_info_is_mime_type (NautilusFileInfo *file,
+ const char *mime_type);
+gboolean nautilus_file_info_is_directory (NautilusFileInfo *file);
+
+
+
+/* Other File Info */
+GnomeVFSFileInfo *nautilus_file_info_get_vfs_file_info (NautilusFileInfo *file);
+
+
+
+/* Modifying the NautilusFileInfo */
+void nautilus_file_info_add_emblem (NautilusFileInfo *file,
+ const char *emblem_name);
+char * nautilus_file_info_get_string_attribute (NautilusFileInfo *file,
+ const char *attribute_name);
+void nautilus_file_info_add_string_attribute (NautilusFileInfo *file,
+ const char *attribute_name,
+ const char *value);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-info-provider.c b/libnautilus-extension/nautilus-info-provider.c
new file mode 100644
index 000000000..942245190
--- /dev/null
+++ b/libnautilus-extension/nautilus-info-provider.c
@@ -0,0 +1,120 @@
+/*
+ * nautilus-info-provider.c - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-info-provider.h"
+
+#include <glib-object.h>
+
+static void
+nautilus_info_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_info_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusInfoProviderIface),
+ nautilus_info_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusInfoProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+NautilusOperationResult
+nautilus_info_provider_update_file_info (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle)
+{
+ g_return_val_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider),
+ NAUTILUS_OPERATION_FAILED);
+ g_return_val_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info != NULL,
+ NAUTILUS_OPERATION_FAILED);
+ g_return_val_if_fail (update_complete != NULL,
+ NAUTILUS_OPERATION_FAILED);
+ g_return_val_if_fail (handle != NULL, NAUTILUS_OPERATION_FAILED);
+
+ return NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->update_file_info
+ (provider, file, update_complete, handle);
+}
+
+void
+nautilus_info_provider_cancel_update (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle)
+{
+ g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider));
+ g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL);
+ g_return_if_fail (NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update != NULL);
+ g_return_if_fail (handle != NULL);
+
+ NAUTILUS_INFO_PROVIDER_GET_IFACE (provider)->cancel_update (provider,
+ handle);
+}
+
+void
+nautilus_info_provider_update_complete_invoke (GClosure *update_complete,
+ NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle,
+ NautilusOperationResult result)
+{
+ GValue args[3] = { { 0, } };
+ GValue return_val = { 0, };
+
+ g_return_if_fail (update_complete != NULL);
+ g_return_if_fail (NAUTILUS_IS_INFO_PROVIDER (provider));
+
+ g_value_init (&args[0], NAUTILUS_TYPE_INFO_PROVIDER);
+ g_value_init (&args[1], G_TYPE_POINTER);
+ g_value_init (&args[2], NAUTILUS_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/libnautilus-extension/nautilus-info-provider.h b/libnautilus-extension/nautilus-info-provider.h
new file mode 100644
index 000000000..ded7748d0
--- /dev/null
+++ b/libnautilus-extension/nautilus-info-provider.h
@@ -0,0 +1,82 @@
+/*
+ * nautilus-info-provider.h - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * provide information about files. Extensions are called when Nautilus
+ * needs information about a file. They are passed a NautilusFileInfo
+ * object which should be filled with relevant information */
+
+#ifndef NAUTILUS_INFO_PROVIDER_H
+#define NAUTILUS_INFO_PROVIDER_H
+
+#include <glib-object.h>
+#include "nautilus-extension-types.h"
+#include "nautilus-file-info.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_INFO_PROVIDER (nautilus_info_provider_get_type ())
+#define NAUTILUS_INFO_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_INFO_PROVIDER, NautilusInfoProvider))
+#define NAUTILUS_IS_INFO_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_INFO_PROVIDER))
+#define NAUTILUS_INFO_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_INFO_PROVIDER, NautilusInfoProviderIface))
+
+typedef struct _NautilusInfoProvider NautilusInfoProvider;
+typedef struct _NautilusInfoProviderIface NautilusInfoProviderIface;
+
+typedef void (*NautilusInfoProviderUpdateComplete) (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle,
+ NautilusOperationResult result,
+ gpointer user_data);
+
+struct _NautilusInfoProviderIface {
+ GTypeInterface g_iface;
+
+ NautilusOperationResult (*update_file_info) (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle);
+ void (*cancel_update) (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle);
+};
+
+/* Interface Functions */
+GType nautilus_info_provider_get_type (void);
+NautilusOperationResult nautilus_info_provider_update_file_info (NautilusInfoProvider *provider,
+ NautilusFileInfo *file,
+ GClosure *update_complete,
+ NautilusOperationHandle **handle);
+void nautilus_info_provider_cancel_update (NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle);
+
+
+
+/* Helper functions for implementations */
+void nautilus_info_provider_update_complete_invoke (GClosure *update_complete,
+ NautilusInfoProvider *provider,
+ NautilusOperationHandle *handle,
+ NautilusOperationResult result);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-menu-item.c b/libnautilus-extension/nautilus-menu-item.c
new file mode 100644
index 000000000..83a26e26e
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-item.c
@@ -0,0 +1,274 @@
+/*
+ * nautilus-menu-item.c - Menu items exported by NautilusMenuProvider
+ * 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-menu-item.h"
+#include "nautilus-extension-i18n.h"
+
+enum {
+ ACTIVATE,
+ LAST_SIGNAL
+};
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_TIP,
+ PROP_ICON,
+ PROP_SENSITIVE,
+ PROP_PRIORITY,
+ LAST_PROP
+};
+
+struct _NautilusMenuItemDetails {
+ char *name;
+ char *label;
+ char *tip;
+ char *icon;
+ gboolean sensitive;
+ gboolean priority;
+};
+
+static guint signals[LAST_SIGNAL];
+
+NautilusMenuItem *
+nautilus_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon)
+{
+ NautilusMenuItem *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 (NAUTILUS_TYPE_MENU_ITEM,
+ "name", name,
+ "label", label,
+ "tip", tip,
+ "icon", icon,
+ NULL);
+
+ return item;
+}
+
+void
+nautilus_menu_item_activate (NautilusMenuItem *item)
+{
+ g_signal_emit (item, signals[ACTIVATE], 0);
+}
+
+static void
+nautilus_menu_item_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusMenuItem *item;
+
+ item = NAUTILUS_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;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+nautilus_menu_item_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusMenuItem *item;
+
+ item = NAUTILUS_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;
+ default :
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
+ break;
+ }
+}
+
+static void
+nautilus_menu_item_finalize (GObject *object)
+{
+ NautilusMenuItem *item;
+
+ item = NAUTILUS_MENU_ITEM (object);
+
+ g_free (item->details->name);
+ g_free (item->details->label);
+ g_free (item->details->tip);
+ g_free (item->details->icon);
+
+ g_free (item->details);
+}
+
+static void
+nautilus_menu_item_instance_init (NautilusMenuItem *item)
+{
+ item->details = g_new0 (NautilusMenuItemDetails, 1);
+ item->details->sensitive = TRUE;
+}
+
+static void
+nautilus_menu_item_class_init (NautilusMenuItemClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_menu_item_finalize;
+ G_OBJECT_CLASS (class)->get_property = nautilus_menu_item_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_menu_item_set_property;
+
+ signals[ACTIVATE] =
+ g_signal_new ("activate",
+ G_TYPE_FROM_CLASS (class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (NautilusMenuItemClass,
+ 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));
+}
+
+GType
+nautilus_menu_item_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusMenuItemClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)nautilus_menu_item_class_init,
+ NULL,
+ NULL,
+ sizeof (NautilusMenuItem),
+ 0,
+ (GInstanceInitFunc)nautilus_menu_item_instance_init
+ };
+
+ type = g_type_register_static
+ (G_TYPE_OBJECT,
+ "NautilusMenuItem",
+ &info, 0);
+ }
+
+ return type;
+}
+
diff --git a/libnautilus-extension/nautilus-menu-item.h b/libnautilus-extension/nautilus-menu-item.h
new file mode 100644
index 000000000..be443d0b3
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-item.h
@@ -0,0 +1,77 @@
+/*
+ * nautilus-menu-item.h - Menu items exported by NautilusMenuProvider
+ * 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 <dave@ximian.com>
+ *
+ */
+
+#ifndef NAUTILUS_MENU_ITEM_H
+#define NAUTILUS_MENU_ITEM_H
+
+#include <glib-object.h>
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_MENU_ITEM (nautilus_menu_item_get_type())
+#define NAUTILUS_MENU_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_MENU_ITEM, NautilusMenuItem))
+#define NAUTILUS_MENU_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_MENU_ITEM, NautilusMenuItemClass))
+#define NAUTILUS_MENU_IS_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_MENU_ITEM))
+#define NAUTILUS_MENU_IS_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_MENU_ITEM))
+#define NAUTILUS_MENU_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NAUTILUS_TYPE_MENU_ITEM, NautilusMenuItemClass))
+
+typedef struct _NautilusMenuItem NautilusMenuItem;
+typedef struct _NautilusMenuItemDetails NautilusMenuItemDetails;
+typedef struct _NautilusMenuItemClass NautilusMenuItemClass;
+
+struct _NautilusMenuItem {
+ GObject parent;
+
+ NautilusMenuItemDetails *details;
+};
+
+struct _NautilusMenuItemClass {
+ GObjectClass parent;
+
+ void (*activate) (NautilusMenuItem *item);
+};
+
+GType nautilus_menu_item_get_type (void);
+NautilusMenuItem *nautilus_menu_item_new (const char *name,
+ const char *label,
+ const char *tip,
+ const char *icon);
+
+void nautilus_menu_item_activate (NautilusMenuItem *item);
+
+/* NautilusMenuItem 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.
+ */
+
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-menu-provider.c b/libnautilus-extension/nautilus-menu-provider.c
new file mode 100644
index 000000000..956c5ec0e
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.c
@@ -0,0 +1,110 @@
+/*
+ * nautilus-property-page-provider.c - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-menu-provider.h"
+
+#include <glib-object.h>
+
+static void
+nautilus_menu_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_menu_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusMenuProviderIface),
+ nautilus_menu_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusMenuProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GList *
+nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ GList *files)
+{
+ g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
+
+ if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items) {
+ return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_file_items
+ (provider, window, files);
+ } else {
+ return NULL;
+ }
+}
+
+GList *
+nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder)
+{
+ g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL);
+
+ if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items) {
+ return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_background_items
+ (provider, window, current_folder);
+ } else {
+ return NULL;
+ }
+}
+
+GList *
+nautilus_menu_provider_get_toolbar_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder)
+{
+ g_return_val_if_fail (NAUTILUS_IS_MENU_PROVIDER (provider), NULL);
+ g_return_val_if_fail (NAUTILUS_IS_FILE_INFO (current_folder), NULL);
+
+ if (NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items) {
+ return NAUTILUS_MENU_PROVIDER_GET_IFACE (provider)->get_toolbar_items
+ (provider, window, current_folder);
+ } else {
+ return NULL;
+ }
+}
+
+
diff --git a/libnautilus-extension/nautilus-menu-provider.h b/libnautilus-extension/nautilus-menu-provider.h
new file mode 100644
index 000000000..a7a9a2470
--- /dev/null
+++ b/libnautilus-extension/nautilus-menu-provider.h
@@ -0,0 +1,77 @@
+/*
+ * nautilus-menu-provider.h - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * add context menu entries to files. Extensions are called when
+ * Nautilus constructs the context menu for a file. They are passed a
+ * list of NautilusFileInfo objects which holds the current selection */
+
+#ifndef NAUTILUS_MENU_PROVIDER_H
+#define NAUTILUS_MENU_PROVIDER_H
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+#include "nautilus-extension-types.h"
+#include "nautilus-file-info.h"
+#include "nautilus-menu-item.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_MENU_PROVIDER (nautilus_menu_provider_get_type ())
+#define NAUTILUS_MENU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_MENU_PROVIDER, NautilusMenuProvider))
+#define NAUTILUS_IS_MENU_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_MENU_PROVIDER))
+#define NAUTILUS_MENU_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_MENU_PROVIDER, NautilusMenuProviderIface))
+
+typedef struct _NautilusMenuProvider NautilusMenuProvider;
+typedef struct _NautilusMenuProviderIface NautilusMenuProviderIface;
+
+struct _NautilusMenuProviderIface {
+ GTypeInterface g_iface;
+
+ GList *(*get_file_items) (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
+ GList *(*get_background_items) (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder);
+ GList *(*get_toolbar_items) (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder);
+};
+
+/* Interface Functions */
+GType nautilus_menu_provider_get_type (void);
+GList *nautilus_menu_provider_get_file_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ GList *files);
+GList *nautilus_menu_provider_get_background_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder);
+GList *nautilus_menu_provider_get_toolbar_items (NautilusMenuProvider *provider,
+ GtkWidget *window,
+ NautilusFileInfo *current_folder);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-property-page-provider.c b/libnautilus-extension/nautilus-property-page-provider.c
new file mode 100644
index 000000000..90e6b5594
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page-provider.c
@@ -0,0 +1,74 @@
+/*
+ * nautilus-property-page-provider.c - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-property-page-provider.h"
+
+#include <glib-object.h>
+
+static void
+nautilus_property_page_provider_base_init (gpointer g_class)
+{
+}
+
+GType
+nautilus_property_page_provider_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusPropertyPageProviderIface),
+ nautilus_property_page_provider_base_init,
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ 0,
+ NULL
+ };
+
+ type = g_type_register_static (G_TYPE_INTERFACE,
+ "NautilusPropertyPageProvider",
+ &info, 0);
+ g_type_interface_add_prerequisite (type, G_TYPE_OBJECT);
+ }
+
+ return type;
+}
+
+GList *
+nautilus_property_page_provider_get_pages (NautilusPropertyPageProvider *provider,
+ GList *files)
+{
+ g_return_val_if_fail (NAUTILUS_IS_PROPERTY_PAGE_PROVIDER (provider), NULL);
+ g_return_val_if_fail (NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages != NULL, NULL);
+
+ return NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE (provider)->get_pages
+ (provider, files);
+}
+
+
diff --git a/libnautilus-extension/nautilus-property-page-provider.h b/libnautilus-extension/nautilus-property-page-provider.h
new file mode 100644
index 000000000..56eada183
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page-provider.h
@@ -0,0 +1,63 @@
+/*
+ * nautilus-property-page-provider.h - Interface for Nautilus 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 <dave@ximian.com>
+ *
+ */
+
+/* This interface is implemented by Nautilus extensions that want to
+ * add property page to property dialogs. Extensions are called when
+ * Nautilus needs property pages for a selection. They are passed a
+ * list of NautilusFileInfo objects for which information should
+ * be displayed */
+
+#ifndef NAUTILUS_PROPERTY_PAGE_PROVIDER_H
+#define NAUTILUS_PROPERTY_PAGE_PROVIDER_H
+
+#include <glib-object.h>
+#include "nautilus-extension-types.h"
+#include "nautilus-file-info.h"
+#include "nautilus-property-page.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER (nautilus_property_page_provider_get_type ())
+#define NAUTILUS_PROPERTY_PAGE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER, NautilusPropertyPageProvider))
+#define NAUTILUS_IS_PROPERTY_PAGE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER))
+#define NAUTILUS_PROPERTY_PAGE_PROVIDER_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), NAUTILUS_TYPE_PROPERTY_PAGE_PROVIDER, NautilusPropertyPageProviderIface))
+
+typedef struct _NautilusPropertyPageProvider NautilusPropertyPageProvider;
+typedef struct _NautilusPropertyPageProviderIface NautilusPropertyPageProviderIface;
+
+struct _NautilusPropertyPageProviderIface {
+ GTypeInterface g_iface;
+
+ GList *(*get_pages) (NautilusPropertyPageProvider *provider,
+ GList *files);
+};
+
+/* Interface Functions */
+GType nautilus_property_page_provider_get_type (void);
+GList *nautilus_property_page_provider_get_pages (NautilusPropertyPageProvider *provider,
+ GList *files);
+
+G_END_DECLS
+
+#endif
diff --git a/libnautilus-extension/nautilus-property-page.c b/libnautilus-extension/nautilus-property-page.c
new file mode 100644
index 000000000..e27a82b44
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page.c
@@ -0,0 +1,221 @@
+/*
+ * nautilus-property-page.h - Property pages exported by
+ * NautilusPropertyProvider 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 <dave@ximian.com>
+ *
+ */
+
+#include <config.h>
+#include "nautilus-property-page.h"
+
+#include "nautilus-extension-i18n.h"
+
+enum {
+ PROP_0,
+ PROP_NAME,
+ PROP_LABEL,
+ PROP_PAGE,
+ LAST_PROP
+};
+
+
+struct _NautilusPropertyPageDetails {
+ char *name;
+ GtkWidget *label;
+ GtkWidget *page;
+};
+
+NautilusPropertyPage *
+nautilus_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page_widget)
+{
+ NautilusPropertyPage *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 (NAUTILUS_TYPE_PROPERTY_PAGE,
+ "name", name,
+ "label", label,
+ "page", page_widget,
+ NULL);
+
+ return page;
+}
+
+static void
+nautilus_property_page_get_property (GObject *object,
+ guint param_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_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
+nautilus_property_page_set_property (GObject *object,
+ guint param_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_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
+nautilus_property_page_dispose (GObject *object)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_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
+nautilus_property_page_finalize (GObject *object)
+{
+ NautilusPropertyPage *page;
+
+ page = NAUTILUS_PROPERTY_PAGE (object);
+
+ g_free (page->details->name);
+
+ g_free (page->details);
+}
+
+static void
+nautilus_property_page_instance_init (NautilusPropertyPage *page)
+{
+ page->details = g_new0 (NautilusPropertyPageDetails, 1);
+}
+
+static void
+nautilus_property_page_class_init (NautilusPropertyPageClass *class)
+{
+ G_OBJECT_CLASS (class)->finalize = nautilus_property_page_finalize;
+ G_OBJECT_CLASS (class)->dispose = nautilus_property_page_dispose;
+ G_OBJECT_CLASS (class)->get_property = nautilus_property_page_get_property;
+ G_OBJECT_CLASS (class)->set_property = nautilus_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
+nautilus_property_page_get_type (void)
+{
+ static GType type = 0;
+
+ if (!type) {
+ static const GTypeInfo info = {
+ sizeof (NautilusPropertyPageClass),
+ NULL,
+ NULL,
+ (GClassInitFunc)nautilus_property_page_class_init,
+ NULL,
+ NULL,
+ sizeof (NautilusPropertyPage),
+ 0,
+ (GInstanceInitFunc)nautilus_property_page_instance_init
+ };
+
+ type = g_type_register_static
+ (G_TYPE_OBJECT,
+ "NautilusPropertPage",
+ &info, 0);
+ }
+
+ return type;
+}
diff --git a/libnautilus-extension/nautilus-property-page.h b/libnautilus-extension/nautilus-property-page.h
new file mode 100644
index 000000000..944bd2390
--- /dev/null
+++ b/libnautilus-extension/nautilus-property-page.h
@@ -0,0 +1,70 @@
+/*
+ * nautilus-property-page.h - Property pages exported by
+ * NautilusPropertyProvider 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 <dave@ximian.com>
+ *
+ */
+
+#ifndef NAUTILUS_PROPERTY_PAGE_H
+#define NAUTILUS_PROPERTY_PAGE_H
+
+#include <glib-object.h>
+#include <gtk/gtkwidget.h>
+#include "nautilus-extension-types.h"
+
+G_BEGIN_DECLS
+
+#define NAUTILUS_TYPE_PROPERTY_PAGE (nautilus_property_page_get_type())
+#define NAUTILUS_PROPERTY_PAGE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NAUTILUS_TYPE_PROPERTY_PAGE, NautilusPropertyPage))
+#define NAUTILUS_PROPERTY_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NAUTILUS_TYPE_PROPERTY_PAGE, NautilusPropertyPageClass))
+#define NAUTILUS_PROPERTY_IS_PAGE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NAUTILUS_TYPE_PROPERTY_PAGE))
+#define NAUTILUS_PROPERTY_IS_PAGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), NAUTILUS_TYPE_PROPERTY_PAGE))
+#define NAUTILUS_PROPERTY_PAGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), NAUTILUS_TYPE_PROPERTY_PAGE, NautilusPropertyPageClass))
+
+typedef struct _NautilusPropertyPage NautilusPropertyPage;
+typedef struct _NautilusPropertyPageDetails NautilusPropertyPageDetails;
+typedef struct _NautilusPropertyPageClass NautilusPropertyPageClass;
+
+struct _NautilusPropertyPage
+{
+ GObject parent;
+
+ NautilusPropertyPageDetails *details;
+};
+
+struct _NautilusPropertyPageClass
+{
+ GObjectClass parent;
+};
+
+GType nautilus_property_page_get_type (void);
+NautilusPropertyPage *nautilus_property_page_new (const char *name,
+ GtkWidget *label,
+ GtkWidget *page);
+
+/* NautilusPropertyPage 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
+ */
+
+G_END_DECLS
+
+#endif