[nautilus-actions] No more try to set focus on first entry when switching between tabs



commit eb3409f582995fa19232b2a37eda3cc49e74709f
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Aug 18 21:43:00 2009 +0200

    No more try to set focus on first entry when switching between tabs
    
    See the Gtk+ mailing-list: it is a wanted behavior that focus stays on the tab label,
    so that left and right arrows can be used to easily change the current page.

 ChangeLog                       |   14 ++++++++++++
 src/nact/nact-iaction-tab.c     |   44 ---------------------------------------
 src/nact/nact-iaction-tab.h     |    1 -
 src/nact/nact-iadvanced-tab.c   |    6 -----
 src/nact/nact-iadvanced-tab.h   |    1 -
 src/nact/nact-icommand-tab.c    |   29 -------------------------
 src/nact/nact-icommand-tab.h    |    1 -
 src/nact/nact-iconditions-tab.c |   29 -------------------------
 src/nact/nact-iconditions-tab.h |    1 -
 src/nact/nact-main-window.c     |    5 ----
 10 files changed, 14 insertions(+), 117 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index c5b571e..c864b5e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,20 @@
 
 	* src/nact/nact-xml-reader.c: Add nact-main-window.h header.
 
+	* src/nact/nact-iaction-tab.c:
+	* src/nact/nact-iaction-tab.h:
+	* src/nact/nact-iadvanced-tab.c:
+	* src/nact/nact-iadvanced-tab.h:
+	* src/nact/nact-icommand-tab.c:
+	* src/nact/nact-icommand-tab.h:
+	* src/nact/nact-iconditions-tab.c:
+	* src/nact/nact-iconditions-tab.h:
+	Remove nact_ixxxx_tab_reset_last_focus function.
+	Remove focus-in-event and switch-page signal connections.
+
+	* src/nact/nact-main-window.c:
+	No more call nact_ixxxx_tab_reset_last_focus functions.
+
 2009-08-11 Pierre Wieser <pwieser trychlos org>
 
 	* src/nact/nact-icommand-tab.c:
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index aaa4e99..d8637c9 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -84,8 +84,6 @@ static void          hide_status( NactWindow *window );
 static guint         get_status_context( NactWindow *window );
 static void          set_status_context( NactWindow *window, guint context );
 
-static void          on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window );
-static gboolean      on_focus_in( GtkWidget *widget, GdkEventFocus *event, NactWindow *window );
 GType
 nact_iaction_tab_get_type( void )
 {
@@ -180,20 +178,14 @@ nact_iaction_tab_runtime_init( NactWindow *dialog )
 	static const gchar *thisfn = "nact_iaction_tab_runtime_init";
 	g_debug( "%s: dialog=%p", thisfn, dialog );
 
-	GtkWidget *notebook = base_window_get_widget( BASE_WINDOW( dialog ), "MainNotebook" );
-	nact_window_signal_connect( dialog, G_OBJECT( notebook ), "switch-page", G_CALLBACK( on_switch_page ));
-
 	GtkWidget *label_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionLabelEntry" );
 	nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "changed", G_CALLBACK( on_label_changed ));
-	nact_window_signal_connect( dialog, G_OBJECT( label_widget ), "focus-in-event", G_CALLBACK( on_focus_in ));
 
 	GtkWidget *tooltip_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionTooltipEntry" );
 	nact_window_signal_connect( dialog, G_OBJECT( tooltip_widget ), "changed", G_CALLBACK( on_tooltip_changed ));
-	nact_window_signal_connect( dialog, G_OBJECT( tooltip_widget ), "focus-in-event", G_CALLBACK( on_focus_in ));
 
 	GtkWidget *icon_widget = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconComboBoxEntry" );
 	nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "changed", G_CALLBACK( on_icon_changed ));
-	nact_window_signal_connect( dialog, G_OBJECT( GTK_BIN( icon_widget )->child ), "focus-in-event", G_CALLBACK( on_focus_in ));
 
 	GtkWidget *button = base_window_get_widget( BASE_WINDOW( dialog ), "ActionIconBrowseButton" );
 	nact_window_signal_connect( dialog, G_OBJECT( button ), "clicked", G_CALLBACK( on_icon_browse ));
