void remmina_tp_channel_handler_new(const gchar *account_path, const gchar *connection_path, const gchar *channel_path,
		GHashTable *channel_properties, DBusGMethodInvocation *context)
{
	TpDBusDaemon *bus;
	TpAccount *account;
	GError *error = NULL;
	RemminaTpChannelHandler *chandler;

	bus = tp_dbus_daemon_dup(&error);
	if (bus == NULL)
	{
		g_print("tp_dbus_daemon_dup: %s", error->message);
		return;
	}
	account = tp_account_new(bus, account_path, &error);
	if (account == NULL)
	{
		g_object_unref(bus);
		g_print("tp_account_new: %s", error->message);
		return;
	}

	chandler = g_new0(RemminaTpChannelHandler, 1);
	chandler->bus = bus;
	chandler->account = account;
	chandler->connection_path = g_strdup(connection_path);
	chandler->channel_path = g_strdup(channel_path);
	chandler->channel_properties = tp_asv_new(NULL, NULL);
	tp_g_hash_table_update(chandler->channel_properties, channel_properties, (GBoxedCopyFunc) g_strdup,
			(GBoxedCopyFunc) tp_g_value_slice_dup);
	chandler->context = context;

	tp_account_prepare_async(account, NULL, remmina_tp_channel_handler_account_ready, chandler);
}
Example #2
0
static void
account_manager_ready_for_accounts_cb (GObject *source_object,
    GAsyncResult *result,
    gpointer user_data)
{
  TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
  const gchar *account_id = (const gchar*) user_data;
  GError *error = NULL;

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

  if (account_id != NULL)
    {
      gchar *account_path;
      TpAccount *account = NULL;
      TpDBusDaemon *bus;

      /* create and prep the corresponding TpAccount so it's fully ready by the
       * time we try to select it in the accounts dialog */
      account_path = g_strdup_printf ("%s%s", TP_ACCOUNT_OBJECT_PATH_BASE,
          account_id);
      bus = tp_dbus_daemon_dup (NULL);
      if ((account = tp_account_new (bus, account_path, &error)))
        {
          tp_account_prepare_async (account, NULL, account_prepare_cb, manager);
          return;
        }
      else
        {
          DEBUG ("Failed to find account with path %s: %s", account_path,
              error->message);
          g_clear_error (&error);
        }

      g_object_unref (bus);
      g_free (account_path);
    }
  else
    {
      if (empathy_import_mc4_has_imported ())
        {
          maybe_show_accounts_ui (manager);
        }
      else
        {
          EmpathyConnectionManagers *cm_mgr =
            empathy_connection_managers_dup_singleton ();

          empathy_connection_managers_prepare_async (
            cm_mgr, cm_manager_prepared_cb, manager);
        }
    }
}