NS_IMETHODIMP
csTpConnectionManagerImp::Init(const nsACString& aName)
{
  if (m_Proxy)
    return NS_ERROR_ALREADY_INITIALIZED;

  m_Proxy = tp_connection_manager_new(m_BusDaemon, nsCString(aName).get(), NULL, NULL);
  if (!m_Proxy)
    return NS_ERROR_FAILURE;

  return NS_OK;
}
int
main (int argc,
      char **argv)
{
  TpConnectionManager *cm = NULL;
  GError *error = NULL;
  TpDBusDaemon *dbus = NULL;

  tp_debug_set_flags (g_getenv ("EXAMPLE_DEBUG"));

  example_cli_init ();

  dbus = tp_dbus_daemon_dup (&error);

  if (dbus == NULL)
    {
      g_warning ("%s", error->message);
      g_error_free (error);
      goto out;
    }

  mainloop = g_main_loop_new (NULL, FALSE);

  cm = tp_connection_manager_new (dbus, "example_extended", NULL, &error);

  if (cm == NULL)
    {
      g_warning ("%s", error->message);
      goto out;
    }

  g_signal_connect (cm, "got-info",
      G_CALLBACK (connection_manager_got_info), NULL);

  timer = g_timeout_add (5000, time_out, NULL);

  g_main_loop_run (mainloop);

out:
  if (cm != NULL)
    g_object_unref (cm);

  if (dbus != NULL)
    g_object_unref (dbus);

  if (mainloop != NULL)
    g_main_loop_unref (mainloop);

  return main_ret;
}
int
main (int argc, char **argv)
{
	GError *error = NULL;

	g_type_init ();

	if (argc != 4)
	{
		g_error ("Must provide first name, last name and filename");
	}

	/* create a main loop */
	loop = g_main_loop_new (NULL, FALSE);

	/* acquire a connection to the D-Bus daemon */
	bus_daemon = tp_dbus_daemon_dup (&error);
	if (bus_daemon == NULL)
	{
		g_error ("%s", error->message);
	}

	/* we want to request the salut CM */
	TpConnectionManager *cm = tp_connection_manager_new (bus_daemon,
			"salut", NULL, &error);
	if (error) g_error ("%s", error->message);

	tp_connection_manager_call_when_ready (cm, cm_ready,
			argv, NULL, NULL);

	/* set up a signal handler */
	struct sigaction sa = { 0 };
	sa.sa_handler = interrupt_cb;
	sigaction (SIGINT, &sa, NULL);

	g_main_loop_run (loop);

	g_object_unref (bus_daemon);

	return 0;
}