diff options
author | Felix Kaser <f.kaser@gmx.net> | 2010-08-26 20:52:23 +0800 |
---|---|---|
committer | Felix Kaser <f.kaser@gmx.net> | 2010-08-26 20:52:23 +0800 |
commit | 7a0749f54ef5cb3ef3074940f08753c53e53de37 (patch) | |
tree | 268b49f00f55218e2999f5d46eafc25a6035a04b | |
parent | 2de3bc4c03f97f1ceea44f43a1b86dedcb7e6893 (diff) | |
download | gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar.gz gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar.bz2 gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar.lz gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar.xz gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.tar.zst gsoc2013-empathy-7a0749f54ef5cb3ef3074940f08753c53e53de37.zip |
fix selection problems in irc networks
-rw-r--r-- | libempathy-gtk/empathy-irc-network-chooser-dialog.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/libempathy-gtk/empathy-irc-network-chooser-dialog.c b/libempathy-gtk/empathy-irc-network-chooser-dialog.c index c1335e539..a42c21f19 100644 --- a/libempathy-gtk/empathy-irc-network-chooser-dialog.c +++ b/libempathy-gtk/empathy-irc-network-chooser-dialog.c @@ -356,17 +356,33 @@ remove_network (EmpathyIrcNetworkChooserDialog *self) DEBUG ("Remove network %s", empathy_irc_network_get_name (network)); - gtk_list_store_remove (priv->store, &iter); - empathy_irc_network_manager_remove (priv->network_manager, network); - - /* Select next network */ - if (gtk_tree_model_iter_next (GTK_TREE_MODEL (priv->store), &iter)) + /* Delete network and select next network */ + if (gtk_list_store_remove (priv->store, &iter)) { GtkTreeIter filter_iter = iter_to_filter_iter (self, &iter); select_iter (self, &filter_iter, TRUE); } + else + { + /* this should only happen if the last network was deleted */ + GtkTreeIter last, filter_iter; + gint n_elements; + + n_elements = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (priv->store), + NULL); + + if (n_elements > 0) + { + gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (priv->store), &last, + NULL, (n_elements-1)); + filter_iter = iter_to_filter_iter (self, &last); + select_iter (self, &filter_iter, TRUE); + } + } + + empathy_irc_network_manager_remove (priv->network_manager, network); gtk_widget_grab_focus (priv->treeview); g_object_unref (network); |