[nautilus-actions/gnome-2-28] Only returns an object when selection is unique



commit af78ab96789299c80be93040560bf8533ef112c4
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Oct 14 22:03:54 2009 +0200

    Only returns an object when selection is unique

 ChangeLog                   |    3 +++
 src/nact/nact-main-window.c |   18 +++++++++++++++++-
 2 files changed, 20 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 66bde1b..4c5608b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-10-14 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-main-window.c (get_selected_object):
+	Only returns an object when selection is unique.
+
 	* src/nact/nact-imenubar.c:
 	* src/nact/nautilus-actions-config-tool.actions:
 	Remove New menu and Preferences items.
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index bf524e5..d253804 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -92,6 +92,7 @@ static void             instance_finalize( GObject *application );
 static gchar           *get_iprefs_window_id( NactWindow *window );
 static gchar           *get_toplevel_name( BaseWindow *window );
 static GSList          *get_actions( NactWindow *window );
+static NAObject        *get_selected_object( NactWindow *window );
 
 static void             on_initial_load_toplevel( BaseWindow *window );
 static void             on_runtime_init_toplevel( BaseWindow *window );
@@ -339,7 +340,7 @@ imenubar_iface_init( NactIMenubarInterface *iface )
 	iface->free_deleted_actions = free_deleted_actions;
 	iface->push_removed_action = push_removed_action;
 	iface->get_actions = get_actions;
-	iface->get_selected = nact_iactions_list_get_selected_object;
+	iface->get_selected = get_selected_object;
 	iface->setup_dialog_title = setup_dialog_title;
 	iface->update_actions_list = update_actions_list;
 	iface->select_actions_list = nact_iactions_list_set_selection;
@@ -510,6 +511,21 @@ get_actions( NactWindow *window )
 	return( NACT_MAIN_WINDOW( window )->private->actions );
 }
 
+static NAObject *
+get_selected_object( NactWindow *window )
+{
+	NAObject *object;
+	GSList *items;
+
+	object = NULL;
+	items = nact_iactions_list_get_selected_items( NACT_IACTIONS_LIST( window ));
+	if( g_slist_length( items ) == 1 ){
+		object = NA_OBJECT( items->data );
+	}
+
+	return( object );
+}
+
 /*
  * note that for this NactMainWindow, on_initial_load_toplevel and
  * on_runtime_init_toplevel are equivalent, as there is only one



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