[nautilus/wip/gbsneto/other-locations] files-view: overwrite GtkWidget::grab-focus method
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/gbsneto/other-locations] files-view: overwrite GtkWidget::grab-focus method
- Date: Thu, 16 Jul 2015 18:09:28 +0000 (UTC)
commit 624745f4257a8c869572965a459d925c518899cc
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Jul 16 15:05:46 2015 -0300
files-view: overwrite GtkWidget::grab-focus method
GtkFilesView provides a public grab_focus function that
also exists in GtkWidget's class.
Instead of having two different methods for the same
functionality, simply overwrite GtkWidget's one and let
Gtk+ work by its own.
src/nautilus-files-view.c | 5 +++--
src/nautilus-files-view.h | 1 -
src/nautilus-toolbar.c | 2 +-
src/nautilus-window.c | 9 ++-------
4 files changed, 6 insertions(+), 11 deletions(-)
---
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index fc9c478..8dd874c 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -2473,8 +2473,8 @@ slot_inactive (NautilusWindowSlot *slot,
remove_update_context_menus_timeout_callback (view);
}
-void
-nautilus_files_view_grab_focus (NautilusFilesView *view)
+static void
+nautilus_files_view_grab_focus (GtkWidget *view)
{
/* focus the child of the scrolled window if it exists */
GtkWidget *child;
@@ -7535,6 +7535,7 @@ nautilus_files_view_class_init (NautilusFilesViewClass *klass)
widget_class->destroy = nautilus_files_view_destroy;
widget_class->scroll_event = nautilus_files_view_scroll_event;
widget_class->parent_set = nautilus_files_view_parent_set;
+ widget_class->grab_focus = nautilus_files_view_grab_focus;
g_type_class_add_private (klass, sizeof (NautilusFilesViewDetails));
diff --git a/src/nautilus-files-view.h b/src/nautilus-files-view.h
index 22a996a..6e165fc 100644
--- a/src/nautilus-files-view.h
+++ b/src/nautilus-files-view.h
@@ -379,7 +379,6 @@ void nautilus_files_view_pop_up_location_context_menu (Nautilu
void nautilus_files_view_pop_up_pathbar_context_menu (NautilusFilesView *view,
GdkEventButton *event,
const char *location);
-void nautilus_files_view_grab_focus (NautilusFilesView *view);
void nautilus_files_view_update_menus (NautilusFilesView *view);
void nautilus_files_view_update_context_menus (NautilusFilesView *view);
diff --git a/src/nautilus-toolbar.c b/src/nautilus-toolbar.c
index 208a2f5..43ee638 100644
--- a/src/nautilus-toolbar.c
+++ b/src/nautilus-toolbar.c
@@ -417,7 +417,7 @@ view_menu_popover_closed (GtkPopover *popover,
slot = nautilus_window_get_active_slot (self->priv->window);
view = nautilus_window_slot_get_current_view (slot);
- nautilus_files_view_grab_focus (view);
+ gtk_widget_grab_focus (GTK_WIDGET (view));
}
static void
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index a20617d..c725384 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -667,7 +667,7 @@ nautilus_window_grab_focus (NautilusWindow *window)
view = nautilus_window_slot_get_view (slot);
if (view) {
- nautilus_files_view_grab_focus (view);
+ gtk_widget_grab_focus (GTK_WIDGET (view));
}
}
@@ -675,12 +675,7 @@ static void
restore_focus_widget (NautilusWindow *window)
{
if (window->priv->last_focus_widget != NULL) {
- if (NAUTILUS_IS_FILES_VIEW (window->priv->last_focus_widget)) {
- nautilus_files_view_grab_focus (NAUTILUS_FILES_VIEW
(window->priv->last_focus_widget));
- } else {
- gtk_widget_grab_focus (window->priv->last_focus_widget);
- }
-
+ gtk_widget_grab_focus (window->priv->last_focus_widget);
unset_focus_widget (window);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]