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-06-09 19:34:55 +0800 |
commit | d425a5037650360368a5c0da7358046b4e288097 (patch) | |
tree | 8a3c3bbee8eaab4aff2b6c7fea124257ab3abf98 /libempathy-gtk | |
parent | e168f565d9bb4ba7ccece873beb40fde959b8d29 (diff) | |
download | gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar.gz gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar.bz2 gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar.lz gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar.xz gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.tar.zst gsoc2013-empathy-d425a5037650360368a5c0da7358046b4e288097.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 649d4d966..c7a81f38e 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -2389,7 +2389,6 @@ log_manager_got_dates_cb (GObject *manager, GtkTreeIter iter; GList *dates; GList *l; - GDate *date = NULL; GError *error = NULL; if (log_window == NULL) @@ -2416,19 +2415,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)) |