[PATCH] -Focus does not return to item view after opening a location with Ctrl+L



Hi!, yet another keyboardability bug fixed :), please refer to the bugzilla bug[1] for more information, I'm also attaching the patch to this email.

Thank you.

[1] http://bugzilla.gnome.org/show_bug.cgi?id=500946
Index: src/file-manager/fm-icon-view.c
===================================================================
--- src/file-manager/fm-icon-view.c	(revisión: 14183)
+++ src/file-manager/fm-icon-view.c	(copia de trabajo)
@@ -1343,6 +1343,14 @@ fm_icon_view_can_zoom_out (FMDirectoryVi
 		> NAUTILUS_ZOOM_LEVEL_SMALLEST;
 }
 
+static void
+fm_icon_view_grab_focus (FMDirectoryView *view)
+{
+	g_return_if_fail (FM_IS_ICON_VIEW (view));
+	
+	gtk_widget_grab_focus (GTK_WIDGET (get_icon_container (FM_ICON_VIEW (view))));
+}
+
 static GtkWidget * 
 fm_icon_view_get_background_widget (FMDirectoryView *view) 
 {
@@ -2746,6 +2754,7 @@ fm_icon_view_class_init (FMIconViewClass
 	fm_directory_view_class->remove_file = fm_icon_view_remove_file;
 	fm_directory_view_class->reset_to_defaults = fm_icon_view_reset_to_defaults;
 	fm_directory_view_class->restore_default_zoom_level = fm_icon_view_restore_default_zoom_level;
+	fm_directory_view_class->grab_focus = fm_icon_view_grab_focus;
 	fm_directory_view_class->reveal_selection = fm_icon_view_reveal_selection;
 	fm_directory_view_class->select_all = fm_icon_view_select_all;
 	fm_directory_view_class->set_selection = fm_icon_view_set_selection;
Index: src/file-manager/fm-directory-view.c
===================================================================
--- src/file-manager/fm-directory-view.c	(revisión: 14183)
+++ src/file-manager/fm-directory-view.c	(copia de trabajo)
@@ -1774,6 +1774,7 @@ fm_directory_view_init_view_iface (Nauti
         iface->can_zoom_in = (gpointer)fm_directory_view_can_zoom_in;
         iface->can_zoom_out = (gpointer)fm_directory_view_can_zoom_out;
 	iface->get_zoom_level = (gpointer)fm_directory_view_get_zoom_level;
+	iface->grab_focus = (gpointer)fm_directory_view_grab_focus;
 
 	iface->pop_up_location_context_menu = (gpointer)fm_directory_view_pop_up_location_context_menu;
 }
@@ -3291,6 +3292,22 @@ fm_directory_view_get_zoom_level (FMDire
 }
 
 /**
+ * fm_directory_view_grab_focus:
+ *
+ * grab focus by invoking the relevant subclass through the slot
+ * 
+ **/
+void
+fm_directory_view_grab_focus (FMDirectoryView *view)
+{
+	g_return_if_fail (FM_IS_DIRECTORY_VIEW (view));
+
+	EEL_CALL_METHOD
+		(FM_DIRECTORY_VIEW_CLASS, view,
+		 grab_focus, (view));
+}
+
+/**
  * fm_directory_view_restore_default_zoom_level:
  *
  * restore to the default zoom level by invoking the relevant subclass through the slot
Index: src/file-manager/fm-directory-view.h
===================================================================
--- src/file-manager/fm-directory-view.h	(revisión: 14183)
+++ src/file-manager/fm-directory-view.h	(copia de trabajo)
@@ -252,6 +252,11 @@ struct FMDirectoryViewClass {
 	 */
 	gboolean (* supports_zooming)		(FMDirectoryView *view);
 
+	/* grab_focus is a function pointer that subclasses may
+	 * override to permit grabbing focus of the view.
+	 */
+	void (* grab_focus)			(FMDirectoryView *view);
+
 	/* using_manual_layout is a function pointer that subclasses may
 	 * override to control whether or not items can be freely positioned
 	 * on the user-visible area.
@@ -350,6 +355,7 @@ void                fm_directory_view_zo
 									NautilusZoomLevel zoom_level);
 NautilusZoomLevel   fm_directory_view_get_zoom_level                   (FMDirectoryView  *view);
 void                fm_directory_view_restore_default_zoom_level       (FMDirectoryView  *view);
+void                fm_directory_view_grab_focus                       (FMDirectoryView  *view);
 void                fm_directory_view_reset_to_defaults                (FMDirectoryView  *view);
 void                fm_directory_view_select_all                       (FMDirectoryView  *view);
 void                fm_directory_view_set_selection                    (FMDirectoryView  *view,
Index: src/nautilus-navigation-window.c
===================================================================
--- src/nautilus-navigation-window.c	(revisión: 14183)
+++ src/nautilus-navigation-window.c	(copia de trabajo)
@@ -477,6 +477,7 @@ navigation_bar_location_changed_callback
 	location = g_file_new_for_uri (uri);
 	nautilus_window_go_to (NAUTILUS_WINDOW (window), location);
 	g_object_unref (location);
+	nautilus_view_grab_focus (NAUTILUS_VIEW (NAUTILUS_WINDOW (window)->content_view));
 }
 
 static void
@@ -484,6 +485,7 @@ navigation_bar_cancel_callback (GtkWidge
 				NautilusNavigationWindow *window)
 {
 	hide_temporary_bars (window);
+	nautilus_view_grab_focus (NAUTILUS_VIEW (NAUTILUS_WINDOW (window)->content_view));
 }
 
 static void


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