/* handle all navigation externally */
g_signal_connect (self->priv->webview, "navigation-policy-decision-requested",
G_CALLBACK (events_webview_handle_navigation), self);
/* listen to changes to the treemodel */
g_signal_connect (self->priv->store_events, "row-inserted",
G_CALLBACK (store_events_row_inserted), self);
g_signal_connect (self->priv->store_events, "row-changed",
G_CALLBACK (store_events_row_changed), self);
g_signal_connect (self->priv->store_events, "row-deleted",
G_CALLBACK (store_events_row_deleted), self);
g_signal_connect (self->priv->store_events, "rows-reordered",
G_CALLBACK (store_events_rows_reordered), self);
g_signal_connect (self->priv->store_events, "row-has-child-toggled",
G_CALLBACK (store_events_has_child_rows), self);
/* track clicked row */
g_signal_connect (self->priv->webview, "button-press-event",
G_CALLBACK (log_window_events_button_press_event), self);
log_window_update_buttons_sensitivity (self);
gtk_widget_show (GTK_WIDGET (self));
}
static void
log_window_who_populate (EmpathyLogWindow *self)
{
EmpathyAccountChooser *account_chooser;
TpAccount *account;
gboolean all_accounts;
GtkTreeView *view;
GtkTreeModel *model;
GtkTreeSelection *selection;
GtkListStore *store;
Ctx *ctx;
if (self->priv->hits != NULL)
{
populate_entities_from_search_hits ();
return;
}
account_chooser = EMPATHY_ACCOUNT_CHOOSER (self->priv->account_chooser);
account = empathy_account_chooser_dup_account (account_chooser);
all_accounts = empathy_account_chooser_has_all_selected (account_chooser);
view = GTK_TREE_VIEW (self->priv->treeview_who);
model = gtk_tree_view_get_model (view);
selection = gtk_tree_view_get_selection (view);
store = GTK_LIST_STORE (model);
/* Block signals to stop the logs being retrieved prematurely */
g_signal_handlers_block_by_func (selection,
log_window_who_changed_cb,
self);
gtk_list_store_clear (store);
/* Unblock signals */
g_signal_handlers_unblock_by_func (selection,
log_window_who_changed_cb,
self);
_tpl_action_chain_clear (self->priv->chain);
self->priv->count++;
if (!all_accounts && account == NULL)
{
return;
}
else if (!all_accounts)
{
ctx = ctx_new (self, account, NULL, NULL, 0, 0, self->priv->count);
_tpl_action_chain_append (self->priv->chain, get_entities_for_account, ctx);
}
else
{
TpAccountManager *manager;
GList *accounts, *l;
manager = empathy_account_chooser_get_account_manager (account_chooser);
accounts = tp_account_manager_get_valid_accounts (manager);
for (l = accounts; l != NULL; l = l->next)
{
account = l->data;
ctx = ctx_new (self, account, NULL, NULL, 0, 0, self->priv->count);
_tpl_action_chain_append (self->priv->chain,
get_entities_for_account, ctx);
}
g_list_free (accounts);
}
_tpl_action_chain_append (self->priv->chain, select_first_entity, self);
_tpl_action_chain_start (self->priv->chain);
}
static void
log_window_update_what_sensitivity (EmpathyLogWindow *self)
{
GtkTreeView *view;
GtkTreeModel *model;
GtkTreeIter iter;
GList *accounts, *targets, *acc, *targ;
gboolean next;
if (!log_window_get_selected (self, &accounts, &targets, NULL, NULL,
NULL, NULL))
return;
view = GTK_TREE_VIEW (self->priv->treeview_what);
model = gtk_tree_view_get_model (view);
/* For each event type... */
for (next = gtk_tree_model_get_iter_first (model, &iter);
next;
next = gtk_tree_model_iter_next (model, &iter))
{
TplEventTypeMask type;
gtk_tree_model_get (model, &iter,
COL_WHAT_TYPE, &type,
-1);
/* ...we set the type and its subtypes (if any) unsensitive... */
log_window_update_what_iter_sensitivity (model, &iter, FALSE);