Ejemplo n.º 1
0
static void
account_chooser_account_created_cb (EmpathyAccountManager *manager,
				    EmpathyAccount        *account,
				    EmpathyAccountChooser *chooser)
{
	account_chooser_account_add_foreach (account, chooser);
}
static void
account_manager_prepared_cb (GObject *source_object,
			     GAsyncResult *result,
			     gpointer user_data)
{
	GList *accounts, *l;
	TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
	EmpathyAccountChooser *chooser = user_data;
	EmpathyAccountChooserPriv *priv = GET_PRIV (chooser);
	GError *error = NULL;

	if (!tp_account_manager_prepare_finish (manager, result, &error)) {
		DEBUG ("Failed to prepare account manager: %s", error->message);
		g_error_free (error);
		return;
	}

	accounts = tp_account_manager_get_valid_accounts (manager);

	for (l = accounts; l != NULL; l = l->next) {
		TpAccount *account = l->data;

		account_chooser_account_add_foreach (account, chooser);

		tp_g_signal_connect_object (account, "status-changed",
					     G_CALLBACK (account_chooser_status_changed_cb),
					     chooser, 0);
	}

	g_list_free (accounts);

	priv->ready = TRUE;
	g_signal_emit (chooser, signals[READY], 0);
}
Ejemplo n.º 3
0
static void
account_chooser_account_created_cb (McAccountMonitor     *monitor,
				    const gchar          *unique_name,
				    EmpathyAccountChooser *chooser)
{
	McAccount *account;

	account = mc_account_lookup (unique_name);
	account_chooser_account_add_foreach (account, chooser);
	g_object_unref (account);
}
Ejemplo n.º 4
0
static void
account_chooser_account_validity_changed_cb (TpAccountManager *manager,
    TpAccount *account,
    gboolean valid,
    EmpathyAccountChooser *self)
{
  if (valid)
    account_chooser_account_add_foreach (account, self);
  else
    account_chooser_account_remove_foreach (account, self);
}
Ejemplo n.º 5
0
static void
account_manager_prepared_cb (GObject *source_object,
    GAsyncResult *result,
    gpointer user_data)
{
  GList *accounts, *l;
  TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
  EmpathyAccountChooser *self = user_data;
  GError *error = NULL;

  if (!tp_proxy_prepare_finish (manager, result, &error))
    {
      DEBUG ("Failed to prepare account manager: %s", error->message);
      g_error_free (error);
      return;
    }

  accounts = tp_account_manager_dup_valid_accounts (manager);

  for (l = accounts; l != NULL; l = l->next)
    {
      TpAccount *account = l->data;

      account_chooser_account_add_foreach (account, self);

      tp_g_signal_connect_object (account, "status-changed",
          G_CALLBACK (account_chooser_status_changed_cb),
          self, 0);

      /* We generally use the TpConnection from the account to filter it so,
       * just relying on the account status is not enough. In some case we the
       * status change can be notified while the TpConnection is still
       * preparing. */
      tp_g_signal_connect_object (account, "notify::connection",
          G_CALLBACK (account_connection_notify_cb),
          self, 0);
    }

  g_list_free_full (accounts, g_object_unref);

  if (self->priv->select_when_ready != NULL)
    {
      select_account (self, self->priv->select_when_ready);

      g_clear_object (&self->priv->select_when_ready);
    }

  self->priv->ready = TRUE;
  g_signal_emit (self, signals[READY], 0);
}