From 86f71b05736651fe61a63faace83b9599055c181 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Mon, 25 Apr 2011 10:02:04 +0100 Subject: Make 'Anyone' work --- libempathy-gtk/empathy-log-window.c | 48 +++++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 4 deletions(-) (limited to 'libempathy-gtk') diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c index 99d2cd29e..e41049d5a 100644 --- a/libempathy-gtk/empathy-log-window.c +++ b/libempathy-gtk/empathy-log-window.c @@ -792,6 +792,44 @@ log_window_append_message (TplEvent *event, DEBUG ("Message type not handled"); } +static void +add_all_accounts_and_entities (GList **accounts, + GList **entities) +{ + GtkTreeView *view; + GtkTreeModel *model; + GtkTreeIter iter; + + view = GTK_TREE_VIEW (log_window->treeview_who); + model = gtk_tree_view_get_model (view); + + if (!gtk_tree_model_get_iter_first (model, &iter)) + return; + + do + { + TpAccount *account; + TplEntity *entity; + gint type; + + gtk_tree_model_get (model, &iter, + COL_WHO_ACCOUNT, &account, + COL_WHO_TARGET, &entity, + COL_WHO_TYPE, &type, + -1); + + if (type != COL_TYPE_NORMAL) + continue; + + if (accounts != NULL) + *accounts = g_list_append (*accounts, account); + + if (entities != NULL) + *entities = g_list_append (*entities, entity); + } + while (gtk_tree_model_iter_next (model, &iter)); +} + static gboolean log_window_get_selected (EmpathyLogWindow *window, GList **accounts, @@ -836,8 +874,12 @@ log_window_get_selected (EmpathyLogWindow *window, COL_WHO_TYPE, &type, -1); - if (type != COL_TYPE_NORMAL) - continue; + if (type == COL_TYPE_ANY) + { + if (accounts != NULL || entities != NULL) + add_all_accounts_and_entities (accounts, entities); + break; + } if (accounts != NULL) *accounts = g_list_append (*accounts, g_object_ref (account)); @@ -2375,8 +2417,6 @@ log_window_chats_get_messages (EmpathyLogWindow *window, } _tpl_action_chain_append (window->chain, select_first_date, NULL); _tpl_action_chain_start (window->chain); - - /* FIXME: get dates for all entities when 'Anyone' ? */ } else { -- cgit v1.2.3