Exemple #1
0
static UniqueResponse
unique_app_message_cb (UniqueApp *unique_app,
    gint command,
    UniqueMessageData *data,
    guint timestamp,
    gpointer user_data)
{
  DEBUG ("Other instance launched, presenting the main window. "
      "Command=%d, timestamp %u", command, timestamp);

  if (command == UNIQUE_ACTIVATE)
    {
      TpAccountManager *account_manager;

      account_manager = tp_account_manager_dup ();

      empathy_accounts_show_accounts_ui (account_manager, NULL,
          G_CALLBACK (gtk_main_quit));

      g_object_unref (account_manager);
    }
  else
    {
      g_warning (G_STRLOC "unhandled unique app command %d", command);

      return UNIQUE_RESPONSE_PASSTHROUGH;
    }

  return UNIQUE_RESPONSE_OK;
}
static void
maybe_show_accounts_ui (TpAccountManager *manager)
{
  if (hidden ||
      (only_if_needed && empathy_accounts_has_non_salut_accounts (manager)))
    gtk_main_quit ();
  else
    empathy_accounts_show_accounts_ui (manager, NULL, gtk_main_quit);
}
Exemple #3
0
static void
account_manager_ready_for_accounts_cb (GObject *source_object,
    GAsyncResult *result,
    gpointer user_data)
{
  TpAccountManager *manager = TP_ACCOUNT_MANAGER (source_object);
  GError *error = NULL;
  GApplication *app = G_APPLICATION (user_data);

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

  if (selected_account_name != NULL)
    {
      gchar *account_path;
      TpAccount *account;

      /* create and prep the corresponding TpAccount so it's fully ready by the
       * time we try to select it in the accounts dialog */
      if (g_str_has_prefix (selected_account_name, TP_ACCOUNT_OBJECT_PATH_BASE))
        account_path = g_strdup (selected_account_name);
      else
        account_path = g_strdup_printf ("%s%s", TP_ACCOUNT_OBJECT_PATH_BASE,
            selected_account_name);

      account = find_account (manager, account_path);

      if (account != NULL)
        {
          empathy_accounts_show_accounts_ui (manager, account, app);
          goto out;
        }
      else
        {
          DEBUG ("Failed to find account with path %s", account_path);

          g_clear_error (&error);

          maybe_show_accounts_ui (manager, app);
        }

      g_free (account_path);
    }
  else
    {
      maybe_show_accounts_ui (manager, app);
    }

out:
  g_application_release (app);
}
Exemple #4
0
static void
maybe_show_accounts_ui (TpAccountManager *manager,
    GApplication *app)
{
  if (hidden)
    return;

  if (only_if_needed && empathy_accounts_has_non_salut_accounts (manager))
    return;

  empathy_accounts_show_accounts_ui (manager, NULL, app);
}
static void
account_prepare_cb (GObject *source_object,
    GAsyncResult *result,
    gpointer user_data)
{
  TpAccountManager *manager = TP_ACCOUNT_MANAGER (user_data);
  TpAccount *account = TP_ACCOUNT (source_object);
  GError *error = NULL;

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

      account = NULL;
    }

  empathy_accounts_show_accounts_ui (manager, account,
      G_CALLBACK (gtk_main_quit));
}
static int
app_command_line_cb (GApplication *app,
    GApplicationCommandLine *cmdline)
{
  g_application_hold (app);

  /* if the window is ready, present it; otherwise, it will be presented when
   * the accounts manager is prepared */
  if (account_manager_prepared)
    {
      TpAccountManager *account_manager;

      account_manager = tp_account_manager_dup ();
      empathy_accounts_show_accounts_ui (account_manager, NULL,
              G_CALLBACK (gtk_main_quit));

      g_object_unref (account_manager);
    }

  return 0;
}