diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-27 19:42:37 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-04-27 19:42:37 +0800 |
commit | 9ffaedfdb3441ac259469a96cf671f2be5347d23 (patch) | |
tree | e87de9141192a6fb57f1f1a3f14c1191bd590f28 | |
parent | cfaa76cf91c2037b0ffe49730417afe3132332cb (diff) | |
download | gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar.gz gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar.bz2 gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar.lz gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar.xz gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.tar.zst gsoc2013-empathy-9ffaedfdb3441ac259469a96cf671f2be5347d23.zip |
Don't use global variables
-rw-r--r-- | libempathy-gtk/empathy-log-window.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 1ed0b44c9..c943fec3e 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -616,16 +616,11 @@ event_get_target (TplEvent *event) return sender; } -static gboolean parent_found; -static GtkTreeIter model_parent; - static gboolean model_is_parent (GtkTreeModel *model, - GtkTreePath *path, GtkTreeIter *iter, - gpointer data) + TplEvent *event) { - TplEvent *event = data; TplEvent *stored_event; TplEntity *target; TpAccount *account; @@ -659,8 +654,7 @@ model_is_parent (GtkTreeModel *model, if (ABS (tpl_event_get_timestamp (event) - timestamp) < MAX_GAP) { /* The gap is smaller than 30 min */ - model_parent = *iter; - parent_found = found = TRUE; + found = TRUE; } } @@ -692,20 +686,27 @@ get_parent_iter_for_message (TplEvent *event, { GtkTreeStore *store; GtkTreeModel *model; + GtkTreeIter iter; + gboolean parent_found = FALSE; + gboolean next; store = log_window->store_events; model = GTK_TREE_MODEL (store); - parent_found = FALSE; - gtk_tree_model_foreach (model, model_is_parent, event); + for (next = gtk_tree_model_get_iter_first (model, &iter); + next; + next = gtk_tree_model_iter_next (model, &iter)) + { + if ((parent_found = model_is_parent (model, &iter, event))) + break; + } if (parent_found) { - *parent = model_parent; + *parent = iter; } else { - GtkTreeIter iter; GDateTime *date; gchar *body, *pretty_date; |