Пример #1
0
static void
empathy_account_chooser_init (EmpathyAccountChooser *self)
{
  TpSimpleClientFactory *factory;

  self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self,
    EMPATHY_TYPE_ACCOUNT_CHOOSER, EmpathyAccountChooserPriv);

  self->priv->set_active_item = FALSE;
  self->priv->account_manually_set = FALSE;
  self->priv->filter = NULL;
  self->priv->filter_data = NULL;

  self->priv->manager = tp_account_manager_dup ();

  tp_g_signal_connect_object (self->priv->manager, "account-validity-changed",
      G_CALLBACK (account_chooser_account_validity_changed_cb), self, 0);

  tp_g_signal_connect_object (self->priv->manager, "account-removed",
      G_CALLBACK (account_chooser_account_removed_cb), self, 0);

  /* Make sure we'll have the capabilities feature on TpAccount's connection */
  factory = tp_proxy_get_factory (self->priv->manager);

  tp_simple_client_factory_add_account_features_varargs (factory,
      TP_ACCOUNT_FEATURE_CONNECTION, NULL);
  tp_simple_client_factory_add_connection_features_varargs (factory,
      TP_CONNECTION_FEATURE_CAPABILITIES, NULL);
}
Пример #2
0
int
main (int argc,
    char **argv)
{
  GOptionContext *context;
  GError *error = NULL;
  EmpathyAuthFactory *factory;
  TpDebugSender *debug_sender;
  TpSimpleClientFactory *tp_factory;
  TpDBusDaemon *dbus;

  context = g_option_context_new (N_(" — Empathy authentication client"));
  g_option_context_add_group (context, gtk_get_option_group (TRUE));
  g_option_context_set_translation_domain (context, GETTEXT_PACKAGE);

  if (!g_option_context_parse (context, &argc, &argv, &error))
    {
      g_print ("%s\nRun '%s --help' to see a full list of available command "
          "line options.\n", error->message, argv[0]);
      g_warning ("Error in empathy-auth-client init: %s", error->message);
      return EXIT_FAILURE;
    }

  g_option_context_free (context);

  empathy_gtk_init ();
  gnutls_global_init ();
  g_set_application_name (_("Empathy authentication client"));

  /* Make empathy and empathy-auth-client appear as the same app in
   * gnome-shell */
  g_set_prgname ("empathy");
  gtk_window_set_default_icon_name ("empathy");
  textdomain (GETTEXT_PACKAGE);

  /* There is no 'main' UI window so just use the default GdkScreen */
  empathy_set_css_provider (NULL);

#ifdef ENABLE_DEBUG
  /* Set up debug sender */
  debug_sender = tp_debug_sender_dup ();
  g_log_set_default_handler (tp_debug_sender_log_handler, G_LOG_DOMAIN);
#endif

  dbus = tp_dbus_daemon_dup (NULL);
  tp_factory = tp_simple_client_factory_new (dbus);
  tp_simple_client_factory_add_account_features_varargs (tp_factory,
      TP_ACCOUNT_FEATURE_STORAGE,
      0);

  factory = empathy_auth_factory_new (tp_factory);
  g_object_unref (tp_factory);
  g_object_unref (dbus);

  g_signal_connect (factory, "new-server-tls-handler",
      G_CALLBACK (auth_factory_new_tls_handler_cb), NULL);

  g_signal_connect (factory, "new-server-sasl-handler",
      G_CALLBACK (auth_factory_new_sasl_handler_cb), NULL);

  g_signal_connect (factory, "auth-password-failed",
      G_CALLBACK (auth_factory_auth_passsword_failed), NULL);

  if (!empathy_auth_factory_register (factory, &error))
    {
      g_critical ("Failed to register the auth factory: %s\n", error->message);
      g_error_free (error);
      g_object_unref (factory);

      return EXIT_FAILURE;
    }

  DEBUG ("Empathy auth client started.");

  if (g_getenv ("EMPATHY_PERSIST") != NULL)
    {
      DEBUG ("Timed-exit disabled");

      use_timer = FALSE;
    }

  /* Wait for the migration code to be done before starting the timer */
  empathy_sanity_checking_run_async (sanity_cb, NULL);

  gtk_main ();

  g_object_unref (factory);
  g_object_unref (debug_sender);

  return EXIT_SUCCESS;
}