[nautilus-actions] NAObject-derived classes implement NAIDataFactory interface



commit 5a92d2a0085048bb05df808e061b3b1c5cf271f4
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Feb 15 18:06:36 2010 +0100

    NAObject-derived classes implement NAIDataFactory interface

 ChangeLog                         |    8 ++
 src/core/Makefile.am              |    5 +
 src/core/na-object-action-enum.c  |  126 +++++++++++++++++++++++++++++
 src/core/na-object-id-enum.c      |   74 +++++++++++++++++
 src/core/na-object-item-enum.c    |  141 +++++++++++++++++++++++++++++++++
 src/core/na-object-menu-enum.c    |   52 ++++++++++++
 src/core/na-object-profile-enum.c |  158 +++++++++++++++++++++++++++++++++++++
 7 files changed, 564 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 3e2a9c1..32141ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2009-02-15 Pierre Wieser <pwieser trychlos org>
 
+	NAObject-derived classes implement NAIDataFactory interface.
+
+	* src/core/na-object-id-enum.c:
+	* src/core/na-object-item-enum.c:
+	* src/core/na-object-action-enum.c:
+	* src/core/na-object-profile-enum.c:
+	* src/core/na-object-menu-enum.c: New files.
+
 	Define NADataElement class.
 
 	* src/core/na-data-element.c:
diff --git a/src/core/Makefile.am b/src/core/Makefile.am
index d19df91..4f4e5b5 100644
--- a/src/core/Makefile.am
+++ b/src/core/Makefile.am
@@ -52,10 +52,15 @@ libna_core_la_SOURCES = \
 	na-io-factory.h										\
 	na-object.c											\
 	na-object-id.c										\
+	na-object-id-enum.c									\
 	na-object-item.c									\
+	na-object-item-enum.c								\
 	na-object-action.c									\
+	na-object-action-enum.c								\
 	na-object-profile.c									\
+	na-object-profile-enum.c							\
 	na-object-menu.c									\
+	na-object-menu-enum.c								\
 	\
 	na-iabout.c											\
 	na-iabout.h											\