@@ -219,12 +211,6 @@ nact_iaction_tab_dispose( NactWindow *dialog )
 	g_debug( "%s: dialog=%p", thisfn, dialog );
 }
 
-void
-nact_iaction_tab_reset_last_focus( NactWindow *dialog )
-{
-	g_object_set_data( G_OBJECT( dialog ), "nact-iaction-tab-last-focus", NULL );
-}
-
 /*
  * disable the tab if current row is a profile and the action has more
  * than one profile
@@ -646,33 +632,3 @@ set_status_context( NactWindow *window, guint context )
 {
 	g_object_set_data( G_OBJECT( window ), PROP_IACTION_TAB_STATUS_CONTEXT, GUINT_TO_POINTER( context ));
 }
-
-/*
- * this callback is triggered once when we enter the page (page_num = 0..n)
- * all tabs which are connected to this signal are triggered with same parameters
- * at runtime initialization, we are not triggered when page 0 is displayed
- * (or we are connecting too late ?)
- */
-static void
-on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window )
-{
-	static const gchar *thisfn = "nact_iaction_tab_on_switch_page";
-
-	if( page_num == ACTION_TAB ){
-		g_debug( "%s: notebook=%p, page=%p, page_num=%d, window=%p", thisfn, notebook, page, page_num, window );
-		GtkWidget *widget = GTK_WIDGET( g_object_get_data( G_OBJECT( window ), "nact-iaction-tab-last-focus" ));
-		if( !widget ){
-			widget = base_window_get_widget( BASE_WINDOW( window ), "ActionLabelEntry" );
-		}
-		gtk_widget_grab_focus( widget );
-	}
-}
-
-static gboolean
-on_focus_in( GtkWidget *widget, GdkEventFocus *event, NactWindow *window )
-{
-	g_object_set_data( G_OBJECT( window ), "nact-iaction-tab-last-focus", widget );
-	gtk_label_set_mnemonic_widget( GTK_LABEL( base_window_get_widget( BASE_WINDOW( window ), "ActionTabLabel" )), widget );
-
-	return( FALSE );
-}
diff --git a/src/nact/nact-iaction-tab.h b/src/nact/nact-iaction-tab.h
index cfc5483..4939879 100644
--- a/src/nact/nact-iaction-tab.h
+++ b/src/nact/nact-iaction-tab.h
@@ -68,7 +68,6 @@ void     nact_iaction_tab_initial_load( NactWindow *dialog );
 void     nact_iaction_tab_runtime_init( NactWindow *dialog );
 void     nact_iaction_tab_all_widgets_showed( NactWindow *dialog );
 void     nact_iaction_tab_dispose( NactWindow *dialog );
-void     nact_iaction_tab_reset_last_focus( NactWindow *dialog );
 
 void     nact_iaction_tab_set_action( NactWindow *dialog, const NAAction *action );
 gboolean nact_iaction_tab_has_label( NactWindow *window );
diff --git a/src/nact/nact-iadvanced-tab.c b/src/nact/nact-iadvanced-tab.c
index 9fc20d7..6797353 100644
--- a/src/nact/nact-iadvanced-tab.c
+++ b/src/nact/nact-iadvanced-tab.c
@@ -206,12 +206,6 @@ nact_iadvanced_tab_dispose( NactWindow *dialog )
 }
 
 void
