[empathy: 28/80] LogWindow: don't add duplicate dates
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 28/80] LogWindow: don't add duplicate dates
- Date: Fri, 10 Jun 2011 08:41:31 +0000 (UTC)
commit d425a5037650360368a5c0da7358046b4e288097
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date: Tue Apr 26 10:15:52 2011 +0100
LogWindow: don't add duplicate dates
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 649d4d9..c7a81f3 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))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]