aboutsummaryrefslogtreecommitdiffstats
path: root/src/empathy-main-window.c
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@gmail.com>2011-09-23 17:01:36 +0800
committerXavier Claessens <xclaesse@gmail.com>2011-09-26 18:34:12 +0800
commit175e46dd48b3906e59df36b9faa469565783e28d (patch)
treecfa8f1a625bd57ce3fd4c9a395928936b62c72b2 /src/empathy-main-window.c
parent381062d1a807da25f188340cdc81188c43bf0f58 (diff)
downloadgsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar.gz
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar.bz2
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar.lz
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar.xz
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.tar.zst
gsoc2013-empathy-175e46dd48b3906e59df36b9faa469565783e28d.zip
Wait for the store to be filled before loading events
https://bugzilla.gnome.org/show_bug.cgi?id=659807
Diffstat (limited to 'src/empathy-main-window.c')
-rw-r--r--src/empathy-main-window.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c
index cb135c4fc..fda8a9601 100644
--- a/src/empathy-main-window.c
+++ b/src/empathy-main-window.c
@@ -555,6 +555,23 @@ main_window_event_removed_cb (EmpathyEventManager *manager,
&data);
}
+static gboolean
+main_window_load_events_idle_cb (gpointer user_data)
+{
+ EmpathyMainWindow *window = user_data;
+ EmpathyMainWindowPriv *priv = GET_PRIV (window);
+ GSList *l;
+
+ l = empathy_event_manager_get_events (priv->event_manager);
+ while (l) {
+ main_window_event_added_cb (priv->event_manager, l->data,
+ window);
+ l = l->next;
+ }
+
+ return FALSE;
+}
+
static void
main_window_row_activated_cb (EmpathyContactListView *view,
GtkTreePath *path,
@@ -649,6 +666,12 @@ main_window_row_inserted_cb (GtkTreeModel *model,
gtk_notebook_set_current_page (GTK_NOTEBOOK (priv->notebook),
PAGE_CONTACT_LIST);
gtk_widget_grab_focus (GTK_WIDGET (priv->individual_view));
+
+ /* The store is being filled, it will be done after an idle cb.
+ * So we can then get events. If we do that too soon, event's
+ * contact is not yet in the store and it won't get marked as
+ * having events. */
+ g_idle_add (main_window_load_events_idle_cb, window);
}
}
@@ -2152,7 +2175,6 @@ empathy_main_window_init (EmpathyMainWindow *window)
GtkToolItem *item;
gboolean show_offline;
gchar *filename;
- GSList *l;
GtkTreeModel *model;
GtkWidget *search_vbox;
GtkWidget *menubar;
@@ -2393,13 +2415,6 @@ empathy_main_window_init (EmpathyMainWindow *window)
G_CALLBACK (main_window_account_disabled_cb),
window);
- l = empathy_event_manager_get_events (priv->event_manager);
- while (l) {
- main_window_event_added_cb (priv->event_manager, l->data,
- window);
- l = l->next;
- }
-
/* Show offline ? */
show_offline = g_settings_get_boolean (priv->gsettings_ui,
EMPATHY_PREFS_UI_SHOW_OFFLINE);