/* Flashing delay for icons (milliseconds). */
#define FLASH_TIMEOUT 500
+/* Delay in milliseconds between the last stroke on the keyboard and the start
+ * of the live search. */
+#define SEARCH_TIMEOUT 500
+
enum
{
PROP_MODEL = 1,
guint flash_id;
gboolean display_flash_event;
+ guint search_id;
+
gboolean show_offline;
gboolean show_groups;
gboolean empty;
empathy_roster_view_set_live_search (self, NULL);
g_clear_object (&self->priv->model);
+ if (self->priv->search_id != 0)
+ {
+ g_source_remove (self->priv->search_id);
+ self->priv->search_id = 0;
+ }
+
if (chain_up != NULL)
chain_up (object);
}
g_list_free (children);
}
+static gboolean
+search_timeout_cb (EmpathyRosterView *self)
+{
+ egg_list_box_refilter (EGG_LIST_BOX (self));
+
+ select_first_contact (self);
+
+ self->priv->search_id = 0;
+ return G_SOURCE_REMOVE;
+}
+
static void
search_text_notify_cb (EmpathyLiveSearch *search,
GParamSpec *pspec,
EmpathyRosterView *self)
{
- egg_list_box_refilter (EGG_LIST_BOX (self));
+ if (self->priv->search_id != 0)
+ g_source_remove (self->priv->search_id);
- select_first_contact (self);
+ self->priv->search_id = g_timeout_add (SEARCH_TIMEOUT,
+ (GSourceFunc) search_timeout_cb, self);
}
static void