示例#1
0
static void
account_assistant_apply_account_cb (GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  GError *error = NULL;
  EmpathyAccountAssistant *self = user_data;
  EmpathyAccountAssistantPriv *priv = GET_PRIV (self);
  EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source);
  EmpathyAccount *account;

  empathy_account_settings_apply_finish (settings, result, &error);

  priv->is_creating = FALSE;

  if (error != NULL)
    {
      account_assistant_present_error_page (self, error,
          gtk_assistant_get_current_page (GTK_ASSISTANT (self)));
      g_error_free (error);
      return;
    }

  /* enable the newly created account */
  account = empathy_account_settings_get_account (settings);
  empathy_account_set_enabled_async (account, TRUE,
      account_assistant_account_enabled_cb, self);
}
示例#2
0
static void
empathy_account_set_property (GObject *object,
    guint prop_id,
    const GValue *value,
    GParamSpec *pspec)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (object);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  switch (prop_id)
    {
      case PROP_ENABLED:
        empathy_account_set_enabled_async (account,
            g_value_get_boolean (value), NULL, NULL);
        break;
      case PROP_UNIQUE_NAME:
        priv->unique_name = g_value_dup_string (value);
        break;
      case PROP_DBUS_DAEMON:
        priv->dbus = g_value_get_object (value);
        break;
      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
示例#3
0
static void
account_widget_applied_cb (GObject *source_object,
    GAsyncResult *res,
    gpointer user_data)
{
  GError *error = NULL;
  EmpathyAccount *account;
  EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object);
  EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);
  EmpathyAccountWidgetPriv *priv = GET_PRIV (widget);

  empathy_account_settings_apply_finish (settings, res, &error);

  if (error != NULL)
    {
      DEBUG ("Could not apply changes to account: %s", error->message);
      g_error_free (error);
      return;
    }

  account = empathy_account_settings_get_account (priv->settings);

  if (account != NULL)
    {
      if (priv->creating_account)
        {
          /* By default, when an account is created, we enable it. */
          empathy_account_set_enabled_async (account, TRUE,
              account_widget_account_enabled_cb, widget);
        }
      else if (priv->enabled_checkbox != NULL)
        {
          gboolean enabled_checked;

          enabled_checked =
#ifndef HAVE_MOBLIN
            gtk_toggle_button_get_active (
                GTK_TOGGLE_BUTTON (priv->enabled_checkbox));
#else
            nbtk_gtk_light_switch_get_active (
                NBTK_GTK_LIGHT_SWITCH (priv->enabled_checkbox));
#endif

          if (empathy_account_is_enabled (account) && enabled_checked)
            {
              /* After having applied changes to a user account, we
               * automatically reconnect it. This is done so the new
               * information entered by the user is validated on the server. */
              empathy_account_reconnect_async (account, NULL, NULL);
            }
        }
    }

  account_widget_set_control_buttons_sensitivity (widget, FALSE);
}
示例#4
0
account_widget_switch_flipped_cb (NbtkGtkLightSwitch *sw,
    gboolean state,
    gpointer user_data)
#endif /* HAVE_MOBLIN */
{
  EmpathyAccountWidgetPriv *priv = GET_PRIV (user_data);
  EmpathyAccount *account;
#ifndef HAVE_MOBLIN
  gboolean state;

  state = gtk_toggle_button_get_active (toggle_button);
#endif

  account = empathy_account_settings_get_account (priv->settings);

  /* Enable the account according to the value of the "Enabled" checkbox */
  empathy_account_set_enabled_async (account, state, NULL, NULL);
}