[nautilus-actions] Do not try to select a null path



commit 2e7991d96a4f3f4efc698ea06be4fe38e657d5b2
Author: Pierre Wieser <pwieser trychlos org>
Date:   Sun Sep 27 20:51:24 2009 +0200

    Do not try to select a null path

 ChangeLog                     |    1 +
 src/nact/nact-iactions-list.c |   34 ++++++++++++++++++----------------
 2 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 145464a..2e926b0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@
 
 	* src/nact/nact-iactions-list.c (on_treeview_selection_changed):
 	Only get selected items when about to send the message.
+	Do not try to select a null path.
 
 	* src/nact/nact-main-menubar.c:
 	Now use the NactClipboard convenience object.
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index b347538..48b0246 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -1526,28 +1526,30 @@ select_row_at_path( NactIActionsList *instance, GtkTreeView *treeview, GtkTreeMo
 	selection = gtk_tree_view_get_selection( treeview );
 	gtk_tree_selection_unselect_all( selection );
 
-	g_debug( "nact_iactions_list_select_row_at_path: path=%s", gtk_tree_path_to_string( path ));
+	if( path ){
+		g_debug( "nact_iactions_list_select_row_at_path: path=%s", gtk_tree_path_to_string( path ));
 
-	if( gtk_tree_model_get_iter( model, &iter, path )){
-		gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
-		anything = TRUE;
-
-	} else if( gtk_tree_path_prev( path ) && gtk_tree_model_get_iter( model, &iter, path )){
-		gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
-		anything = TRUE;
-
-	} else {
-		gtk_tree_path_next( path );
 		if( gtk_tree_model_get_iter( model, &iter, path )){
 			gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
 			anything = TRUE;
 
-		} else if( gtk_tree_path_get_depth( path ) > 1 &&
-					gtk_tree_path_up( path ) &&
-					gtk_tree_model_get_iter( model, &iter, path )){
+		} else if( gtk_tree_path_prev( path ) && gtk_tree_model_get_iter( model, &iter, path )){
+			gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
+			anything = TRUE;
 
-						gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
-						anything = TRUE;
+		} else {
+			gtk_tree_path_next( path );
+			if( gtk_tree_model_get_iter( model, &iter, path )){
+				gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
+				anything = TRUE;
+
+			} else if( gtk_tree_path_get_depth( path ) > 1 &&
+						gtk_tree_path_up( path ) &&
+						gtk_tree_model_get_iter( model, &iter, path )){
+
+							gtk_tree_view_set_cursor( treeview, path, NULL, FALSE );
+							anything = TRUE;
+			}
 		}
 	}
 



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