-nact_iadvanced_tab_reset_last_focus( NactWindow *dialog )
-{
-	g_object_set_data( G_OBJECT( dialog ), "nact-iadvanced-tab-last-focus", NULL );
-}
-
-void
 nact_iadvanced_tab_set_profile( NactWindow *dialog, NAActionProfile *profile )
 {
 	static const gchar *thisfn = "nact_iadvanced_tab_set_profile";
diff --git a/src/nact/nact-iadvanced-tab.h b/src/nact/nact-iadvanced-tab.h
index 13f69b1..7e50656 100644
--- a/src/nact/nact-iadvanced-tab.h
+++ b/src/nact/nact-iadvanced-tab.h
@@ -67,7 +67,6 @@ void    nact_iadvanced_tab_initial_load( NactWindow *dialog );
 void    nact_iadvanced_tab_runtime_init( NactWindow *dialog );
 void    nact_iadvanced_tab_all_widgets_showed( NactWindow *dialog );
 void    nact_iadvanced_tab_dispose( NactWindow *dialog );
-void    nact_iadvanced_tab_reset_last_focus( NactWindow *dialog );
 
 void    nact_iadvanced_tab_set_profile( NactWindow *window, NAActionProfile *profile );
 GSList *nact_iadvanced_tab_get_schemes( NactWindow *window );
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index f49fecf..1813b05 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -94,8 +94,6 @@ static void             hide_status( NactWindow *window );
 static guint            get_status_context( NactWindow *window );
 static void             set_status_context( NactWindow *window, guint context );
 
-static void             on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window );
-
 GType
 nact_icommand_tab_get_type( void )
 {
@@ -186,9 +184,6 @@ nact_icommand_tab_runtime_init( NactWindow *dialog )
 	static const gchar *thisfn = "nact_icommand_tab_runtime_init";
 	g_debug( "%s: dialog=%p", thisfn, dialog );
 
-	GtkWidget *notebook = base_window_get_widget( BASE_WINDOW( dialog ), "MainNotebook" );
-	nact_window_signal_connect( dialog, G_OBJECT( notebook ), "switch-page", G_CALLBACK( on_switch_page ));
-
 	GtkWidget *label_entry = get_label_entry( dialog );
 	nact_window_signal_connect( dialog, G_OBJECT( label_entry ), "changed", G_CALLBACK( on_label_changed ));
 
@@ -225,12 +220,6 @@ nact_icommand_tab_dispose( NactWindow *dialog )
 }
 
 void
-nact_icommand_tab_reset_last_focus( NactWindow *dialog )
-{
-	g_object_set_data( G_OBJECT( dialog ), "nact-icommand-tab-last-focus", NULL );
-}
-
-void
 nact_icommand_tab_set_profile( NactWindow *dialog, const NAActionProfile *profile )
 {
 	static const gchar *thisfn = "nact_icommand_tab_set_profile";
@@ -779,21 +768,3 @@ set_status_context( NactWindow *window, guint context )
 {
 	g_object_set_data( G_OBJECT( window ), PROP_ICOMMAND_TAB_STATUS_CONTEXT, GUINT_TO_POINTER( context ));
 }
-
-/*
- * rationale: cf. nact-iaction-tab:on_swotch_page()
- */
-static void
-on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window )
-{
-	static const gchar *thisfn = "nact_icommand_tab_on_switch_page";
-
-	if( page_num == COMMAND_TAB ){
-		g_debug( "%s: notebook=%p, page=%p, page_num=%d, window=%p", thisfn, notebook, page, page_num, window );
-		GtkWidget *widget = GTK_WIDGET( g_object_get_data( G_OBJECT( window ), "nact-icommand-tab-last-focus" ));
-		if( !widget ){
-			widget = get_label_entry( window );
-		}
-		gtk_widget_grab_focus( widget );
-	}
-}
diff --git a/src/nact/nact-icommand-tab.h b/src/nact/nact-icommand-tab.h
index eb8e64f..4fa8ff1 100644
--- a/src/nact/nact-icommand-tab.h
+++ b/src/nact/nact-icommand-tab.h
@@ -70,7 +70,6 @@ void     nact_icommand_tab_initial_load( NactWindow *window );
 void     nact_icommand_tab_runtime_init( NactWindow *window );
 void     nact_icommand_tab_all_widgets_showed( NactWindow *window );
 void     nact_icommand_tab_dispose( NactWindow *window );
-void     nact_icommand_tab_reset_last_focus( NactWindow *dialog );
 
 void     nact_icommand_tab_set_profile( NactWindow *window, const NAActionProfile *profile );
 gboolean nact_icommand_tab_has_label( NactWindow *window );
diff --git a/src/nact/nact-iconditions-tab.c b/src/nact/nact-iconditions-tab.c
index 9676e19..9a24699 100644
--- a/src/nact/nact-iconditions-tab.c
+++ b/src/nact/nact-iconditions-tab.c
@@ -67,8 +67,6 @@ static GtkButton       *get_both_button( NactWindow *window );
 static void             on_multiple_toggled( GtkToggleButton *button, gpointer user_data );
 static GtkButton       *get_multiple_button( NactWindow *window );
 
