Commit 699743b4 authored by Sebastian Krzyszkowiak's avatar Sebastian Krzyszkowiak Committed by Guido Gunther

home: Reset the app grid state when unfolding

This includes clearing the search field and scrolling the list to the top.
parent 655e6dcd
Pipeline #31572 passed with stages
in 5 minutes and 43 seconds
......@@ -20,6 +20,7 @@ struct _PhoshAppGridPrivate {
GtkWidget *search;
GtkWidget *apps;
GtkWidget *favs;
GtkWidget *scrolled_window;
GSettings *settings;
};
......@@ -238,6 +239,7 @@ phosh_app_grid_class_init (PhoshAppGridClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, search);
gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, apps);
gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, favs);
gtk_widget_class_bind_template_child_private (widget_class, PhoshAppGrid, scrolled_window);
gtk_widget_class_bind_template_callback (widget_class, search_changed);
......@@ -250,6 +252,18 @@ phosh_app_grid_class_init (PhoshAppGridClass *klass)
gtk_widget_class_set_css_name (widget_class, "phosh-app-grid");
}
void
phosh_app_grid_reset (PhoshAppGrid *self)
{
PhoshAppGridPrivate *priv;
GtkAdjustment *adjustment;
g_return_if_fail(PHOSH_IS_APP_GRID (self));
priv = phosh_app_grid_get_instance_private (self);
adjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (priv->scrolled_window));
gtk_adjustment_set_value(adjustment, 0);
gtk_entry_set_text(GTK_ENTRY (priv->search), "");
}
GtkWidget *
phosh_app_grid_new (void)
{
......
......@@ -22,6 +22,7 @@ struct _PhoshAppGridClass
GtkBoxClass parent_class;
};
void phosh_app_grid_reset (PhoshAppGrid *self);
GtkWidget *phosh_app_grid_new (void);
G_END_DECLS
......@@ -341,6 +341,7 @@ phosh_home_set_state (PhoshHome *self, PhoshHomeState state)
if (state == PHOSH_HOME_STATE_UNFOLDED) {
gtk_widget_hide (self->btn_osk);
kbd_interactivity = TRUE;
phosh_overview_reset (PHOSH_OVERVIEW (self->overview));
} else {
gtk_widget_show (self->btn_osk);
kbd_interactivity = FALSE;
......
......@@ -291,6 +291,16 @@ phosh_overview_init (PhoshOverview *self)
}
void
phosh_overview_reset (PhoshOverview *self)
{
PhoshOverviewPrivate *priv;
g_return_if_fail(PHOSH_IS_OVERVIEW (self));
priv = phosh_overview_get_instance_private (self);
phosh_app_grid_reset (PHOSH_APP_GRID (priv->app_grid));
}
GtkWidget *
phosh_overview_new (void)
{
......
......@@ -12,4 +12,5 @@
G_DECLARE_FINAL_TYPE (PhoshOverview, phosh_overview, PHOSH, OVERVIEW, GtkBox)
void phosh_overview_reset (PhoshOverview *self);
GtkWidget * phosh_overview_new (void);
......@@ -28,7 +28,7 @@
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<object class="GtkScrolledWindow" id="scrolled_window">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
......
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