search-view: no show search view if field is empty
When the search field is empty is not needed show the result drop down. https://bugzilla.gnome.org/show_bug.cgi?id=747962
This commit is contained in:
committed by
Georges Basile Stavracas Neto
parent
35b2f90cab
commit
c3bffd5eeb
@@ -291,7 +291,6 @@
|
||||
</child>
|
||||
</template>
|
||||
<object class="GcalSearchView" id="search_view">
|
||||
<property name="visible" bind-source="search_bar" bind-property="search-mode-enabled" bind-flags="default | sync-create" />
|
||||
<property name="relative_to">search_entry</property>
|
||||
<property name="position">bottom</property>
|
||||
<signal name="event-activated" handler="search_event_selected" object="GcalWindow" swapped="no"/>
|
||||
|
||||
+15
-3
@@ -1197,12 +1197,24 @@ search_changed (GtkEditable *editable,
|
||||
gpointer user_data)
|
||||
{
|
||||
GcalWindow *window = GCAL_WINDOW (user_data);
|
||||
gint search_length;
|
||||
|
||||
if (gtk_search_bar_get_search_mode (GTK_SEARCH_BAR (window->search_bar)))
|
||||
{
|
||||
/* perform the search */
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (window->search_view),
|
||||
"summary", gtk_entry_get_text (GTK_ENTRY (window->search_entry)));
|
||||
/* perform the search or hide when the field is empty */
|
||||
|
||||
search_length = gtk_entry_get_text_length (GTK_ENTRY (window->search_entry));
|
||||
|
||||
if (search_length)
|
||||
{
|
||||
gtk_popover_popup (GTK_POPOVER (window->search_view));
|
||||
gcal_search_view_search (GCAL_SEARCH_VIEW (window->search_view),
|
||||
"summary", gtk_entry_get_text (GTK_ENTRY (window->search_entry)));
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_popover_popdown (GTK_POPOVER (window->search_view));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user