Index: libnautilus-actions/nautilus-actions-config-gconf.c
===================================================================
--- libnautilus-actions/nautilus-actions-config-gconf.c	(révision 497)
+++ libnautilus-actions/nautilus-actions-config-gconf.c	(copie de travail)
@@ -166,6 +166,12 @@
 	nautilus_actions_config_action_set_label (action, stmp);
 	g_free (stmp);
 
+	stmp = get_action_string_value (config->conf_client, gconf_action_dir, ACTION_PARENT_ENTRY);
+	if (stmp){
+		nautilus_actions_config_action_set_parent(action,stmp);
+	}
+	g_free (stmp);
+	
 	nautilus_actions_config_action_set_uuid (action, uuid);
 
 	stmp = get_action_string_value (config->conf_client, gconf_action_dir, ACTION_TOOLTIP_ENTRY);
Index: libnautilus-actions/nautilus-actions-config-schema-reader.c
===================================================================
--- libnautilus-actions/nautilus-actions-config-schema-reader.c	(révision 497)
+++ libnautilus-actions/nautilus-actions-config-schema-reader.c	(copie de travail)
@@ -33,6 +33,7 @@
 
 typedef enum {
 	ACTION_NONE_TYPE = 0,
+	ACTION_PARENT_TYPE,
 	ACTION_LABEL_TYPE,
 	ACTION_TOOLTIP_TYPE,
 	ACTION_ICON_TYPE,
@@ -380,6 +381,10 @@
 			{
 				*type = ACTION_LABEL_TYPE;
 			}
+			else if (g_str_has_suffix (text, ACTION_PARENT_ENTRY))
+			{
+				*type = ACTION_PARENT_TYPE;
+			}
 			else if (g_str_has_suffix (text, ACTION_TOOLTIP_ENTRY))
 			{
 				*type = ACTION_TOOLTIP_TYPE;
@@ -530,6 +535,7 @@
 	xmlNode* iter;
 	gboolean retv = FALSE;
 	gboolean is_label_ok = FALSE;
+	gboolean is_parent_ok = FALSE;
 	gboolean is_tooltip_ok = FALSE;
 	gboolean is_icon_ok = FALSE;
 	gboolean is_profiles_ok = FALSE;
@@ -581,6 +587,10 @@
 							is_label_ok = TRUE;
 							nautilus_actions_config_action_set_label (action, value);
 							break;
+						case ACTION_PARENT_TYPE:
+							is_parent_ok = TRUE;
+							nautilus_actions_config_action_set_parent(action, value);
+							break;
 						case ACTION_TOOLTIP_TYPE:
 							is_tooltip_ok = TRUE;
 							nautilus_actions_config_action_set_tooltip (action, value);
Index: libnautilus-actions/nautilus-actions-config.c
===================================================================
--- libnautilus-actions/nautilus-actions-config.c	(révision 497)
+++ libnautilus-actions/nautilus-actions-config.c	(copie de travail)
@@ -546,6 +546,8 @@
 	//--> Set some good default values
 	new_action->conf_section = g_strdup ("");
 	new_action->uuid = get_new_uuid ();
+	// default is no parent
+	new_action->parent = NULL;
 	new_action->label = g_strdup ("");
 	new_action->tooltip = g_strdup ("");
 	new_action->icon = g_strdup ("");
@@ -577,6 +579,16 @@
 }
 
 void
+nautilus_actions_config_action_set_parent (NautilusActionsConfigAction *action, const gchar *parent)
+{
+	g_return_if_fail (action != NULL);
+
+	if (action->parent)
+		g_free (action->parent);
+	action->parent = g_strdup (parent);
+}
+
+void
 nautilus_actions_config_action_set_label (NautilusActionsConfigAction *action, const gchar *label)
 {
 	g_return_if_fail (action != NULL);
@@ -838,7 +850,11 @@
 		{
 			success = FALSE;
 		}
-
+		
+		if (success && action->parent) {
+			new_action->parent = g_strdup (action->parent);
+		} // parent is optional so we don't fail if it's not set
+		
 		if (action->label && success) {
 			new_action->label = g_strdup (action->label);
 		}
@@ -921,6 +937,11 @@
 			action->uuid = NULL;
 		}
 
+		if (action->parent) {
+			g_free (action->parent);
+			action->parent = NULL;
+		}
+		
 		if (action->label) {
 			g_free (action->label);
 			action->label = NULL;
Index: libnautilus-actions/nautilus-actions-config-gconf-writer.c
===================================================================
--- libnautilus-actions/nautilus-actions-config-gconf-writer.c	(révision 497)
+++ libnautilus-actions/nautilus-actions-config-gconf-writer.c	(copie de travail)
@@ -73,6 +73,10 @@
 	action->version = g_strdup (NAUTILUS_ACTIONS_CONFIG_VERSION);
 
 	/* set the values in the config database */
+	key = g_strdup_printf ("%s/%s", action->conf_section, ACTION_PARENT_ENTRY);
+	gconf_client_set_string (config->conf_client, key, action->parent, NULL);
+	g_free (key);
+
 	key = g_strdup_printf ("%s/%s", action->conf_section, ACTION_LABEL_ENTRY);
 	gconf_client_set_string (config->conf_client, key, action->label, NULL);
 	g_free (key);
Index: libnautilus-actions/nautilus-actions-config.h
===================================================================
--- libnautilus-actions/nautilus-actions-config.h	(révision 497)
+++ libnautilus-actions/nautilus-actions-config.h	(copie de travail)
@@ -70,6 +70,9 @@
 
 typedef struct {
 	gchar *conf_section;
+	/* Bug 325528 : The parent entry is optional. If set, a "parent" menu entry will be created in the root menu 
+	 * and the action will be append to it */
+	gchar *parent; 
 	gchar *uuid;
 	gchar *label;
 	gchar *tooltip;
@@ -147,6 +150,9 @@
 
 void                         nautilus_actions_config_action_set_uuid (NautilusActionsConfigAction *action,
 								       const gchar *uuid);
+/* Bug 325528 : Add a parent entry in an action for using nautilus submenu */
+void                         nautilus_actions_config_action_set_parent (NautilusActionsConfigAction *action,
+								       const gchar *parent);
 void                         nautilus_actions_config_action_set_label (NautilusActionsConfigAction *action,
 								       const gchar *label);
 void                         nautilus_actions_config_action_set_tooltip (NautilusActionsConfigAction *action,
Index: libnautilus-actions/nautilus-actions-config-gconf-private.h
===================================================================
--- libnautilus-actions/nautilus-actions-config-gconf-private.h	(révision 497)
+++ libnautilus-actions/nautilus-actions-config-gconf-private.h	(copie de travail)
@@ -52,6 +52,7 @@
 
 // GConf key names :
 #define ACTION_LABEL_ENTRY     		"label"
+#define ACTION_PARENT_ENTRY     	"parent"
 #define ACTION_TOOLTIP_ENTRY   		"tooltip"
 #define ACTION_ICON_ENTRY      		"icon"
 #define ACTION_PROFILE_DESC_NAME_ENTRY	"desc-name"
@@ -71,6 +72,8 @@
 
 #define ACTION_LABEL_DESC_SHORT		_("The label of the menu item")
 #define ACTION_LABEL_DESC_LONG		_("The label of the menu item that will appear in the Nautilus popup menu when the selection matches the appearance condition settings")
+#define ACTION_PARENT_DESC_SHORT	_("The parent menu of the menu item")
+#define ACTION_PARENT_DESC_LONG		_("The parent menu of the menu item that will prepend the Nautilus popup menu when the selection matches the appearance condition settings")
 #define ACTION_TOOLTIP_DESC_SHORT	_("The tooltip of the menu item")
 #define ACTION_TOOLTIP_DESC_LONG		_("The tooltip of the menu item that will appear in the Nautilus statusbar when the user points to the Nautilus popup menu item with his/her mouse")
 #define ACTION_ICON_DESC_SHORT	_("The icon of the menu item")
Index: libnautilus-actions/nautilus-actions-config-schema-writer.c
===================================================================
--- libnautilus-actions/nautilus-actions-config-schema-writer.c	(révision 497)
+++ libnautilus-actions/nautilus-actions-config-schema-writer.c	(copie de travail)
@@ -197,6 +197,11 @@
 	list_node = xmlNewChild (root_node, NULL, BAD_CAST NA_GCONF_XML_SCHEMA_LIST, NULL);
 
 	//--> Menu item entries : label
+	content = BAD_CAST g_build_path ("/", ACTIONS_CONFIG_DIR, action->uuid, ACTION_PARENT_ENTRY, NULL);
+	create_schema_entry (doc, list_node, content, "string", action->parent, ACTION_PARENT_DESC_SHORT, ACTION_PARENT_DESC_LONG, TRUE);
+	xmlFree (content);
+	
+	//--> Menu item entries : label
 	content = BAD_CAST g_build_path ("/", ACTIONS_CONFIG_DIR, action->uuid, ACTION_LABEL_ENTRY, NULL);
 	create_schema_entry (doc, list_node, content, "string", action->label, ACTION_LABEL_DESC_SHORT, ACTION_LABEL_DESC_LONG, TRUE);
 	xmlFree (content);
Index: plugin/nautilus-actions.c
===================================================================
--- plugin/nautilus-actions.c	(révision 497)
+++ plugin/nautilus-actions.c	(copie de travail)
@@ -29,6 +29,8 @@
 #include <libnautilus-extension/nautilus-extension-types.h>
 #include <libnautilus-extension/nautilus-file-info.h>
 #include <libnautilus-extension/nautilus-menu-provider.h>
+#include <libnautilus-extension/nautilus-menu.h>
+#include <libnautilus-extension/nautilus-menu-item.h>
 #include "nautilus-actions.h"
 #include <libnautilus-actions/nautilus-actions-config.h>
 #include <libnautilus-actions/nautilus-actions-config-gconf-reader.h>
@@ -92,10 +94,14 @@
 	return icon_name;
 }
 
-static NautilusMenuItem *nautilus_actions_create_menu_item (NautilusActionsConfigAction *action, GList *files, NautilusActionsConfigActionProfile* action_profile)
+static NautilusMenuItem *nautilus_actions_create_menu_item (NautilusActionsConfigAction *action, GList *files, NautilusActionsConfigActionProfile* action_profile, GList *parentMenuList)
 {
+	NautilusMenu *menu;
 	NautilusMenuItem *item;
+	NautilusMenuItem *parent;
+	GList *iter;
 	gchar* name;
+	gboolean pfound;
 	const gchar* icon_name = get_verified_icon_name (g_strstrip (action->icon));
 	NautilusActionsConfigActionProfile* action_profile4menu = nautilus_actions_config_action_profile_dup (action_profile);
 
@@ -118,9 +124,44 @@
 			nautilus_file_info_list_copy (files),
 			(GDestroyNotify) nautilus_file_info_list_free);
 	
-	
 	g_free (name);
 	
+	/* Check if action has a parent :
+	 * - if yes, checks if the parentMenu already exist and append to it
+	 * - if no, do nothing
+	 */
+	if (action->parent){
+		pfound = FALSE;
+		for (iter = g_list_first(parentMenuList);iter; iter=iter->next ){
+			parent = iter->data;
+			if (g_strcasecmp(parent->details->label,action->parent) == 0){
+				pfound = TRUE;
+				break;
+			}
+		}
+		
+		if (!pfound){
+			parent = nautilus_menu_item_new(action->parent,action->parent,action->parent,NULL);
+			/* Parent submenu */
+			menu = nautilus_menu_new ();
+			nautilus_menu_item_set_submenu (parent, menu);
+			g_list_append(parentMenuList,parent);
+		}
+		
+		// get parent submenu
+		menu = parent->details->menu;
+		// menu shouldn't be NULL, if yes create it
+		if (!menu){
+			menu = nautilus_menu_new ();
+			nautilus_menu_item_set_submenu (parent, menu);
+		}
+		
+		// append the item
+		nautilus_menu_append_item (menu, item);
+		
+		item = parent;
+	}
+	
 	return item;
 }
 
@@ -132,6 +173,7 @@
 static GList *nautilus_actions_get_file_items (NautilusMenuProvider *provider, GtkWidget *window, GList *files)
 {
 	GList *items = NULL;
+	GList *parentMenuList = NULL;
 	GSList *iter;
 	NautilusMenuItem *item;
 	NautilusActions* self = NAUTILUS_ACTIONS (provider);
@@ -161,7 +203,7 @@
 
 				if (nautilus_actions_test_validate (action_profile, files))
 				{
-					item = nautilus_actions_create_menu_item (action, files, action_profile);
+					item = nautilus_actions_create_menu_item (action, files, action_profile, parentMenuList);
 					items = g_list_append (items, item);
 					found = TRUE;
 				}
Index: plugin/nautilus-actions.h
===================================================================
--- plugin/nautilus-actions.h	(révision 497)
+++ plugin/nautilus-actions.h	(copie de travail)
@@ -52,6 +52,9 @@
 	GObjectClass __parent;
 };
 
+/*TODO : open BUG to nautilus-extension , this struct is defined in libnautilus-extension/nautilus-menu.c
+ * but should have been in the header */
+
 GType nautilus_actions_get_type (void);
 void nautilus_actions_register_type (GTypeModule *module);
 
