[nautilus] query-editor: make sure not to handle space if we're invisible
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] query-editor: make sure not to handle space if we're invisible
- Date: Wed, 18 Jul 2012 20:17:31 +0000 (UTC)
commit c1113a7e0acb0cccd9d8839256b306b5993d4dfb
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Wed Jul 18 16:15:35 2012 -0400
query-editor: make sure not to handle space if we're invisible
https://bugzilla.gnome.org/show_bug.cgi?id=680196
src/nautilus-query-editor.c | 15 +++++++++++++++
src/nautilus-window.c | 9 +++------
2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/src/nautilus-query-editor.c b/src/nautilus-query-editor.c
index 9f92875..e8bb694 100644
--- a/src/nautilus-query-editor.c
+++ b/src/nautilus-query-editor.c
@@ -197,6 +197,21 @@ nautilus_query_editor_handle_event (NautilusQueryEditor *editor,
char *old_text;
const char *new_text;
+ /* if we're focused already, no need to handle the event manually */
+ if (gtk_widget_has_focus (editor->details->entry)) {
+ return FALSE;
+ }
+
+ /* never handle these events */
+ if (event->keyval == GDK_KEY_slash || event->keyval == GDK_KEY_Delete) {
+ return FALSE;
+ }
+
+ /* don't activate search for these events */
+ if (!gtk_widget_get_visible (GTK_WIDGET (editor)) && event->keyval == GDK_KEY_space) {
+ return FALSE;
+ }
+
editor->details->got_preedit = FALSE;
if (!gtk_widget_get_realized (editor->details->entry)) {
gtk_widget_realize (editor->details->entry);
diff --git a/src/nautilus-window.c b/src/nautilus-window.c
index f7e5c3a..5f7d74b 100644
--- a/src/nautilus-window.c
+++ b/src/nautilus-window.c
@@ -1454,12 +1454,9 @@ nautilus_window_key_press_event (GtkWidget *widget,
}
}
- if (event->keyval != GDK_KEY_slash /* don't steal slash key event, used for "go to" */ &&
- event->keyval != GDK_KEY_Delete) {
- if (nautilus_window_slot_handle_event (window->details->active_slot, event)) {
- toggle_toolbar_search_button (window, TRUE);
- return TRUE;
- }
+ if (nautilus_window_slot_handle_event (window->details->active_slot, event)) {
+ toggle_toolbar_search_button (window, TRUE);
+ return TRUE;
}
return GTK_WIDGET_CLASS (nautilus_window_parent_class)->key_press_event (widget, event);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]