[ekiga] Reworked the code to decide whether to hide/show offline contacts
- From: Julien Puydt <jpuydt src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] Reworked the code to decide whether to hide/show offline contacts
- Date: Mon, 27 Sep 2010 09:55:00 +0000 (UTC)
commit 0de77fd200815c5c690ccce4ebe9087ee7833cd6
Author: Julien Puydt <jpuydt gnome org>
Date: Mon Sep 27 10:57:36 2010 +0200
Reworked the code to decide whether to hide/show offline contacts
It should be more readable.
lib/engine/gui/gtk-frontend/roster-view-gtk.cpp | 57 +++++++++--------------
1 files changed, 22 insertions(+), 35 deletions(-)
---
diff --git a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
index 8e9f425..fe24704 100644
--- a/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
+++ b/lib/engine/gui/gtk-frontend/roster-view-gtk.cpp
@@ -536,9 +536,6 @@ show_offline_contacts_changed_nt (G_GNUC_UNUSED gpointer id,
{
RosterViewGtk *self = NULL;
GtkTreeModel *model = NULL;
- GtkTreeIter heap_iter;
- GtkTreeIter iter;
- gboolean show_offline_contacts = false;
g_return_if_fail (data != NULL);
@@ -546,31 +543,11 @@ show_offline_contacts_changed_nt (G_GNUC_UNUSED gpointer id,
if (gm_conf_entry_get_type (entry) == GM_CONF_BOOL) {
- show_offline_contacts = gm_conf_entry_get_bool (entry);
- if (show_offline_contacts != self->priv->show_offline_contacts) {
-
- self->priv->show_offline_contacts = show_offline_contacts;
-
- /* beware: model is filtered here */
- model = gtk_tree_view_get_model (self->priv->tree_view);
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
-
- /* beware: model is unfiltered here */
- model = GTK_TREE_MODEL (self->priv->store);
- if (gtk_tree_model_get_iter_first (model, &heap_iter)) {
-
- do {
+ self->priv->show_offline_contacts = gm_conf_entry_get_bool (entry);
- if (gtk_tree_model_iter_nth_child (model, &iter, &heap_iter, 0)) {
-
- do {
-
- update_offline_count (self, &iter);
- } while (gtk_tree_model_iter_next (model, &iter));
- }
- } while (gtk_tree_model_iter_next (model, &heap_iter));
- }
- }
+ /* beware: model is filtered here */
+ model = gtk_tree_view_get_model (self->priv->tree_view);
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (model));
}
}
@@ -728,20 +705,18 @@ group_hide_show_offline (RosterViewGtk* self,
GtkTreeModel* model,
GtkTreeIter* iter)
{
- gboolean result;
- GtkTreeIter child_iter;
+ gboolean result = FALSE;
if (self->priv->show_offline_contacts)
result = TRUE;
else {
+ GtkTreeIter child_iter;
if (gtk_tree_model_iter_nth_child (model, &child_iter, iter, 0)) {
do {
- gtk_tree_model_get (model, &child_iter,
- COLUMN_OFFLINE, &result,
- -1);
+ result = presentity_hide_show_offline (self, model, &child_iter);
} while (!result && gtk_tree_model_iter_next (model, &child_iter));
}
}
@@ -750,13 +725,25 @@ group_hide_show_offline (RosterViewGtk* self,
}
static gboolean
-heap_hide_show_offline (G_GNUC_UNUSED RosterViewGtk* self,
+heap_hide_show_offline (RosterViewGtk* self,
GtkTreeModel* model,
GtkTreeIter* iter)
{
- gboolean result;
+ gboolean result = false;
- result = gtk_tree_model_iter_has_child (model, iter);
+ if (self->priv->show_offline_contacts)
+ result = TRUE;
+ else {
+
+ GtkTreeIter child_iter;
+ if (gtk_tree_model_iter_nth_child (model, &child_iter, iter, 0)) {
+
+ do {
+
+ result = group_hide_show_offline (self, model, &child_iter);
+ } while (!result && gtk_tree_model_iter_next (model, &child_iter));
+ }
+ }
return result;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]