Commit 0677a0e8 authored by Guido Gunther's avatar Guido Gunther
Browse files

overview: Focus search when user starts typing



Closes: #564
Signed-off-by: Guido Gunther's avatarGuido Günther <guido.gunther@puri.sm>
parent bb7ba75b
Pipeline #69614 passed with stages
in 55 minutes and 27 seconds
......@@ -605,6 +605,22 @@ phosh_app_grid_focus_search (PhoshAppGrid *self)
}
gboolean
phosh_app_grid_handle_search (PhoshAppGrid *self, GdkEvent *event)
{
PhoshAppGridPrivate *priv;
gboolean ret;
g_return_val_if_fail (PHOSH_IS_APP_GRID (self), GDK_EVENT_PROPAGATE);
priv = phosh_app_grid_get_instance_private (self);
ret = gtk_search_entry_handle_event (GTK_SEARCH_ENTRY (priv->search), event);
if (ret == GDK_EVENT_STOP)
gtk_entry_grab_focus_without_selecting (GTK_ENTRY (priv->search));
return ret;
}
void
phosh_app_grid_set_filter_adaptive (PhoshAppGrid *self, gboolean enable)
{
......
......@@ -37,6 +37,7 @@ struct _PhoshAppGridClass
GtkWidget *phosh_app_grid_new (void);
void phosh_app_grid_reset (PhoshAppGrid *self);
void phosh_app_grid_focus_search (PhoshAppGrid *self);
gboolean phosh_app_grid_handle_search (PhoshAppGrid *self, GdkEvent *event);
void phosh_app_grid_set_filter_adaptive (PhoshAppGrid *self, gboolean enable);
......
......@@ -220,8 +220,8 @@ window_key_press_event_cb (PhoshHome *self, GdkEvent *event, gpointer data)
ret = GDK_EVENT_STOP;
break;
default:
/* nothing to do */
break;
/* Focus search when typing */
ret = phosh_overview_handle_search (PHOSH_OVERVIEW (self->overview), event);
}
return ret;
......
......@@ -517,6 +517,18 @@ phosh_overview_focus_app_search (PhoshOverview *self)
phosh_app_grid_focus_search (PHOSH_APP_GRID (priv->app_grid));
}
gboolean
phosh_overview_handle_search (PhoshOverview *self, GdkEvent *event)
{
PhoshOverviewPrivate *priv;
g_return_val_if_fail(PHOSH_IS_OVERVIEW (self), GDK_EVENT_PROPAGATE);
priv = phosh_overview_get_instance_private (self);
return phosh_app_grid_handle_search (PHOSH_APP_GRID (priv->app_grid), event);
}
gboolean
phosh_overview_has_running_activities (PhoshOverview *self)
{
......
......@@ -21,6 +21,7 @@ GtkWidget *phosh_overview_new (void);
void phosh_overview_reset (PhoshOverview *self);
void phosh_overview_focus_app_search (PhoshOverview *self);
gboolean phosh_overview_has_running_activities (PhoshOverview *self);
gboolean phosh_overview_handle_search (PhoshOverview *self, GdkEvent *event);
PhoshAppGrid *phosh_overview_get_app_grid (PhoshOverview *self);
G_END_DECLS
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment