[gnome-commander] set focus when showing search dialog
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] set focus when showing search dialog
- Date: Mon, 25 May 2015 19:03:44 +0000 (UTC)
commit d5d75bdee620a1c5377f49fb767b509beb585a64
Author: Mamoru TASAKA <mtasaka fedoraproject org>
Date: Thu May 21 14:32:56 2015 +0900
set focus when showing search dialog
https://bugzilla.gnome.org/show_bug.cgi?id=745454
To avoid GnomeCmdSearchDialog priv->result_list receive
"key-press-event", explicitly set focus on pattern_combo
when search dialog is raised.
src/dialogs/gnome-cmd-search-dialog.cc | 6 ++++++
src/dialogs/gnome-cmd-search-dialog.h | 2 ++
src/gnome-cmd-selection-profile-component.cc | 5 +++++
src/gnome-cmd-selection-profile-component.h | 1 +
src/gnome-cmd-user-actions.cc | 2 +-
5 files changed, 15 insertions(+), 1 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-search-dialog.cc b/src/dialogs/gnome-cmd-search-dialog.cc
index fd5b55c..f9e0bf9 100644
--- a/src/dialogs/gnome-cmd-search-dialog.cc
+++ b/src/dialogs/gnome-cmd-search-dialog.cc
@@ -1120,6 +1120,12 @@ static void gnome_cmd_search_dialog_class_init (GnomeCmdSearchDialogClass *klass
}
+void GnomeCmdSearchDialog::show_and_set_focus()
+{
+ gtk_widget_show(*this);
+ priv->profile_component->set_focus();
+}
+
GnomeCmdSearchDialog::GnomeCmdSearchDialog(GnomeCmdData::SearchConfig &cfg): defaults(cfg)
{
gtk_window_set_default_size (*this, defaults.width, defaults.height);
diff --git a/src/dialogs/gnome-cmd-search-dialog.h b/src/dialogs/gnome-cmd-search-dialog.h
index 8c6da75..8398d94 100644
--- a/src/dialogs/gnome-cmd-search-dialog.h
+++ b/src/dialogs/gnome-cmd-search-dialog.h
@@ -55,6 +55,8 @@ struct GnomeCmdSearchDialog
GnomeCmdData::SearchConfig &defaults;
+ void show_and_set_focus();
+
GnomeCmdSearchDialog(GnomeCmdData::SearchConfig &defaults);
~GnomeCmdSearchDialog();
};
diff --git a/src/gnome-cmd-selection-profile-component.cc b/src/gnome-cmd-selection-profile-component.cc
index 390d1af..0e4abe9 100644
--- a/src/gnome-cmd-selection-profile-component.cc
+++ b/src/gnome-cmd-selection-profile-component.cc
@@ -237,6 +237,11 @@ void GnomeCmdSelectionProfileComponent::copy(GnomeCmdData::Selection &profile)
profile.match_case = profile.content_search && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
(priv->case_check));
}
+void GnomeCmdSelectionProfileComponent::set_focus()
+{
+ gtk_widget_grab_focus (priv->pattern_combo);
+}
+
void GnomeCmdSelectionProfileComponent::set_name_patterns_history(GList *history)
{
diff --git a/src/gnome-cmd-selection-profile-component.h b/src/gnome-cmd-selection-profile-component.h
index 8bea0df..f9add95 100644
--- a/src/gnome-cmd-selection-profile-component.h
+++ b/src/gnome-cmd-selection-profile-component.h
@@ -55,6 +55,7 @@ struct GnomeCmdSelectionProfileComponent
void update();
void copy(); // copies component to associated profile
void copy(GnomeCmdData::Selection &profile); // copies component to specified profile
+ void set_focus();
void set_name_patterns_history(GList *history);
void set_content_patterns_history(GList *history);
diff --git a/src/gnome-cmd-user-actions.cc b/src/gnome-cmd-user-actions.cc
index 107181e..7774a08 100644
--- a/src/gnome-cmd-user-actions.cc
+++ b/src/gnome-cmd-user-actions.cc
@@ -1081,7 +1081,7 @@ void edit_search (GtkMenuItem *menuitem, gpointer not_used)
if (!main_win->file_search_dlg)
main_win->file_search_dlg = new GnomeCmdSearchDialog(gnome_cmd_data.search_defaults);
- gtk_widget_show (*main_win->file_search_dlg);
+ main_win->file_search_dlg->show_and_set_focus();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]