diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-26 17:15:52 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-26 17:15:52 +0800 |
commit | d3850d97b423d384e7c73fba12565af272f2854c (patch) | |
tree | d053ae32358efce6b4521ffbccd3dc4b6e0c3454 /libempathy-gtk | |
parent | b9d393f527d0a09e6b7daa4b4b362f2530c37f82 (diff) | |
download | gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar.gz gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar.bz2 gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar.lz gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar.xz gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.tar.zst gsoc2013-empathy-d3850d97b423d384e7c73fba12565af272f2854c.zip |
LogWindow: don't add duplicate dates
Diffstat (limited to 'libempathy-gtk')
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index e1ce704cb..cda7b7cb7 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -2385,7 +2385,6 @@ log_manager_got_dates_cb (GObject *manager, GtkTreeIter iter; GList *dates; GList *l; - GDate *date = NULL; GError *error = NULL; if (log_window == NULL) @@ -2412,19 +2411,24 @@ log_manager_got_dates_cb (GObject *manager, for (l = dates; l != NULL; l = l->next) { - gchar *text; + GDate *date = l->data; - date = l->data; - text = format_date_for_display (date); + /* Add the date if it's not already there */ + has_element = FALSE; + gtk_tree_model_foreach (model, model_has_date, date); + if (!has_element) + { + gchar *text = format_date_for_display (date); - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, - COL_WHEN_DATE, date, - COL_WHEN_TEXT, text, - COL_WHEN_ICON, CALENDAR_ICON, - -1); + gtk_list_store_append (store, &iter); + gtk_list_store_set (store, &iter, + COL_WHEN_DATE, date, + COL_WHEN_TEXT, text, + COL_WHEN_ICON, CALENDAR_ICON, + -1); - g_free (text); + g_free (text); + } } if (gtk_tree_model_get_iter_first (model, &iter)) |