search-view: only decrease search counter when something is removed

Because we were blindlessly decreasing the search hit counter without
considering that we could've not removed anything, the search hit
counter is going nuts.

Fix that by properly checking if something was removed, and only decrease
the search hit counter when that happens.
This commit is contained in:
Georges Basile Stavracas Neto
2017-01-24 08:59:00 -02:00
parent c6b7d753a9
commit 53f9158f25
+13 -8
View File
@@ -638,22 +638,27 @@ gcal_search_view_component_removed (ECalDataModelSubscriber *subscriber,
else
uuid = g_strdup_printf ("%s:%s", e_source_get_uid (source), uid);
// Lookup the RowEventData
/* Lookup the RowEventData */
row_data = g_hash_table_lookup (view->uuid_to_event, uuid);
/* Removing the given RowEventData entry will
* call free_row_data, which removes the row
* from the listbox and also free the uuid.
*/
if (row_data)
g_hash_table_remove (view->uuid_to_event, uuid);
/* We didn't add this event, so there's nothing to do */
if (!row_data)
goto out;
g_free (uuid);
/*
* Removing the given RowEventData entry will call free_row_data(),
* which removes the row from the listbox and also frees the hashtable's
* uuid.
*/
g_hash_table_remove (view->uuid_to_event, uuid);
/* show 'no results' */
view->num_results--;
update_view (GCAL_SEARCH_VIEW (subscriber));
out:
g_free (uuid);
}
static void