aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-27 19:42:37 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-06-09 19:34:56 +0800
commita5a993d4b067029c8fc6c904762c12aec6740831 (patch)
tree3c1fdd9856dfa9fe1c155849c77bdf0ccb3dc766 /libempathy-gtk
parent716f0dfd75b38a218ce75b854e6e00c075f71cbb (diff)
downloadgsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar.gz
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar.bz2
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar.lz
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar.xz
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.tar.zst
gsoc2013-empathy-a5a993d4b067029c8fc6c904762c12aec6740831.zip
Don't use global variables
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-log-window.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 1f629987e..c56427650 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -617,16 +617,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;
@@ -660,8 +655,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;
}
}
@@ -693,20 +687,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;