[nautilus-actions] Update data definitions to handle command-line arguments



commit 1425359f814a9d4f66d35841706cad57e3e6ddc7
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Mar 15 05:45:41 2010 +0100

    Update data definitions to handle command-line arguments

 ChangeLog                            |    9 ++++
 src/core/na-icontextual-factory.c    |   78 ++++++++++++++++++----------------
 src/core/na-object-action-factory.c  |   25 ++++++-----
 src/core/na-object-item-factory.c    |   37 ++++++++--------
 src/core/na-object-profile-factory.c |   16 ++++----
 src/utils/nautilus-actions-new.c     |   32 +++++++-------
 6 files changed, 107 insertions(+), 90 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index dfc2772..385d29a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2009-03-15 Pierre Wieser <pwieser trychlos org>
+
+	* src/core/na-icontextual-factory.c:
+	* src/core/na-object-action-factory.c:
+	* src/core/na-object-item-factory.c:
+	* src/core/na-object-profile-factory.c:
+	* src/utils/nautilus-actions-new.c:
+	Update data definitions to handle command-line arguments.
+
 2009-03-10 Pierre Wieser <pwieser trychlos org>
 
 	* src/utils/nautilus-actions-new.c:
diff --git a/src/core/na-icontextual-factory.c b/src/core/na-icontextual-factory.c
index 1e4531b..c67a8be 100644
--- a/src/core/na-icontextual-factory.c
+++ b/src/core/na-icontextual-factory.c
@@ -44,7 +44,7 @@ NADataDef data_def_conditions [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "List of pattern to match the selected file(s)/folder(s)" ),
+				N_( "List of patterns to be matched against the selected file(s)/folder(s)" ),
 				N_( "A list of strings with joker '*' or '?' to be matched against the name(s) " \
 					"of the selected file(s)/folder(s). Each selected items must match at least " \
 					"one of the filename patterns for the action or the menu be candidate to " \
@@ -58,18 +58,20 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"basenames",
+				'b',
+				"basename",
 				0,
-				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				G_OPTION_ARG_STRING_ARRAY,
+				N_( "A pattern to be matched against basenames of selected file(s)/folder(s). " \
+					"May include wildcards (* or ?). " \
+					"You must set one option for each pattern you need" ),
+				N_( "<EXPR>" ) },
 
 	{ NAFO_DATA_MATCHCASE,
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Whether the specified basenames are case sensitive" ),
+				N_( "Whether the specified basenames are case sensitive (default)" ),
 				N_( "Must be set to 'true' if the filename patterns are case sensitive, to 'false' " \
 					"otherwise. E.g., if you need to match a filename in a case-sensitive manner, " \
 					"set this key to 'true'. If you also want, for example '*.jpg' to match 'photo.JPG', " \
@@ -83,10 +85,10 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"matchcase",
+				'c',
+				"case",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -94,7 +96,7 @@ NADataDef data_def_conditions [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "List of patterns to match the mimetypes of the selected file(s)/folder(s)" ),
+				N_( "List of patterns to be matched against the mimetypes of the selected file(s)/folder(s)" ),
 				N_( "A list of strings with joker '*' to be matched against the mimetypes of the " \
 					"selected file(s)/folder(s). Each selected items must match at least one of " \
 					"the mimetype patterns for the action to appear.\n" \
@@ -107,12 +109,14 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"mimetypes",
+				'm',
+				"mimetype",
 				0,
-				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				G_OPTION_ARG_STRING_ARRAY,
+				N_( "A pattern to be matched against mimetypes of selected file(s)/folder(s). " \
+					"May include wildcards (* or ?). " \
+					"You must set one option for each pattern you need" ),
+				N_( "<EXPR>" ) },
 
 	{ NAFO_DATA_ISFILE,
 				TRUE,
@@ -135,10 +139,10 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"isfile",
+				'f',
+				"accept-files",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -163,10 +167,10 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"isdir",
+				'd',
+				"accept-dirs",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -186,10 +190,10 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"accept-multiple-files",
+				'u',
+				"accept-multiple",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -197,7 +201,7 @@ NADataDef data_def_conditions [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "List of schemes" ),
+				N_( "List of schemes to be matched against those of selected file(s)/folder(s)" ),
 										/* too long string for iso c: 510 (max=509) */
 				N_( "Defines the list of valid schemes to be matched against the selected " \
 					"items. The scheme is the protocol used to access the files. The " \
@@ -221,12 +225,13 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"schemes",
+				's',
+				"scheme",
 				0,
-				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				G_OPTION_ARG_STRING,
+				N_( "A valid GIO scheme where the selected file(s)/folder(s) should be located. " \
+					"You must set one option for each scheme you need" ),
+				N_( "<STRING>" ) },
 
 	{ NAFO_DATA_FOLDERS,
 				TRUE,
@@ -244,12 +249,13 @@ NADataDef data_def_conditions [] = {
 				FALSE,
 				FALSE,
 				"folders",
+				'd',
+				"folder",
 				0,
-				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				G_OPTION_ARG_STRING,
+				N_( "The path of a directory for which folders or toolbar action will be displayed. " \
+					"You must set one option for each folder you need" ),
+				N_( "<PATH>" ) },
 
 	{ NULL },
 };
diff --git a/src/core/na-object-action-factory.c b/src/core/na-object-action-factory.c
index 3cd9954..08a9bb4 100644
--- a/src/core/na-object-action-factory.c
+++ b/src/core/na-object-action-factory.c
@@ -68,10 +68,11 @@ static NADataDef data_def_action [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Targets the context menu" ),
+				N_( "Targets the context menu (default)" ),
 				N_( "Whether the action of the menu targets the selection file manager " \
 					"context menus.\n" \
-					"This used to be the historical behavior."),
+					"This used to be the historical behavior.\n" \
+					"Defaults to TRUE." ),
 				NAFD_TYPE_BOOLEAN,
 				"true",
 				TRUE,
@@ -79,10 +80,10 @@ static NADataDef data_def_action [] = {
 				FALSE,
 				FALSE,
 				"target-selection",
+				'c',
+				"context",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -129,10 +130,10 @@ static NADataDef data_def_action [] = {
 				FALSE,
 				FALSE,
 				"target-toolbar",
+				'o',
+				"toolbar",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
@@ -151,12 +152,12 @@ static NADataDef data_def_action [] = {
 				FALSE,
 				TRUE,
 				"toolbar-label",
+				'L',
+				"toolbar-label",
 				0,
+				G_OPTION_ARG_STRING,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<STRING>" ) },
 
 	/* 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
diff --git a/src/core/na-object-item-factory.c b/src/core/na-object-item-factory.c
index 9313aa2..488f9ab 100644
--- a/src/core/na-object-item-factory.c
+++ b/src/core/na-object-item-factory.c
@@ -75,7 +75,7 @@ NADataDef data_def_item [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Label of the context menu item" ),
+				N_( "Label of the context menu item (mandatory)" ),
 				N_( "The label of the menu item that will appear in the file manager context " \
 					"menu when the selection matches the appearance condition settings.\n" \
 					"It is also used as a default for the toolbar label of an action." ),
@@ -86,12 +86,12 @@ NADataDef data_def_item [] = {
 				FALSE,
 				TRUE,
 				"label",
+				'l',
+				"label",
 				0,
+				G_OPTION_ARG_STRING,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<STRING>" ) },
 
 	{ NAFO_DATA_TOOLTIP,
 				TRUE,
@@ -108,12 +108,12 @@ NADataDef data_def_item [] = {
 				FALSE,
 				TRUE,
 				"tooltip",
+				't',
+				"tooltip",
 				0,
+				G_OPTION_ARG_STRING,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<STRING>" ) },
 
 	{ NAFO_DATA_ICON,
 				TRUE,
@@ -131,12 +131,12 @@ NADataDef data_def_item [] = {
 				FALSE,
 				TRUE,
 				"icon",
+				'i',
+				"icon",
 				0,
+				G_OPTION_ARG_STRING,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<PATH|NAME>" ) },
 
 	{ NAFO_DATA_DESCRIPTION,
 				TRUE,
@@ -211,9 +211,10 @@ NADataDef data_def_item [] = {
 				TRUE,
 				TRUE,
 				TRUE,
-				N_( "Whether the action or the menu is enabled" ),
+				N_( "Whether the action or the menu is enabled (default)" ),
 				N_( "If the or the menu action is disabled, it will never appear in the " \
-					"file manager context menu." ),
+					"file manager context menu.\n" \
+					"Defaults to TRUE." ),
 				NAFD_TYPE_BOOLEAN,
 				"true",
 				TRUE,
@@ -221,10 +222,10 @@ NADataDef data_def_item [] = {
 				FALSE,
 				FALSE,
 				"enabled",
+				'e',
+				"enabled",
 				0,
-				NULL,
-				0,
-				0,
+				G_OPTION_ARG_NONE,
 				NULL,
 				NULL },
 
diff --git a/src/core/na-object-profile-factory.c b/src/core/na-object-profile-factory.c
index 137e672..2932118 100644
--- a/src/core/na-object-profile-factory.c
+++ b/src/core/na-object-profile-factory.c
@@ -78,12 +78,12 @@ static NADataDef data_def_profile [] = {
 				TRUE,
 				FALSE,
 				"path",
+				'c',
+				"command",
 				0,
+				G_OPTION_ARG_FILENAME,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<PATH>" ) },
 
 	{ NAFO_DATA_PARAMETERS,
 				TRUE,
@@ -113,12 +113,12 @@ static NADataDef data_def_profile [] = {
 				FALSE,
 				FALSE,
 				"parameters",
+				'p',
+				"parameters",
 				0,
+				G_OPTION_ARG_STRING,
 				NULL,
-				0,
-				0,
-				NULL,
-				NULL },
+				N_( "<STRING>" ) },
 
 	{ NULL },
 };
diff --git a/src/utils/nautilus-actions-new.c b/src/utils/nautilus-actions-new.c
index 9547502..8e62f5e 100644
--- a/src/utils/nautilus-actions-new.c
+++ b/src/utils/nautilus-actions-new.c
@@ -76,23 +76,23 @@ static gboolean   output_gconf     = FALSE;
 static gboolean   version          = FALSE;
 
 static const ArgFromDataDef st_arg_from_data_def[] = {
-		{ NAFO_DATA_LABEL, &label },
-		{ NAFO_DATA_TOOLTIP, &tooltip },
-		{ NAFO_DATA_ICON, &icon },
-		{ NAFO_DATA_ENABLED, &enabled },
+		{ NAFO_DATA_LABEL,            &label },
+		{ NAFO_DATA_TOOLTIP,          &tooltip },
+		{ NAFO_DATA_ICON,             &icon },
+		{ NAFO_DATA_ENABLED,          &enabled },
 		{ NAFO_DATA_TARGET_SELECTION, &target_selection },
-		{ NAFO_DATA_TARGET_TOOLBAR, &target_toolbar },
-		{ NAFO_DATA_TOOLBAR_LABEL, &label_toolbar },
-		{ NAFO_DATA_PATH, &command },
-		{ NAFO_DATA_PARAMETERS, &parameters },
-		{ NAFO_DATA_BASENAMES, &basenames_array },
-		{ NAFO_DATA_MATCHCASE, &matchcase },
-		{ NAFO_DATA_MIMETYPES, &mimetypes_array },
-		{ NAFO_DATA_ISFILE, &isfile },
-		{ NAFO_DATA_ISDIR, &isdir },
-		{ NAFO_DATA_MULTIPLE, &accept_multiple },
-		{ NAFO_DATA_SCHEMES, &schemes_array },
-		{ NAFO_DATA_FOLDERS, &folders_array },
+		{ NAFO_DATA_TARGET_TOOLBAR,   &target_toolbar },
+		{ NAFO_DATA_TOOLBAR_LABEL,    &label_toolbar },
+		{ NAFO_DATA_PATH,             &command },
+		{ NAFO_DATA_PARAMETERS,       &parameters },
+		{ NAFO_DATA_BASENAMES,        &basenames_array },
+		{ NAFO_DATA_MATCHCASE,        &matchcase },
+		{ NAFO_DATA_MIMETYPES,        &mimetypes_array },
+		{ NAFO_DATA_ISFILE,           &isfile },
+		{ NAFO_DATA_ISDIR,            &isdir },
+		{ NAFO_DATA_MULTIPLE,         &accept_multiple },
+		{ NAFO_DATA_SCHEMES,          &schemes_array },
+		{ NAFO_DATA_FOLDERS,          &folders_array },
 		{ NULL }
 };
 



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