aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-06-25 08:23:07 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-25 08:42:09 +0800
commit71e92f3f2c45cd8dd9f44d8226e23603164974a5 (patch)
tree93f4758df11e2f7c92a4e8c60f85359547bf93fe /shell
parent179db75ce041706a590e90a6ac7b801b36091ed6 (diff)
downloadgsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar.gz
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar.bz2
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar.lz
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar.xz
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.tar.zst
gsoc2013-evolution-71e92f3f2c45cd8dd9f44d8226e23603164974a5.zip
EShellContent: Add a focus_search_results() method.
This gives EShellSearchbar something concrete to call to direct focus away from itself instead of tabbing forward and hoping for the best.
Diffstat (limited to 'shell')
-rw-r--r--shell/e-shell-content.c23
-rw-r--r--shell/e-shell-content.h3
-rw-r--r--shell/e-shell-searchbar.c13
3 files changed, 33 insertions, 6 deletions
diff --git a/shell/e-shell-content.c b/shell/e-shell-content.c
index 515dfa83bf..d897e110ad 100644
--- a/shell/e-shell-content.c
+++ b/shell/e-shell-content.c
@@ -386,6 +386,29 @@ e_shell_content_check_state (EShellContent *shell_content)
}
/**
+ * e_shell_content_focus_search_results:
+ * @shell_content: an #EShellContent
+ *
+ * #EShellContent subclasses should implement the
+ * <structfield>focus_search_results</structfield> method in
+ * #EShellContentClass to direct input focus to the widget
+ * displaying search results. This is usually called during
+ * e_shell_view_execute_search().
+ **/
+void
+e_shell_content_focus_search_results (EShellContent *shell_content)
+{
+ EShellContentClass *shell_content_class;
+
+ g_return_if_fail (E_IS_SHELL_CONTENT (shell_content));
+
+ shell_content_class = E_SHELL_CONTENT_GET_CLASS (shell_content);
+
+ if (shell_content_class->focus_search_results != NULL)
+ shell_content_class->focus_search_results (shell_content);
+}
+
+/**
* e_shell_content_get_shell_view:
* @shell_content: an #EShellContent
*
diff --git a/shell/e-shell-content.h b/shell/e-shell-content.h
index e6a11291a7..a92ac346b8 100644
--- a/shell/e-shell-content.h
+++ b/shell/e-shell-content.h
@@ -68,6 +68,7 @@ struct _EShellContentClass {
/* Methods */
guint32 (*check_state) (EShellContent *shell_content);
+ void (*focus_search_results) (EShellContent *shell_content);
};
GType e_shell_content_get_type (void);
@@ -75,6 +76,8 @@ GtkWidget * e_shell_content_new (struct _EShellView *shell_view);
void e_shell_content_set_searchbar (EShellContent *shell_content,
GtkWidget *searchbar);
guint32 e_shell_content_check_state (EShellContent *shell_content);
+void e_shell_content_focus_search_results
+ (EShellContent *shell_content);
struct _EShellView *
e_shell_content_get_shell_view (EShellContent *shell_content);
const gchar * e_shell_content_get_view_id (EShellContent *shell_content);
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index e8e4fe230d..d1f8f65d62 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -300,7 +300,7 @@ static void
shell_searchbar_execute_search_cb (EShellView *shell_view,
EShellSearchbar *searchbar)
{
- GtkWidget *widget;
+ EShellContent *shell_content;
shell_searchbar_update_search_widgets (searchbar);
@@ -312,9 +312,10 @@ shell_searchbar_execute_search_cb (EShellView *shell_view,
/* Direct the focus away from the search entry, so that a
* focus-in event is required before the text can be changed.
* This will reset the entry to the appropriate visual state. */
- widget = searchbar->priv->search_entry;
- if (gtk_widget_is_focus (widget))
- gtk_widget_child_focus (widget, GTK_DIR_TAB_FORWARD);
+ if (gtk_widget_is_focus (searchbar->priv->search_entry)) {
+ shell_content = e_shell_view_get_shell_content (shell_view);
+ e_shell_content_focus_search_results (shell_content);
+ }
}
static void
@@ -857,7 +858,7 @@ e_shell_searchbar_class_init (EShellSearchbarClass *class)
G_PARAM_CONSTRUCT));
/**
- * EShellContent:shell-view
+ * EShellSearchbar:shell-view
*
* The #EShellView to which the searchbar widget belongs.
**/
@@ -873,7 +874,7 @@ e_shell_searchbar_class_init (EShellSearchbarClass *class)
G_PARAM_CONSTRUCT_ONLY));
/**
- * EShellContent:state-group
+ * EShellSearchbar:state-group
*
* Key file group name to read and write search bar state.
**/