[empathy/gnome-2-34] Add a empathy_account_chooser_has_all_selected



commit 0e1edc0339c271acada9588f59adc5933d16f4ec
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date:   Tue Mar 15 16:40:01 2011 +0000

    Add a empathy_account_chooser_has_all_selected
    
    So we can know if 'All' is selected in the accounts chooser.

 libempathy-gtk/empathy-account-chooser.c |   24 ++++++++++++++++++++++++
 libempathy-gtk/empathy-account-chooser.h |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/libempathy-gtk/empathy-account-chooser.c b/libempathy-gtk/empathy-account-chooser.c
index f077827..8fdb18e 100644
--- a/libempathy-gtk/empathy-account-chooser.c
+++ b/libempathy-gtk/empathy-account-chooser.c
@@ -284,6 +284,30 @@ empathy_account_chooser_new (void)
 	return chooser;
 }
 
+gboolean
+empathy_account_chooser_has_all_selected (EmpathyAccountChooser *chooser)
+{
+	EmpathyAccountChooserPriv *priv;
+	GtkTreeModel              *model;
+	GtkTreeIter                iter;
+	RowType                    type;
+
+	g_return_val_if_fail (EMPATHY_IS_ACCOUNT_CHOOSER (chooser), FALSE);
+
+	priv = GET_PRIV (chooser);
+
+	g_return_val_if_fail (priv->has_all_option == TRUE, FALSE);
+
+	model = gtk_combo_box_get_model (GTK_COMBO_BOX (chooser));
+	if (!gtk_combo_box_get_active_iter (GTK_COMBO_BOX (chooser), &iter)) {
+		return FALSE;
+	}
+
+	gtk_tree_model_get (model, &iter, COL_ACCOUNT_ROW_TYPE, &type, -1);
+
+	return type == ROW_ALL;
+}
+
 /**
  * empathy_account_chooser_dup_account:
  * @chooser: an #EmpathyAccountChooser
diff --git a/libempathy-gtk/empathy-account-chooser.h b/libempathy-gtk/empathy-account-chooser.h
index dfd372c..08141f4 100644
--- a/libempathy-gtk/empathy-account-chooser.h
+++ b/libempathy-gtk/empathy-account-chooser.h
@@ -84,6 +84,7 @@ gboolean       empathy_account_chooser_set_account        (EmpathyAccountChooser
 gboolean       empathy_account_chooser_get_has_all_option (EmpathyAccountChooser *chooser);
 void           empathy_account_chooser_set_has_all_option (EmpathyAccountChooser *chooser,
 							   gboolean               has_all_option);
+gboolean       empathy_account_chooser_has_all_selected   (EmpathyAccountChooser *chooser);
 void           empathy_account_chooser_set_filter         (EmpathyAccountChooser *chooser,
 							   EmpathyAccountChooserFilterFunc filter,
 							   gpointer               user_data);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]