[nautilus-actions] Fix wrong insertion of an action or a menu inside an action



commit 96165e649431e1f79e26a7857c23bfbd4e57e587
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Aug 1 18:14:59 2010 +0200

    Fix wrong insertion of an action or a menu inside an action

 ChangeLog                         |    3 +++
 src/nact/nact-iactions-list-bis.c |   17 ++++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1631c62..da6201d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2010-08-01 Pierre Wieser <pwieser trychlos org>
 
+	* nact/nact-iactions-list-bis.c (nact_iactions_list_bis_insert_items):
+	A new NAObjectItem must be inserted before the current NAObjectItem.
+
 	* doc/README: Define a global documentation plan.
 
 	* doc/api/Makefile.am:
diff --git a/src/nact/nact-iactions-list-bis.c b/src/nact/nact-iactions-list-bis.c
index 77945dc..3473da6 100644
--- a/src/nact/nact-iactions-list-bis.c
+++ b/src/nact/nact-iactions-list-bis.c
@@ -453,7 +453,7 @@ nact_iactions_list_bis_insert_items( NactIActionsList *instance, GList *items, N
 	GtkTreeView *treeview;
 	GtkTreeModel *model;
 	GtkTreePath *insert_path;
-	NAObject *object;
+	NAObject *object, *parent;
 
 	g_debug( "%s: instance=%p, items=%p (%d items), sibling=%p",
 			thisfn, ( void * ) instance, ( void * ) items, g_list_length( items ), ( void * ) sibling );
@@ -472,19 +472,26 @@ nact_iactions_list_bis_insert_items( NactIActionsList *instance, GList *items, N
 
 		} else {
 			insert_path = get_selection_first_path( treeview );
+			object = nact_tree_model_object_at_path( NACT_TREE_MODEL( model ), insert_path );
 
-			/* as a particular case, insert profiles _into_ current action
+			/* as a particular case, insert a new profile _into_ current action
 			 */
-			object = nact_tree_model_object_at_path( NACT_TREE_MODEL( model ), insert_path );
 			/*g_debug( "%s: object=%p (%s)", thisfn, ( void * ) object, G_OBJECT_TYPE_NAME( object ));
 			g_debug( "%s: items->data is %s", thisfn, G_OBJECT_TYPE_NAME( items->data ));*/
-			if( NA_IS_OBJECT_ACTION( object ) &&
-				NA_IS_OBJECT_PROFILE( items->data )){
+			if( NA_IS_OBJECT_ACTION( object ) && NA_IS_OBJECT_PROFILE( items->data )){
 
 				nact_iactions_list_bis_insert_into( instance, items );
 				gtk_tree_path_free( insert_path );
 				return;
 			}
+
+			/* insert a new NAObjectItem before current NAObjectItem
+			 */
+			if( NA_IS_OBJECT_PROFILE( object ) && NA_IS_OBJECT_ITEM( items->data )){
+				parent = ( NAObject * ) na_object_get_parent( object );
+				gtk_tree_path_free( insert_path );
+				insert_path = object_to_path( instance, NACT_TREE_MODEL( model ), parent );
+			}
 		}
 
 		nact_iactions_list_bis_insert_at_path( instance, items, insert_path );



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