aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2014-03-07 21:48:30 +0800
committerMilan Crha <mcrha@redhat.com>2014-03-07 21:49:13 +0800
commitd325d27f96d7b3db849924b0282799968fb06010 (patch)
treec3f07c1afd4124eace1d96978e9762a58ad38220 /shell
parente4bb3a9d18b39dd188be69b54fd625d8b2d5a9d5 (diff)
downloadgsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar.gz
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar.bz2
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar.lz
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar.xz
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.tar.zst
gsoc2013-evolution-d325d27f96d7b3db849924b0282799968fb06010.zip
Bug #711351 - Folder change in folder tree steals focus
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-searchbar.c10
-rw-r--r--shell/e-shell-searchbar.h2
-rw-r--r--shell/e-shell-window-actions.c47
3 files changed, 57 insertions, 2 deletions
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index d00ed7c9be..2c070cfd5d 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -477,7 +477,6 @@ shell_searchbar_option_changed_cb (GtkRadioAction *action,
e_shell_view_execute_search (shell_view);
} else {
shell_searchbar_save_search_option (searchbar);
- gtk_widget_grab_focus (searchbar->priv->search_entry);
}
} else if (search_text != NULL)
@@ -1443,3 +1442,12 @@ e_shell_searchbar_save_state (EShellSearchbar *searchbar)
searchbar->priv->state_dirty = FALSE;
}
+
+void
+e_shell_searchbar_search_entry_grab_focus (EShellSearchbar *searchbar)
+{
+ g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+ g_return_if_fail (searchbar->priv->search_entry);
+
+ gtk_widget_grab_focus (searchbar->priv->search_entry);
+}
diff --git a/shell/e-shell-searchbar.h b/shell/e-shell-searchbar.h
index dc0b22bdbd..e5ccfb1828 100644
--- a/shell/e-shell-searchbar.h
+++ b/shell/e-shell-searchbar.h
@@ -110,6 +110,8 @@ void e_shell_searchbar_set_state_group
const gchar *state_group);
void e_shell_searchbar_load_state (EShellSearchbar *searchbar);
void e_shell_searchbar_save_state (EShellSearchbar *searchbar);
+void e_shell_searchbar_search_entry_grab_focus
+ (EShellSearchbar *searchbar);
G_END_DECLS
diff --git a/shell/e-shell-window-actions.c b/shell/e-shell-window-actions.c
index fee855918d..9146b548c4 100644
--- a/shell/e-shell-window-actions.c
+++ b/shell/e-shell-window-actions.c
@@ -538,6 +538,41 @@ action_search_edit_cb (GtkAction *action,
e_shell_window_update_search_menu (shell_window);
}
+static void
+search_options_selection_cancel_cb (GtkMenuShell *menu,
+ EShellWindow *shell_window);
+
+static void
+search_options_selection_done_cb (GtkMenuShell *menu,
+ EShellWindow *shell_window)
+{
+ EShellView *shell_view;
+ EShellSearchbar *search_bar;
+ const gchar *view_name;
+
+ /* disconnect first */
+ g_signal_handlers_disconnect_by_func (menu, search_options_selection_done_cb, shell_window);
+ g_signal_handlers_disconnect_by_func (menu, search_options_selection_cancel_cb, shell_window);
+
+ g_return_if_fail (E_IS_SHELL_WINDOW (shell_window));
+
+ view_name = e_shell_window_get_active_view (shell_window);
+ shell_view = e_shell_window_get_shell_view (shell_window, view_name);
+ g_return_if_fail (shell_view != NULL);
+
+ search_bar = E_SHELL_SEARCHBAR (e_shell_view_get_searchbar (shell_view));
+ e_shell_searchbar_search_entry_grab_focus (search_bar);
+}
+
+static void
+search_options_selection_cancel_cb (GtkMenuShell *menu,
+ EShellWindow *shell_window)
+{
+ /* only disconnect both functions, thus the selection-done is not called */
+ g_signal_handlers_disconnect_by_func (menu, search_options_selection_done_cb, shell_window);
+ g_signal_handlers_disconnect_by_func (menu, search_options_selection_cancel_cb, shell_window);
+}
+
/**
* E_SHELL_WINDOW_ACTION_SEARCH_OPTIONS:
* @window: an #EShellWindow
@@ -553,13 +588,23 @@ action_search_options_cb (GtkAction *action,
EShellViewClass *shell_view_class;
const gchar *view_name;
const gchar *widget_path;
+ GtkWidget *popup_menu;
view_name = e_shell_window_get_active_view (shell_window);
shell_view = e_shell_window_get_shell_view (shell_window, view_name);
shell_view_class = E_SHELL_VIEW_GET_CLASS (shell_view);
widget_path = shell_view_class->search_options;
- e_shell_view_show_popup_menu (shell_view, widget_path, NULL);
+ popup_menu = e_shell_view_show_popup_menu (shell_view, widget_path, NULL);
+
+ if (popup_menu) {
+ g_return_if_fail (GTK_IS_MENU_SHELL (popup_menu));
+
+ g_signal_connect_object (popup_menu, "selection-done",
+ G_CALLBACK (search_options_selection_done_cb), shell_window, 0);
+ g_signal_connect_object (popup_menu, "cancel",
+ G_CALLBACK (search_options_selection_cancel_cb), shell_window, 0);
+ }
}
/**