Ejemplo n.º 1
0
static void
log_window_chats_populate (EmpathyLogWindow *window)
{
	EmpathyAccountChooser *account_chooser;
	TpAccount             *account;

	GtkTreeView          *view;
	GtkTreeModel         *model;
	GtkTreeSelection     *selection;
	GtkListStore         *store;

	account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);
	account = empathy_account_chooser_dup_account (account_chooser);

	view = GTK_TREE_VIEW (window->treeview_chats);
	model = gtk_tree_view_get_model (view);
	selection = gtk_tree_view_get_selection (view);
	store = GTK_LIST_STORE (model);

	if (account == NULL) {
		gtk_list_store_clear (store);
		return;
	}

	/* Block signals to stop the logs being retrieved prematurely */
	g_signal_handlers_block_by_func (selection,
					 log_window_chats_changed_cb,
					 window);

	gtk_list_store_clear (store);

	tpl_log_manager_get_chats_async (window->log_manager, account,
			log_manager_got_chats_cb, (gpointer) window);
}
Ejemplo n.º 2
0
static void
log_window_chats_populate (EmpathyLogWindow *window)
{
	EmpathyAccountChooser *account_chooser;
	TpAccount             *account;
#ifndef ENABLE_TPL
	GList                *chats, *l;
#endif /* ENABLE_TPL */

	GtkTreeView          *view;
	GtkTreeModel         *model;
	GtkTreeSelection     *selection;
	GtkListStore         *store;
#ifndef ENABLE_TPL
	GtkTreeIter           iter;
#endif /* ENABLE_TPL */

	account_chooser = EMPATHY_ACCOUNT_CHOOSER (window->account_chooser_chats);
	account = empathy_account_chooser_dup_account (account_chooser);

	view = GTK_TREE_VIEW (window->treeview_chats);
	model = gtk_tree_view_get_model (view);
	selection = gtk_tree_view_get_selection (view);
	store = GTK_LIST_STORE (model);

	if (account == NULL) {
		gtk_list_store_clear (store);
		return;
	}

	/* Block signals to stop the logs being retrieved prematurely */
	g_signal_handlers_block_by_func (selection,
					 log_window_chats_changed_cb,
					 window);

	gtk_list_store_clear (store);

#ifdef ENABLE_TPL
	tpl_log_manager_get_chats_async (window->log_manager, account,
			log_manager_got_chats_cb, (gpointer) window);
#else
	chats = empathy_log_manager_get_chats (window->log_manager, account);
	for (l = chats; l; l = l->next) {
		EmpathyLogSearchHit *hit;

		hit = l->data;

		gtk_list_store_append (store, &iter);
		gtk_list_store_set (store, &iter,
				    COL_CHAT_ICON, "empathy-available", /* FIXME */
				    COL_CHAT_NAME, hit->chat_id,
				    COL_CHAT_ACCOUNT, account,
				    COL_CHAT_ID, hit->chat_id,
				    COL_CHAT_IS_CHATROOM, hit->is_chatroom,
				    -1);

		/* FIXME: Update COL_CHAT_ICON/NAME */
		if (hit->is_chatroom) {
		} else {
		}
	}
	empathy_log_manager_search_free (chats);

	/* Unblock signals */
	g_signal_handlers_unblock_by_func (selection,
					   log_window_chats_changed_cb,
					   window);


	g_object_unref (account);
#endif /* ENABLE_TPL */
}