From 96700e661de46701033c4fc2654f7ca2683d3657 Mon Sep 17 00:00:00 2001 From: Xavier Claessens Date: Fri, 30 Jan 2009 17:33:59 +0000 Subject: [PATCH] move get blank iter function svn path=/trunk/; revision=2321 --- libempathy-gtk/empathy-contact-selector.c | 66 +++++++++++------------ 1 file changed, 32 insertions(+), 34 deletions(-) diff --git a/libempathy-gtk/empathy-contact-selector.c b/libempathy-gtk/empathy-contact-selector.c index 09ebb2d6..8d93b6f4 100644 --- a/libempathy-gtk/empathy-contact-selector.c +++ b/libempathy-gtk/empathy-contact-selector.c @@ -50,8 +50,6 @@ struct _EmpathyContactSelectorPriv }; static void changed_cb (GtkComboBox *widget, gpointer data); -static gboolean get_iter_for_blank_contact (GtkTreeStore *store, - GtkTreeIter *blank_iter); EmpathyContact * @@ -71,6 +69,38 @@ empathy_contact_selector_get_selected (EmpathyContactSelector *selector) } +static gboolean +get_iter_for_blank_contact (GtkTreeStore *store, + GtkTreeIter *blank_iter) +{ + GtkTreePath *path; + GtkTreeIter tmp_iter; + EmpathyContact *tmp_contact; + gboolean is_present = FALSE; + + path = gtk_tree_path_new_first (); + if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &tmp_iter, path)) + { + do + { + 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)); + } + + gtk_tree_path_free (path); + + return is_present; +} + + static void set_blank_contact (EmpathyContactSelector *selector) { @@ -157,38 +187,6 @@ changed_cb (GtkComboBox *widget, } -static gboolean -get_iter_for_blank_contact (GtkTreeStore *store, - GtkTreeIter *blank_iter) -{ - GtkTreePath *path; - GtkTreeIter tmp_iter; - EmpathyContact *tmp_contact; - gboolean is_present = FALSE; - - path = gtk_tree_path_new_first (); - if (gtk_tree_model_get_iter (GTK_TREE_MODEL (store), &tmp_iter, path)) - { - do - { - 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)); - } - - gtk_tree_path_free (path); - - return is_present; -} - - static void empathy_store_row_changed_cb (EmpathyContactListStore *empathy_store, GtkTreePath *empathy_path, -- 2.39.2