-static void
-roster_window_flash_stop (EmpathyRosterWindow *self)
-{
- if (self->priv->flash_timeout_id == 0)
- return;
-
- DEBUG ("Stop flashing");
- g_source_remove (self->priv->flash_timeout_id);
- self->priv->flash_timeout_id = 0;
- self->priv->flash_on = FALSE;
-}
-
-typedef struct
-{
- EmpathyEvent *event;
- gboolean on;
- EmpathyRosterWindow *self;
-} FlashForeachData;
-
-static gboolean
-roster_window_flash_foreach (GtkTreeModel *model,
- GtkTreePath *path,
- GtkTreeIter *iter,
- gpointer user_data)
-{
- FlashForeachData *data = (FlashForeachData *) user_data;
- FolksIndividual *individual;
- EmpathyContact *contact;
- const gchar *icon_name;
- GtkTreePath *parent_path = NULL;
- GtkTreeIter parent_iter;
- GdkPixbuf *pixbuf = NULL;
-
- gtk_tree_model_get (model, iter,
- EMPATHY_INDIVIDUAL_STORE_COL_INDIVIDUAL, &individual,
- -1);
-
- if (individual == NULL)
- return FALSE;
-
- contact = empathy_contact_dup_from_folks_individual (individual);
- if (contact != data->event->contact)
- goto out;
-
- if (data->on)
- {
- icon_name = data->event->icon_name;
- pixbuf = empathy_pixbuf_from_icon_name (icon_name, GTK_ICON_SIZE_MENU);
- }
- else
- {
- pixbuf = empathy_individual_store_get_individual_status_icon (
- data->self->priv->individual_store,
- individual);
- if (pixbuf != NULL)
- g_object_ref (pixbuf);
- }
-
- gtk_tree_store_set (GTK_TREE_STORE (model), iter,
- EMPATHY_INDIVIDUAL_STORE_COL_ICON_STATUS, pixbuf,
- -1);
-
- /* To make sure the parent is shown correctly, we emit
- * the row-changed signal on the parent so it prompts
- * it to be refreshed by the filter func.
- */
- if (gtk_tree_model_iter_parent (model, &parent_iter, iter))
- {
- parent_path = gtk_tree_model_get_path (model, &parent_iter);
- }
-
- if (parent_path != NULL)
- {
- gtk_tree_model_row_changed (model, parent_path, &parent_iter);
- gtk_tree_path_free (parent_path);
- }
-
-out:
- g_object_unref (individual);
- tp_clear_object (&contact);
- tp_clear_object (&pixbuf);
-
- return FALSE;
-}
-
-static gboolean
-roster_window_flash_cb (EmpathyRosterWindow *self)
-{
- GtkTreeModel *model;
- GSList *events, *l;
- gboolean found_event = FALSE;
- FlashForeachData data;
-
- self->priv->flash_on = !self->priv->flash_on;
- data.on = self->priv->flash_on;
- model = GTK_TREE_MODEL (self->priv->individual_store);
-
- events = empathy_event_manager_get_events (self->priv->event_manager);
- for (l = events; l; l = l->next)
- {
- data.event = l->data;
- data.self = self;
- if (!data.event->contact || !data.event->must_ack)
- continue;
-
- found_event = TRUE;
- gtk_tree_model_foreach (model,
- roster_window_flash_foreach,
- &data);
- }
-
- if (!found_event)
- roster_window_flash_stop (self);
-
- return TRUE;
-}
-
-static void
-roster_window_flash_start (EmpathyRosterWindow *self)
-{
- if (self->priv->flash_timeout_id != 0)
- return;
-
- DEBUG ("Start flashing");
- self->priv->flash_timeout_id = g_timeout_add (FLASH_TIMEOUT,
- (GSourceFunc) roster_window_flash_cb, self);
-
- roster_window_flash_cb (self);
-}
-