empathy r2349 - trunk/libempathy-gtk
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2349 - trunk/libempathy-gtk
- Date: Fri, 30 Jan 2009 17:35:18 +0000 (UTC)
Author: xclaesse
Date: Fri Jan 30 17:35:18 2009
New Revision: 2349
URL: http://svn.gnome.org/viewvc/empathy?rev=2349&view=rev
Log:
Simplified loops in contact_selector_get_{number_online_contacts,iter_for_blank_contact}.
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
Modified:
trunk/libempathy-gtk/empathy-contact-selector.c
Modified: trunk/libempathy-gtk/empathy-contact-selector.c
==============================================================================
--- trunk/libempathy-gtk/empathy-contact-selector.c (original)
+++ trunk/libempathy-gtk/empathy-contact-selector.c Fri Jan 30 17:35:18 2009
@@ -56,17 +56,16 @@
GtkTreeIter tmp_iter;
gboolean is_online;
guint number_online_contacts = 0;
+ gboolean ok;
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &tmp_iter))
+ for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &tmp_iter);
+ ok; ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &tmp_iter))
{
- do
- {
- gtk_tree_model_get (GTK_TREE_MODEL (store),
- &tmp_iter, EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE,
- &is_online, -1);
- if (is_online)
- number_online_contacts++;
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &tmp_iter));
+ gtk_tree_model_get (GTK_TREE_MODEL (store),
+ &tmp_iter, EMPATHY_CONTACT_LIST_STORE_COL_IS_ONLINE,
+ &is_online, -1);
+ if (is_online)
+ number_online_contacts++;
}
return number_online_contacts;
@@ -79,21 +78,20 @@
GtkTreeIter tmp_iter;
EmpathyContact *tmp_contact;
gboolean is_present = FALSE;
+ gboolean ok;
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &tmp_iter))
+ for (ok = gtk_tree_model_get_iter_first (GTK_TREE_MODEL (store), &tmp_iter);
+ ok; ok = gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &tmp_iter))
{
- do
+ gtk_tree_model_get (GTK_TREE_MODEL (store),
+ &tmp_iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT,
+ &tmp_contact, -1);
+ if (tmp_contact == NULL)
{
- gtk_tree_model_get (GTK_TREE_MODEL (store),
- &tmp_iter, EMPATHY_CONTACT_LIST_STORE_COL_CONTACT,
- &tmp_contact, -1);
- if (tmp_contact == NULL)
- {
- *blank_iter = tmp_iter;
- is_present = TRUE;
- break;
- }
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (store), &tmp_iter));
+ *blank_iter = tmp_iter;
+ is_present = TRUE;
+ break;
+ }
}
return is_present;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]