-static void             on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window );
-
 GType
 nact_iconditions_tab_get_type( void )
 {
@@ -152,9 +150,6 @@ nact_iconditions_tab_runtime_init( NactWindow *dialog )
 	static const gchar *thisfn = "nact_iconditions_tab_runtime_init";
 	g_debug( "%s: dialog=%p", thisfn, dialog );
 
-	GtkWidget *notebook = base_window_get_widget( BASE_WINDOW( dialog ), "MainNotebook" );
-	nact_window_signal_connect( dialog, G_OBJECT( notebook ), "switch-page", G_CALLBACK( on_switch_page ));
-
 	GtkWidget *basenames_widget = get_basenames_entry( dialog );
 	nact_window_signal_connect( dialog, G_OBJECT( basenames_widget ), "changed", G_CALLBACK( on_basenames_changed ));
 
@@ -190,12 +185,6 @@ nact_iconditions_tab_dispose( NactWindow *dialog )
 }
 
 void
-nact_iconditions_tab_reset_last_focus( NactWindow *dialog )
-{
-	g_object_set_data( G_OBJECT( dialog ), "nact-iconditions-tab-last-focus", NULL );
-}
-
-void
 nact_iconditions_tab_set_profile( NactWindow *dialog, NAActionProfile *profile )
 {
 	static const gchar *thisfn = "nact_iconditions_tab_set_profile";
@@ -420,21 +409,3 @@ get_multiple_button( NactWindow *window )
 {
 	return( GTK_BUTTON( base_window_get_widget( BASE_WINDOW( window ), "ConditionsMultipleButton" )));
 }
-
-/*
- * rationale: cf. nact-iaction-tab:on_swotch_page()
- */
-static void
-on_switch_page( GtkNotebook *notebook, GtkNotebookPage *page, guint page_num, NactWindow *window )
-{
-	static const gchar *thisfn = "nact_iconditions_tab_on_switch_page";
-
-	if( page_num == CONDITIONS_TAB ){
-		g_debug( "%s: notebook=%p, page=%p, page_num=%d, window=%p", thisfn, notebook, page, page_num, window );
-		GtkWidget *widget = GTK_WIDGET( g_object_get_data( G_OBJECT( window ), "nact-iconditions-tab-last-focus" ));
-		if( !widget ){
-			widget = get_basenames_entry( window );
-		}
-		gtk_widget_grab_focus( widget );
-	}
-}
diff --git a/src/nact/nact-iconditions-tab.h b/src/nact/nact-iconditions-tab.h
index 5acbb47..664d245 100644
--- a/src/nact/nact-iconditions-tab.h
+++ b/src/nact/nact-iconditions-tab.h
@@ -67,7 +67,6 @@ void     nact_iconditions_tab_initial_load( NactWindow *dialog );
 void     nact_iconditions_tab_runtime_init( NactWindow *dialog );
 void     nact_iconditions_tab_all_widgets_showed( NactWindow *dialog );
 void     nact_iconditions_tab_dispose( NactWindow *dialog );
-void     nact_iconditions_tab_reset_last_focus( NactWindow *dialog );
 
 void     nact_iconditions_tab_set_profile( NactWindow *window, NAActionProfile *profile );
 void     nact_iconditions_tab_get_isfiledir( NactWindow *window, gboolean *isfile, gboolean *isdir );
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index 2561c18..4a08492 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -624,11 +624,6 @@ on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_da
 	static const gchar *thisfn = "nact_main_window_on_actions_list_selection_changed";
 	g_debug( "%s: selection=%p, user_data=%p", thisfn, selection, user_data );
 
-	nact_iaction_tab_reset_last_focus( NACT_WINDOW( user_data ));
-	nact_icommand_tab_reset_last_focus( NACT_WINDOW( user_data ));
-	nact_iconditions_tab_reset_last_focus( NACT_WINDOW( user_data ));
-	nact_iadvanced_tab_reset_last_focus( NACT_WINDOW( user_data ));
-
 	g_assert( NACT_IS_MAIN_WINDOW( user_data ));
 	NactMainWindow *window = NACT_MAIN_WINDOW( user_data );
 



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