[nautilus-actions] Delete the moved item before preparing to paste
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Delete the moved item before preparing to paste
- Date: Wed, 14 Oct 2009 17:32:02 +0000 (UTC)
commit 035ea0ca3b553c9e8a0c96c1f4a78519dcff6803
Author: pierre <pierre vfedora10 virtuals pwi>
Date: Wed Oct 14 18:36:42 2009 +0200
Delete the moved item before preparing to paste
ChangeLog | 1 +
src/nact/nact-tree-model.c | 14 +++++++++-----
src/runtime/na-object-item.c | 3 +++
3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index a0220b2..ae25dc6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -11,6 +11,7 @@
Also used to validate when dropping an uri.
(drop_uri_list): Check status of imported actions.
(drop_inside_move_dest): Fix when moving a subitem down.
+ (drop_inside): Delete the moved item before preparing to paste.
* src/plugin/nautilus-actions.c (instance_init):
Check status of loaded items.
diff --git a/src/nact/nact-tree-model.c b/src/nact/nact-tree-model.c
index 8a6a411..b1c4f24 100644
--- a/src/nact/nact-tree-model.c
+++ b/src/nact/nact-tree-model.c
@@ -966,6 +966,7 @@ nact_tree_model_remove( NactTreeModel *model, NAObject *object )
if( search_for_object( model, GTK_TREE_MODEL( store ), object, &iter )){
/*parents = add_parent( parents, GTK_TREE_MODEL( store ), &iter );*/
parent = na_object_get_parent( object );
+ g_debug( "%s: object=%p, parent=%p", thisfn, ( void * ) object, ( void * ) parent );
if( parent ){
na_object_remove_item( parent, object );
na_object_check_status_up( parent );
@@ -1447,6 +1448,7 @@ drop_inside( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selecti
NAObject *inserted;
GList *object_list, *it;
GtkTreeIter iter;
+ GList *deletable;
application = NACT_APPLICATION( base_window_get_application( model->private->window ));
pivot = nact_application_get_pivot( application );
@@ -1477,13 +1479,19 @@ drop_inside( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selecti
if( gtk_tree_model_get_iter( GTK_TREE_MODEL( model ), &iter, path )){
gtk_tree_model_get( GTK_TREE_MODEL( model ), &iter, IACTIONS_LIST_NAOBJECT_COLUMN, ¤t, -1 );
g_object_unref( current );
+
if( copy_data ){
inserted = na_object_duplicate( current );
na_object_reset_origin( inserted, NULL );
- na_object_prepare_for_paste( inserted, pivot, TRUE, parent );
+
} else {
inserted = na_object_ref( current );
+ deletable = g_list_prepend( NULL, inserted );
+ nact_iactions_list_delete( NACT_IACTIONS_LIST( main_window ), deletable );
+ g_list_free( deletable );
}
+
+ na_object_prepare_for_paste( inserted, pivot, copy_data, parent );
object_list = g_list_prepend( object_list, inserted );
g_debug( "%s: dropped=%s", thisfn, na_object_get_label( inserted ));
}
@@ -1492,10 +1500,6 @@ drop_inside( NactTreeModel *model, GtkTreePath *dest, GtkSelectionData *selecti
}
object_list = g_list_reverse( object_list );
- if( !copy_data ){
- nact_iactions_list_delete( NACT_IACTIONS_LIST( main_window ), object_list );
- }
-
nact_iactions_list_insert_at_path( NACT_IACTIONS_LIST( main_window ), object_list, new_dest );
if( !copy_data && gtk_tree_path_get_depth( new_dest ) == 1 ){
diff --git a/src/runtime/na-object-item.c b/src/runtime/na-object-item.c
index 45c9beb..cabc141 100644
--- a/src/runtime/na-object-item.c
+++ b/src/runtime/na-object-item.c
@@ -873,6 +873,8 @@ object_are_equal( const NAObject *a, const NAObject *b )
for( it = NA_OBJECT_ITEM( a )->private->items ; it && equal ; it = it->next ){
first_id = na_object_get_id( it->data );
second_obj = na_object_get_item( b, first_id );
+ first_pos = -1;
+ second_pos = -1;
if( second_obj ){
first_pos = g_list_position( NA_OBJECT_ITEM( a )->private->items, it );
second_list = g_list_find( NA_OBJECT_ITEM( b )->private->items, second_obj );
@@ -891,6 +893,7 @@ object_are_equal( const NAObject *a, const NAObject *b )
equal = FALSE;
/*g_debug( "first_id=%s, second not found", first_id );*/
}
+ /*g_debug( "first_id=%s first_pos=%d second_pos=%d", first_id, first_pos, second_pos );*/
g_free( first_id );
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]