aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-25 22:25:19 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-08-25 22:25:19 +0800
commit0ead72dafcd03ac8db7b854cf883bea7a8394616 (patch)
tree0dcf3a9e4cbe1a247295d9636ed197cb3b501f3a
parent98318894ea8217020e29be42b2cae209831b179c (diff)
downloadgsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar.gz
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar.bz2
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar.lz
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar.xz
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.tar.zst
gsoc2013-empathy-0ead72dafcd03ac8db7b854cf883bea7a8394616.zip
factor out iter_to_filter_iter()
-rw-r--r--libempathy-gtk/empathy-irc-network-chooser-dialog.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/libempathy-gtk/empathy-irc-network-chooser-dialog.c b/libempathy-gtk/empathy-irc-network-chooser-dialog.c
index 655c6776b..b51a32e9d 100644
--- a/libempathy-gtk/empathy-irc-network-chooser-dialog.c
+++ b/libempathy-gtk/empathy-irc-network-chooser-dialog.c
@@ -218,6 +218,19 @@ select_iter (EmpathyIrcNetworkChooserDialog *self,
}
}
+static GtkTreeIter
+iter_to_filter_iter (EmpathyIrcNetworkChooserDialog *self,
+ GtkTreeIter *iter)
+{
+ EmpathyIrcNetworkChooserDialogPriv *priv = GET_PRIV (self);
+ GtkTreeIter filter_iter;
+
+ g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (priv->filter,
+ &filter_iter, iter));
+
+ return filter_iter;
+}
+
static void
fill_store (EmpathyIrcNetworkChooserDialog *self)
{
@@ -239,11 +252,7 @@ fill_store (EmpathyIrcNetworkChooserDialog *self)
if (network == priv->network)
{
- GtkTreeIter filter_iter;
-
- /* Convert to a filter iter */
- g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (
- priv->filter, &filter_iter, &iter));
+ GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
select_iter (self, &filter_iter, FALSE);
}
@@ -272,10 +281,7 @@ irc_network_dialog_destroy_cb (GtkWidget *widget,
gtk_list_store_set (GTK_LIST_STORE (priv->store), &iter,
COL_NETWORK_NAME, empathy_irc_network_get_name (network), -1);
- /* Convert to a filter iter */
- g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (priv->filter,
- &filter_iter, &iter));
-
+ filter_iter = iter_to_filter_iter (self, &iter);
scroll_to_iter (self, &filter_iter);
g_object_unref (network);
@@ -322,10 +328,7 @@ add_network (EmpathyIrcNetworkChooserDialog *self)
COL_NETWORK_NAME, empathy_irc_network_get_name (network),
-1);
- /* Convert to a filter iter */
- g_assert (gtk_tree_model_filter_convert_child_iter_to_iter (priv->filter,
- &filter_iter, &iter));
-
+ filter_iter = iter_to_filter_iter (self, &iter);
select_iter (self, &filter_iter, TRUE);
display_irc_network_dialog (self, network);
@@ -351,7 +354,11 @@ remove_network (EmpathyIrcNetworkChooserDialog *self)
/* Select next network */
if (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter))
- select_iter (self, &iter, TRUE);
+ {
+ GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter);
+
+ select_iter (self, &filter_iter, TRUE);
+ }
g_object_unref (network);
}