[nautilus-actions] Update NADataDef structure to be able to manage command-line arguments
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Update NADataDef structure to be able to manage command-line arguments
- Date: Tue, 16 Mar 2010 21:37:26 +0000 (UTC)
commit 2507d67f71e918eacf73a074fb8f6beed4299481
Author: Pierre Wieser <pwieser trychlos org>
Date: Wed Mar 10 21:58:06 2010 +0100
Update NADataDef structure to be able to manage command-line arguments
ChangeLog | 9 +++
src/api/na-data-def.h | 42 ++++++++----
src/core/na-icontextual-factory.c | 64 +++++++++++++++--
src/core/na-object-action-factory.c | 126 ++++++++++++++++++++++++++++++----
src/core/na-object-id-factory.c | 12 +++
src/core/na-object-item-factory.c | 80 ++++++++++++++++++++--
src/core/na-object-profile-factory.c | 24 ++++++-
7 files changed, 311 insertions(+), 46 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 739a012..9adb9dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2009-03-10 Pierre Wieser <pwieser trychlos org>
+ * src/api/na-data-def.h:
+ Add parameters to be able to manage command-line arguments.
+
+ * src/core/na-icontextual-factory.c:
+ * src/core/na-object-action-factory.c:
+ * src/core/na-object-id-factory.c:
+ * src/core/na-object-item-factory.c:
+ * src/core/na-object-profile-factory.c: Updated accordingly.
+
* src/core/na-io-provider.c (build_hierarchy):
Attach the child item to its parent.
diff --git a/src/api/na-data-def.h b/src/api/na-data-def.h
index 32f616e..23d21da 100644
--- a/src/api/na-data-def.h
+++ b/src/api/na-data-def.h
@@ -47,53 +47,69 @@ G_BEGIN_DECLS
* this structure
*/
typedef struct {
- gchar *name; /* both the id and the canonical name
+ gchar *name; /* both the id and the canonical name
* used when getting/setting properties
* must be globally unique
* must also be an invariant as it is known from plugin extensions */
- gboolean readable; /* whether the data should be read on unserialization ops.
+ gboolean readable; /* whether the data should be read on unserialization ops.
* if FALSE, then no attempt will be made to read it
* and the data will has to be set dynamically
* when a data has been written once (see below), and unless
* special cases (see e.g. type), it should remain readable
* even if it has becomen obsolete (for backward compatibility) */
- gboolean writable; /* whether the data is to be written on serialization ops.
+ gboolean writable; /* whether the data is to be written on serialization ops.
* if FALSE, then no attempt will be made to write it
* mainly set to FALSE to dynamically set variables and
* obsoleted ones */
- gboolean has_property; /* whether a property should be set for this variable ?
+ gboolean has_property; /* whether a property should be set for this variable ?
* set to FALSE for obsolete variables */
- gchar *short_label; /* short descriptive name
+ gchar *short_label; /* short descriptive name
* used in GParamSpec and in schemas */
- gchar *long_label; /* long, if not complete, description
+ gchar *long_label; /* long, if not complete, description
* used in GParamSpec and in schemas */
- guint type; /* the elementary NAFD_TYPE_xxx data type */
+ guint type; /* the elementary NAFD_TYPE_xxx data type */
- gchar *default_value; /* the default to assign when creating a new object
+ gchar *default_value; /* the default to assign when creating a new object
* this default is also displayed in command-line help
* of nautilus-actions-new utility */
- gboolean copyable; /* whether this data should be automatically copied when
+ gboolean copyable; /* whether this data should be automatically copied when
* we are duplicating an object to another
* in all cases, the implementation is always triggered
* by the copy() interface method */
- gboolean comparable; /* whether this data should be compared when we
+ gboolean comparable; /* whether this data should be compared when we
* are testing two objects for equality */
- gboolean mandatory; /* whether this data must be not null and not empty
+ gboolean mandatory; /* whether this data must be not null and not empty
* when we are testing for validity of an object */
- gboolean localizable; /* whether this is a localizable data
+ gboolean localizable; /* whether this is a localizable data
* when serializing or exporting */
- gchar *gconf_entry; /* same entry is also used for GConf-based XML docs */
+ gchar *gconf_entry; /* same entry is also used for GConf-based XML docs */
+
+ /* some parameters to be used when the variable is to be entered via a
+ * command-line program (e.g. see nautilus-actions-new).
+ */
+ gchar option_short; /* the short version of a command-line parameter */
+
+ gchar *option_long; /* the long version of the same command-line parameter */
+
+ gint option_flags; /* GOptionFlags for the command-line parameter */
+
+ GOptionArg option_arg; /* the type of the option */
+
+ gchar *option_label; /* the description for the variable
+ * defaults to short_label if NULL */
+
+ gchar *option_arg_label; /* the description for the argument */
}
NADataDef;
diff --git a/src/core/na-icontextual-factory.c b/src/core/na-icontextual-factory.c
index 65e3b79..1e4531b 100644
--- a/src/core/na-icontextual-factory.c
+++ b/src/core/na-icontextual-factory.c
@@ -57,7 +57,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "basenames", },
+ "basenames",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MATCHCASE,
TRUE,
@@ -76,7 +82,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "matchcase" },
+ "matchcase",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MIMETYPES,
TRUE,
@@ -94,7 +106,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "mimetypes" },
+ "mimetypes",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ISFILE,
TRUE,
@@ -116,7 +134,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "isfile" },
+ "isfile",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ISDIR,
TRUE,
@@ -138,7 +162,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "isdir" },
+ "isdir",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MULTIPLE,
TRUE,
@@ -155,7 +185,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "accept-multiple-files" },
+ "accept-multiple-files",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_SCHEMES,
TRUE,
@@ -184,7 +220,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "schemes" },
+ "schemes",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_FOLDERS,
TRUE,
@@ -201,7 +243,13 @@ NADataDef data_def_conditions [] = {
TRUE,
FALSE,
FALSE,
- "folders" },
+ "folders",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NULL },
};
diff --git a/src/core/na-object-action-factory.c b/src/core/na-object-action-factory.c
index 5408465..3cd9954 100644
--- a/src/core/na-object-action-factory.c
+++ b/src/core/na-object-action-factory.c
@@ -56,7 +56,13 @@ static NADataDef data_def_action [] = {
TRUE,
FALSE,
FALSE,
- "version" },
+ "version",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_TARGET_SELECTION,
TRUE,
@@ -72,7 +78,13 @@ static NADataDef data_def_action [] = {
TRUE,
FALSE,
FALSE,
- "target-selection" },
+ "target-selection",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* this data has been introduced in 2.29.1 and has been left up to 2.29.4
* it has been removed starting with 2.29.5
@@ -95,7 +107,13 @@ static NADataDef data_def_action [] = {
FALSE,
FALSE,
FALSE,
- "target-background" },
+ "target-background",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_TARGET_TOOLBAR,
TRUE,
@@ -110,7 +128,13 @@ static NADataDef data_def_action [] = {
TRUE,
FALSE,
FALSE,
- "target-toolbar" },
+ "target-toolbar",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_TOOLBAR_LABEL,
TRUE,
@@ -126,7 +150,13 @@ static NADataDef data_def_action [] = {
TRUE,
FALSE,
TRUE,
- "toolbar-label" },
+ "toolbar-label",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* this data has been introduced in 2.29.1 and has been left up to 2.29.4
* it has been removed starting with 2.29.5
@@ -145,7 +175,13 @@ static NADataDef data_def_action [] = {
TRUE,
FALSE,
FALSE,
- "toolbar-same-label" },
+ "toolbar-same-label",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* dynamic data, so non readable / non writable
*/
@@ -162,6 +198,12 @@ static NADataDef data_def_action [] = {
FALSE,
FALSE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
{ NULL },
@@ -185,7 +227,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "path" },
+ "path",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_PARAMETERS,
TRUE,
@@ -199,7 +247,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "parameters" },
+ "parameters",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_BASENAMES,
TRUE,
@@ -213,7 +267,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "basenames" },
+ "basenames",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MATCHCASE,
TRUE,
@@ -227,7 +287,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "matchcase" },
+ "matchcase",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MIMETYPES,
TRUE,
@@ -241,7 +307,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "mimetypes" },
+ "mimetypes",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ISFILE,
TRUE,
@@ -255,7 +327,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "isfile" },
+ "isfile",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ISDIR,
TRUE,
@@ -269,7 +347,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "isdir" },
+ "isdir",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_MULTIPLE,
TRUE,
@@ -283,7 +367,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "accept-multiple-files" },
+ "accept-multiple-files",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_SCHEMES,
TRUE,
@@ -297,7 +387,13 @@ NADataDef data_def_action_v1 [] = {
FALSE,
FALSE,
FALSE,
- "schemes" },
+ "schemes",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NULL },
};
diff --git a/src/core/na-object-id-factory.c b/src/core/na-object-id-factory.c
index 80f52f6..46c97c6 100644
--- a/src/core/na-object-id-factory.c
+++ b/src/core/na-object-id-factory.c
@@ -55,6 +55,12 @@ NADataDef data_def_id [] = {
TRUE,
TRUE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
/* dynamic data, so not readable / not writable
@@ -71,6 +77,12 @@ NADataDef data_def_id [] = {
FALSE,
FALSE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
{ NULL },
diff --git a/src/core/na-object-item-factory.c b/src/core/na-object-item-factory.c
index ba7a38d..9313aa2 100644
--- a/src/core/na-object-item-factory.c
+++ b/src/core/na-object-item-factory.c
@@ -59,7 +59,13 @@ NADataDef data_def_item [] = {
FALSE,
FALSE,
FALSE,
- "type" },
+ "type",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* this data is common between actions and menus
* so default value is directly set in na_object_action_new_with_defaults()
@@ -79,7 +85,13 @@ NADataDef data_def_item [] = {
TRUE,
FALSE,
TRUE,
- "label" },
+ "label",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_TOOLTIP,
TRUE,
@@ -95,7 +107,13 @@ NADataDef data_def_item [] = {
TRUE,
FALSE,
TRUE,
- "tooltip" },
+ "tooltip",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ICON,
TRUE,
@@ -112,7 +130,13 @@ NADataDef data_def_item [] = {
TRUE,
FALSE,
TRUE,
- "icon" },
+ "icon",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_DESCRIPTION,
TRUE,
@@ -127,7 +151,13 @@ NADataDef data_def_item [] = {
TRUE,
FALSE,
TRUE,
- "description" },
+ "description",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* dynamic data, so not readable / not writable
*/
@@ -143,6 +173,12 @@ NADataDef data_def_item [] = {
FALSE, /* not comparable */
FALSE, /* not mandatory */
FALSE, /* not localized */
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
/* list of subitems as a string list
@@ -163,7 +199,13 @@ NADataDef data_def_item [] = {
FALSE,
FALSE,
FALSE,
- "items" },
+ "items",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_ENABLED,
TRUE,
@@ -178,7 +220,13 @@ NADataDef data_def_item [] = {
TRUE,
FALSE,
FALSE,
- "enabled" },
+ "enabled",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
/* dynamic data, so non readable / non writable
* must be set by the NAIIOProvider when reading the item
@@ -200,6 +248,12 @@ NADataDef data_def_item [] = {
FALSE,
FALSE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
/* dynamic data, so non readable / non writable
@@ -216,6 +270,12 @@ NADataDef data_def_item [] = {
FALSE,
FALSE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
/* dynamic data, so non readable / non writable
@@ -233,6 +293,12 @@ NADataDef data_def_item [] = {
FALSE,
FALSE,
FALSE,
+ NULL,
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
NULL },
{ NULL },
diff --git a/src/core/na-object-profile-factory.c b/src/core/na-object-profile-factory.c
index 5654a91..137e672 100644
--- a/src/core/na-object-profile-factory.c
+++ b/src/core/na-object-profile-factory.c
@@ -56,7 +56,13 @@ static NADataDef data_def_profile [] = {
TRUE,
FALSE,
TRUE,
- "desc-name" },
+ "desc-name",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_PATH,
TRUE,
@@ -71,7 +77,13 @@ static NADataDef data_def_profile [] = {
TRUE,
TRUE,
FALSE,
- "path" },
+ "path",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NAFO_DATA_PARAMETERS,
TRUE,
@@ -100,7 +112,13 @@ static NADataDef data_def_profile [] = {
TRUE,
FALSE,
FALSE,
- "parameters" },
+ "parameters",
+ 0,
+ NULL,
+ 0,
+ 0,
+ NULL,
+ NULL },
{ NULL },
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]