aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk/empathy-log-window.c
diff options
context:
space:
mode:
authorEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-16 21:18:06 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-03-16 21:51:19 +0800
commit3245172e9de4d7eada65f0155c0d5039b3e7b0d6 (patch)
treeb4302acf5c06b7e2f1c43a2194fe8a298f4a579d /libempathy-gtk/empathy-log-window.c
parent7f7ef3c33eba6fbef4c3fdd01503db000d6be41e (diff)
downloadgsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar.gz
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar.bz2
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar.lz
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar.xz
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.tar.zst
gsoc2013-empathy-3245172e9de4d7eada65f0155c0d5039b3e7b0d6.zip
Clear logs: grey out accounts without logs
Diffstat (limited to 'libempathy-gtk/empathy-log-window.c')
-rw-r--r--libempathy-gtk/empathy-log-window.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index df6068448..5e1cc4b52 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -1379,6 +1379,50 @@ log_window_entry_chats_activate_cb (GtkWidget *entry,
}
}
+typedef struct {
+ EmpathyAccountChooserFilterResultCallback callback;
+ gpointer user_data;
+} FilterCallbackData;
+
+static void
+got_entities (GObject *manager,
+ GAsyncResult *result,
+ gpointer user_data)
+{
+ FilterCallbackData *data = user_data;
+ GList *entities;
+ GError *error;
+
+ if (!tpl_log_manager_get_entities_finish (TPL_LOG_MANAGER (manager), result, &entities, &error)) {
+ DEBUG ("Could not get entities: %s", error->message);
+ g_error_free (error);
+ data->callback (FALSE, data->user_data);
+ } else {
+ data->callback (entities != NULL, data->user_data);
+
+ g_list_free_full (entities, g_object_unref);
+ }
+
+ g_slice_free (FilterCallbackData, data);
+}
+
+static void
+empathy_account_chooser_filter_has_logs (TpAccount *account,
+ EmpathyAccountChooserFilterResultCallback callback,
+ gpointer callback_data,
+ gpointer user_data)
+{
+ TplLogManager *manager = tpl_log_manager_dup_singleton ();
+ FilterCallbackData *cb_data = g_slice_new0 (FilterCallbackData);
+
+ cb_data->callback = callback;
+ cb_data->user_data = callback_data;
+
+ tpl_log_manager_get_entities_async (manager, account, got_entities, cb_data);
+
+ g_object_unref (manager);
+}
+
static void
log_window_logger_clear_account_cb (TpProxy *proxy,
const GError *error,
@@ -1417,6 +1461,7 @@ log_window_delete_menu_clicked_cb (GtkMenuItem *menuitem,
account_chooser = (EmpathyAccountChooser *) empathy_account_chooser_new ();
empathy_account_chooser_set_has_all_option (account_chooser, TRUE);
+ empathy_account_chooser_set_filter (account_chooser, empathy_account_chooser_filter_has_logs, NULL);
/* Select the same account as in the history window */
if (empathy_account_chooser_is_ready (account_chooser))