search-view: implemented no results page
This commit is contained in:
committed by
Erick Pérez Castellanos
parent
f937489dcd
commit
ab1374d8cd
@@ -51,6 +51,7 @@
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="row_spacing">24</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image">
|
||||
<property name="visible">True</property>
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
typedef struct
|
||||
{
|
||||
GtkWidget *listbox;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *no_results_grid;
|
||||
|
||||
/* misc */
|
||||
@@ -252,6 +253,7 @@ gcal_search_view_class_init (GcalSearchViewClass *klass)
|
||||
gtk_widget_class_set_template_from_resource (GTK_WIDGET_CLASS (klass), "/org/gnome/calendar/search-view.ui");
|
||||
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GcalSearchView, no_results_grid);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GcalSearchView, frame);
|
||||
gtk_widget_class_bind_template_child_private (GTK_WIDGET_CLASS (klass), GcalSearchView, listbox);
|
||||
}
|
||||
|
||||
@@ -403,6 +405,9 @@ gcal_search_view_component_added (ECalDataModelSubscriber *subscriber,
|
||||
grid = make_grid_for_event (GCAL_SEARCH_VIEW (subscriber), GCAL_EVENT_WIDGET (event));
|
||||
gtk_container_add (GTK_CONTAINER (priv->listbox), grid);
|
||||
priv->num_results++;
|
||||
|
||||
gtk_widget_set_visible (priv->frame, priv->num_results != 0);
|
||||
gtk_widget_set_visible (priv->no_results_grid, priv->num_results == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -454,6 +459,9 @@ gcal_search_view_component_removed (ECalDataModelSubscriber *subscriber,
|
||||
|
||||
g_list_free (children);
|
||||
priv->num_results--;
|
||||
|
||||
gtk_widget_set_visible (priv->frame, priv->num_results != 0);
|
||||
gtk_widget_set_visible (priv->no_results_grid, priv->num_results == 0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user