[nautilus-actions] Give back the focus to the ActionsList after a button action



commit 7e659d324d08e1ec6a69aad3f934f4c01bd7d8e7
Author: Pierre Wieser <pwieser trychlos org>
Date:   Wed Jul 1 01:40:07 2009 +0200

    Give back the focus to the ActionsList after a button action

 ChangeLog                           |   10 ++++++++++
 src/nact/nact-iactions-list.c       |   10 ++++++++++
 src/nact/nact-iactions-list.h       |    1 +
 src/nact/nact-main-window.c         |   17 ++++++++++++-----
 src/nact/nautilus-actions-config.ui |    4 ++--
 5 files changed, 35 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 21b7ee8..41dc49d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2009-07-01 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-iactions-list.c:
+	* src/nact/nact-iactions-list.h
+	(nact_iactions_list_set_focus): New function.
+
 	* src/nact/nact-iprefs.c:
 	* src/nact/nact-iprefs.h
 	(nact_iprefs_get_iprofile_conditions_folder_uri,
@@ -9,6 +13,12 @@
 	Fix display of icon for new actions.
 	Save state and position of LegendDialog and GtkFileChooser.
 
+	* src/nact/nact-main-window.c:
+	Reset the focus to the ActionsList after each button click.
+
+	* src/nact/nautilus-actions-config.ui:
+	Add keyboard shortcuts to ActionsDialog buttons.
+
 2009-06-30 Pierre Wieser <pwieser trychlos org>
 
 	* src/common/na-action-profile.c:
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 8b3fcf7..4feb530 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -181,6 +181,16 @@ nact_iactions_list_fill( NactWindow *window )
 }
 
 /**
+ * Reset the focus on the ActionsList listbox.
+ */
+void
+nact_iactions_list_set_focus( NactWindow *window )
+{
+	GtkWidget *list = get_actions_list_widget( window );
+	gtk_widget_grab_focus( list );
+}
+
+/**
  * Returns the currently selected action.
  */
 GObject *
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index b7a5b73..06dd60a 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -74,6 +74,7 @@ void     nact_iactions_list_initial_load( NactWindow *window );
 void     nact_iactions_list_runtime_init( NactWindow *window );
 void     nact_iactions_list_fill( NactWindow *window );
 GObject *nact_iactions_list_get_selected_action( NactWindow *window );
+void     nact_iactions_list_set_focus( NactWindow *window );
 
 G_END_DECLS
 
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 4272690..eb10082 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -400,7 +400,7 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
 	g_free( license_i18n );
 	g_free( icon_name );
 
-	/* TODO: reset focus to actions list */
+	nact_iactions_list_set_focus( NACT_WINDOW( wndmain ));
 }
 
 /*
@@ -422,7 +422,8 @@ on_add_button_clicked( GtkButton *button, gpointer user_data )
 	nact_action_conditions_editor_run_editor( wndmain, NULL );
 
 	/* TODO: set the selection to the newly created action
-	 * or restore the previous selection - set focus to actions list */
+	 * or restore the previous selection */
+	nact_iactions_list_set_focus( wndmain );
 }
 
 /*
@@ -463,6 +464,7 @@ on_edit_button_clicked( GtkButton *button, gpointer user_data )
 
 	/* TODO: reset the selection to the edited action
 	 * set focus to actions list */
+	nact_iactions_list_set_focus( wndmain );
 }
 
 static void
@@ -500,8 +502,8 @@ on_duplicate_button_clicked( GtkButton *button, gpointer user_data )
 		g_assert_not_reached();
 	}
 
-	/* TODO: set the selection to the newly created action
-	 * set focus to actions list */
+	/* TODO: set the selection to the newly created action */
+	nact_iactions_list_set_focus( wndmain );
 }
 
 static void
@@ -537,7 +539,8 @@ on_delete_button_clicked( GtkButton *button, gpointer user_data )
 		g_assert_not_reached();
 	}
 	/* TODO: set the selection to the previous action if any
-	 * or to the next one - set focus to actions list */
+	 * or to the next one */
+	nact_iactions_list_set_focus( wndmain );
 }
 
 static void
@@ -546,6 +549,9 @@ on_import_export_button_clicked( GtkButton *button, gpointer user_data )
 	static const gchar *thisfn = "nact_main_window_on_import_export_button_clicked";
 	g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
 
+	g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+	NactWindow *wndmain = NACT_WINDOW( user_data );
+
 	/*GtkWidget *nact_actions_list;
 
 	if (nact_import_export_actions ())
@@ -553,6 +559,7 @@ on_import_export_button_clicked( GtkButton *button, gpointer user_data )
 		nact_actions_list = nact_get_glade_widget ("ActionsList");
 		fill_actions_list (nact_actions_list);
 	}*/
+	nact_iactions_list_set_focus( wndmain );
 }
 
 static gboolean
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index 5d6b747..e3a0bc8 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -105,7 +105,7 @@
                             <child>
                               <object class="GtkLabel" id="label141">
                                 <property name="visible">True</property>
-                                <property name="label" translatable="yes">Duplicate</property>
+                                <property name="label" translatable="yes">D_uplicate</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>
@@ -173,7 +173,7 @@
                             <child>
                               <object class="GtkLabel" id="label140">
                                 <property name="visible">True</property>
-                                <property name="label" translatable="yes">Import/Export</property>
+                                <property name="label" translatable="yes">_Import/Export</property>
                                 <property name="use_underline">True</property>
                               </object>
                               <packing>



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