diff --git a/src/core/na-object-action-enum.c b/src/core/na-object-action-enum.c
new file mode 100644
index 0000000..f07ff95
--- /dev/null
+++ b/src/core/na-object-action-enum.c
@@ -0,0 +1,126 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+#include <api/na-idata-factory-str.h>
+
+extern NadfIdType id_iddef [];			/* defined in na-object-id-enum.c */
+extern NadfIdType item_iddef [];		/* defined in na-object-item-enum.c */
+
+static NadfIdType action_iddef [] = {
+
+	{ NADF_DATA_VERSION,
+				"na-object-version",
+				TRUE,
+				"Action version",
+				"Version of the action",
+				NADF_TYPE_STRING,
+				"2.0",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_TARGET_SELECTION,
+				"na-object-target-selection",
+				TRUE,
+				"Target a selection context menu",
+				"Does the action target the context menu when there is some selection ?",
+				NADF_TYPE_BOOLEAN,
+				"TRUE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_TARGET_BACKGROUND,
+				"na-object-target-background",
+				TRUE,
+				"Target the folder context menu",
+				"Does the action target the context menu when there is no selection ?",
+				NADF_TYPE_BOOLEAN,
+				"FALSE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_TARGET_TOOLBAR,
+				"na-object-target-toolbar",
+				TRUE,
+				"Target the toolbar",
+				"Does the action target the toolbar ? " \
+				"Only an action may target the toolbar as Nautilus, as of 2.28, " \
+				"doesn't support menus in toolbar.",
+				NADF_TYPE_BOOLEAN,
+				"FALSE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_TOOLBAR_LABEL,
+				"na-object-toolbar-label",
+				TRUE,
+				"Toolbar label",
+				"Label of the action in the toolbar. " \
+				"Defaults to main label if empty or not set.",
+				NADF_TYPE_LOCALE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_TOOLBAR_SAME_LABEL,
+				"na-object-toolbar-same-label",
+				FALSE,
+				"Does the toolbar label is the same than the main one ?",
+				"Does the toolbar label is the same than the main one ?",
+				NADF_TYPE_BOOLEAN,
+				"true",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_LAST_ALLOCATED,
+				"na-object-last-allocated",
+				FALSE,
+				"Last allocated profile",
+				"Last allocated profile number in na_object_action_get_new_profile_name(), " \
+				"reset to zero when saving the action.",
+				NADF_TYPE_UINT,
+				"0",
+				TRUE,
+				FALSE },
+
+	{ 0, NULL, FALSE, NULL, NULL, 0, NULL, FALSE, FALSE },
+};
+
+NadfIdGroup action_id_groups [] = {
+	{ NA_DATA_FACTORY_ID_GROUP,         id_iddef },
+	{ NA_DATA_FACTORY_ITEM_GROUP,       item_iddef },
+	{ NA_DATA_FACTORY_ACTION_GROUP,     action_iddef },
+	{ NA_DATA_FACTORY_CONDITIONS_GROUP, NULL },
+	{ 0, NULL }
+};
diff --git a/src/core/na-object-id-enum.c b/src/core/na-object-id-enum.c
new file mode 100644
index 0000000..cefe991
--- /dev/null
+++ b/src/core/na-object-id-enum.c
@@ -0,0 +1,74 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+#include <api/na-idata-factory-str.h>
+
+NadfIdType id_iddef [] = {
+
+	{ NADF_DATA_ID,
+				"na-object-id",
+				FALSE,
+				"NAObjectId identifiant",
+				"Internal identifiant of the NAObjectId object. " \
+				"Historically a UUID used as a GConf directory (thus ASCII, case insensitive), " \
+				"it is also the basename of the .desktop file (thus UTF-8, case sensitive).",
+				NADF_TYPE_STRING,
+				NULL,
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_LABEL,
+				"na-object-label",
+				TRUE,
+				"NAObjectId label",
+				"Main label of the NAObjectId object. " \
+				"Serves as a default for the toolbar label of an action.",
+				NADF_TYPE_LOCALE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_PARENT,
+				"na-object-parent",
+				FALSE,
+				"NAObjectId Parent",
+				"The NAObjectItem which is the parent of this object.",
+				NADF_TYPE_POINTER,
+				NULL,
+				FALSE,
+				FALSE },
+
+	{ 0, NULL, FALSE, NULL, NULL, 0, NULL, FALSE, FALSE },
+};
diff --git a/src/core/na-object-item-enum.c b/src/core/na-object-item-enum.c
new file mode 100644
index 0000000..bf59ce6
--- /dev/null
+++ b/src/core/na-object-item-enum.c
@@ -0,0 +1,141 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+#include <api/na-idata-factory-str.h>
+
+NadfIdType item_iddef [] = {
+
+	{ NADF_DATA_TOOLTIP,
+				"na-object-tooltip",
+				TRUE,
+				"Item tooltip",
+				"Tooltip associated to the item in the context menu or in the toolbar.",
+				NADF_TYPE_LOCALE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_ICON,
+				"na-object-icon",
+				TRUE,
+				"Icon name",
+				"Icon displayed in the context menu and in the toolbar. " \
+				"May be the name of a themed icon, or the full path to any appropriate image.",
+				NADF_TYPE_LOCALE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_DESCRIPTION,
+				"na-object-description",
+				TRUE,
+				"Description",
+				"Some text which explains the goal of the menu or the action. " \
+				"Will be used, e.g. when displaying available items on a web site.",
+				NADF_TYPE_LOCALE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_SUBITEMS,
+				"na-object-subitems",
+				FALSE,
+				"Subitems",
+				"List of subitems objects",
+				NADF_TYPE_POINTER,
+				NULL,
+				FALSE,
+				FALSE },
+
+	{ NADF_DATA_SUBITEMS_SLIST,
+				"na-object-subitems-slist",
+				TRUE,
+				"Subitems",
+				"List of subitems ids, " \
+				"as readen from corresponding entry from the storage subsystem.",
+				NADF_TYPE_STRING_LIST,
+				"",
+				FALSE,
+				FALSE },
+
+	{ NADF_DATA_ENABLED,
+				"na-object-enabled",
+				TRUE,
+				"Enabled",
+				"Is the item enabled ? " \
+				"When FALSE, the item will never be candidate to the context menu," \
+				"nor to the toolbar.",
+				NADF_TYPE_BOOLEAN,
+				"TRUE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_READONLY,
+				"na-object-readonly",
+				FALSE,
+				"Read-only",
+				"Is the item only readable ? " \
+				"This is an intrinsic property, dynamically set when the item is unserialized. " \
+				"This property being FALSE doesn't mean that the item will actually be updatable, " \
+				"as this also depend of parameters set by user and administrator. " \
+				"Also, a property initially set to FALSE when first unserializing may be set to" \
+				"TRUE if an eccor occurs on a later write operation.",
+				NADF_TYPE_BOOLEAN,
+				"FALSE",
+				TRUE,
+				FALSE },
+
+	{ NADF_DATA_PROVIDER,
+				"na-object-provider",
+				FALSE,
+				"I/O provider",
+				"A pointer to the NAIOProvider object.",
+				NADF_TYPE_POINTER,
+				NULL,
+				TRUE,
+				FALSE },
+
+	{ NADF_DATA_PROVIDER_DATA,
+				"na-object-provider-data",
+				FALSE,
+				"I/O provider data",
+				"A pointer to some NAIOProvider specific data.",
+				NADF_TYPE_POINTER,
+				NULL,
+				TRUE,
+				FALSE },
+
+	{ 0, NULL, FALSE, NULL, NULL, 0, NULL, FALSE, FALSE },
+};
diff --git a/src/core/na-object-menu-enum.c b/src/core/na-object-menu-enum.c
new file mode 100644
index 0000000..5aa2d34
--- /dev/null
+++ b/src/core/na-object-menu-enum.c
@@ -0,0 +1,52 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+#include <api/na-idata-factory-str.h>
+
+extern NadfIdType id_iddef [];			/* defined in na-object-id-enum.c */
+extern NadfIdType item_iddef [];		/* defined in na-object-item-enum.c */
+
+static NadfIdType menu_iddef [] = {
+
+	{ 0, NULL, FALSE, NULL, NULL, 0, NULL, FALSE, FALSE },
+};
+
+NadfIdGroup menu_id_groups [] = {
+	{ NA_DATA_FACTORY_ID_GROUP,         id_iddef },
+	{ NA_DATA_FACTORY_ITEM_GROUP,       item_iddef },
+	{ NA_DATA_FACTORY_MENU_GROUP,       menu_iddef },
+	{ NA_DATA_FACTORY_CONDITIONS_GROUP, NULL },
+	{ 0, NULL }
+};
diff --git a/src/core/na-object-profile-enum.c b/src/core/na-object-profile-enum.c
new file mode 100644
index 0000000..d905500
--- /dev/null
+++ b/src/core/na-object-profile-enum.c
@@ -0,0 +1,158 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009, 2010 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This Program 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this Library; see the file COPYING.  If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ *   Frederic Ruaudel <grumz grumz net>
+ *   Rodrigo Moya <rodrigo gnome-db org>
+ *   Pierre Wieser <pwieser trychlos org>
+ *   ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <api/na-idata-factory-enum.h>
+#include <api/na-idata-factory-str.h>
+
+extern NadfIdType id_iddef [];			/* defined in na-object-id-enum.c */
+
+static NadfIdType profile_iddef [] = {
+
+	{ NADF_DATA_PATH,
+				"na-object-path",
+				TRUE,
+				"Command path",
+				"The path to the command.",
+				NADF_TYPE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_PARAMETERS,
+				"na-object-parameters",
+				TRUE,
+				"Command parameters",
+				"The parameters of the command.",
+				NADF_TYPE_STRING,
+				"",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_BASENAMES,
+				"na-object-basenames",
+				TRUE,
+				"Basenames",
+				"The basenames the selection must match. " \
+				"Defaults to '*'.",
+				NADF_TYPE_STRING_LIST,
+				"*",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_MATCHCASE,
+				"na-object-matchcase",
+				TRUE,
+				"Case sensitive",
+				"Whether the specified basenames are case sensitive." \
+				"Defaults to 'true'.",
+				NADF_TYPE_BOOLEAN,
+				"TRUE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_MIMETYPES,
+				"na-object-mimetypes",
+				TRUE,
+				"Mimetypes",
+				"The mimetypes the selection must match." \
+				"Defaults to '*'.",
+				NADF_TYPE_STRING_LIST,
+				"*",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_ISFILE,
+				"na-object-isfile",
+				TRUE,
+				"Applies to files only",
+				"Whether the profile only applies to files." \
+				"Defaults to 'true'",
+				NADF_TYPE_BOOLEAN,
+				"TRUE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_ISDIR,
+				"na-object-isdir",
+				TRUE,
+				"Applies to directories only",
+				"Whether the profile applies to directories only." \
+				"Defaults to 'false'",
+				NADF_TYPE_BOOLEAN,
+				"FALSE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_MULTIPLE,
+				"na-object-multiple",
+				TRUE,
+				"Multiple selection",
+				"Whether the selection may be multiple." \
+				"Defaults to 'false'.",
+				NADF_TYPE_BOOLEAN,
+				"FALSE",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_SCHEMES,
+				"na-object-schemes",
+				TRUE,
+				"Schemes",
+				"The list of schemes the selection must match." \
+				"Defaults to 'file'.",
+				NADF_TYPE_STRING_LIST,
+				"file",
+				TRUE,
+				TRUE },
+
+	{ NADF_DATA_FOLDERS,
+				"na-object-folders",
+				TRUE,
+				"Folders",
+				"The list of folders which apply when there is no selection." \
+				"Defaults to '/'.",
+				NADF_TYPE_STRING_LIST,
+				"/",
+				TRUE,
+				TRUE },
+
+	{ 0, NULL, FALSE, NULL, NULL, 0, NULL, FALSE, FALSE },
+};
+
+NadfIdGroup profile_id_groups [] = {
+	{ NA_DATA_FACTORY_ID_GROUP,         id_iddef },
+	{ NA_DATA_FACTORY_PROFILE_GROUP,    profile_iddef },
+	{ NA_DATA_FACTORY_CONDITIONS_GROUP, NULL },
+	{ 0, NULL }
+};



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]