Esempio n. 1
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;
    }
}
Esempio n. 2
0
static void
status_icon_set_visibility (EmpathyStatusIcon *icon,
			    gboolean           visible,
			    gboolean           store)
{
	EmpathyStatusIconPriv *priv = GET_PRIV (icon);

	if (store) {
		empathy_conf_set_bool (empathy_conf_get (),
				       EMPATHY_PREFS_UI_MAIN_WINDOW_HIDDEN, !visible);
	}

	if (!visible) {
		empathy_window_iconify (priv->window, priv->icon);
	} else {
		GList *accounts;
		GList *l;
		gboolean one_enabled = FALSE;

		empathy_window_present (GTK_WINDOW (priv->window), TRUE);

		/* Show the accounts dialog if there is no enabled accounts */
		accounts = empathy_account_manager_dup_accounts (priv->account_manager);
		for (l = accounts ; l != NULL ; l = g_list_next (l)) {
			one_enabled = empathy_account_is_enabled (EMPATHY_ACCOUNT (l->data))
				|| one_enabled;
			g_object_unref (l->data);
		}
		g_list_free (accounts);
		if (!one_enabled) {
			DEBUG ("No enabled account, Showing account dialog");
			empathy_accounts_dialog_show (GTK_WINDOW (priv->window), NULL);
		}
	}
}
Esempio n. 3
0
static void
empathy_account_constructed (GObject *object)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (object);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  priv->account = tp_account_new (priv->dbus, priv->unique_name, NULL);

  g_signal_connect (priv->account, "invalidated",
    G_CALLBACK (account_invalidated_cb), object);

  empathy_account_parse_unique_name (priv->unique_name,
    &(priv->proto_name), &(priv->cm_name));

  priv->icon_name = empathy_protocol_icon_name (priv->proto_name);

  tp_cli_account_connect_to_account_property_changed (priv->account,
    empathy_account_properties_changed,
    NULL, NULL, object, NULL);

  tp_cli_account_connect_to_removed (priv->account,
    empathy_account_removed_cb,
    NULL, NULL, object, NULL);

  empathy_account_refresh_properties (account);
}
Esempio n. 4
0
EmpathyAccount *
empathy_account_new (TpDBusDaemon *dbus,
    const gchar *unique_name)
{
  return EMPATHY_ACCOUNT (g_object_new (EMPATHY_TYPE_ACCOUNT,
    "dbus-daemon", dbus,
    "unique-name", unique_name,
    NULL));
}
Esempio n. 5
0
static void
empathy_account_get_property (GObject *object,
    guint prop_id,
    GValue *value,
    GParamSpec *pspec)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (object);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  switch (prop_id)
    {
      case PROP_ENABLED:
        g_value_set_boolean (value, priv->enabled);
        break;
      case PROP_READY:
        g_value_set_boolean (value, priv->ready);
        break;
      case PROP_PRESENCE:
        g_value_set_uint (value, priv->presence);
        break;
      case PROP_STATUS:
        g_value_set_string (value, priv->status);
        break;
      case PROP_STATUS_MESSAGE:
        g_value_set_string (value, priv->message);
        break;
      case PROP_CONNECTION_STATUS:
        g_value_set_uint (value, priv->connection_status);
        break;
      case PROP_CONNECTION_STATUS_REASON:
        g_value_set_uint (value, priv->reason);
        break;
      case PROP_CONNECTION:
        g_value_set_object (value,
            empathy_account_get_connection (account));
        break;
      case PROP_UNIQUE_NAME:
        g_value_set_string (value,
            empathy_account_get_unique_name (account));
        break;
      case PROP_DISPLAY_NAME:
        g_value_set_string (value,
            empathy_account_get_display_name (account));
        break;
      case PROP_DBUS_DAEMON:
        g_value_set_object (value, priv->dbus);
        break;
      default:
        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
        break;
    }
}
Esempio n. 6
0
static void
account_invalidated_cb (TpProxy *proxy, guint domain, gint code,
  gchar *message, gpointer user_data)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (user_data);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  if (priv->removed)
    return;

  priv->removed = TRUE;

  g_signal_emit (account, signals[REMOVED], 0);
}
Esempio n. 7
0
static void
empathy_account_properties_changed (TpAccount *proxy,
    GHashTable *properties,
    gpointer user_data,
    GObject *weak_object)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (weak_object);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  if (!priv->ready)
    return;

  empathy_account_update (account, properties);
}
Esempio n. 8
0
static void
empathy_account_removed_cb (TpAccount *proxy,
    gpointer user_data,
    GObject *weak_object)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (weak_object);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  if (priv->removed)
    return;

  priv->removed = TRUE;

  g_signal_emit (account, signals[REMOVED], 0);
}
Esempio n. 9
0
void
empathy_account_dispose (GObject *object)
{
  EmpathyAccount *self = EMPATHY_ACCOUNT (object);
  EmpathyAccountPriv *priv = GET_PRIV (self);

  if (priv->dispose_has_run)
    return;

  priv->dispose_has_run = TRUE;

  empathy_account_free_connection (self);

  /* release any references held by the object here */
  if (G_OBJECT_CLASS (empathy_account_parent_class)->dispose != NULL)
    G_OBJECT_CLASS (empathy_account_parent_class)->dispose (object);
}
Esempio n. 10
0
static void
empathy_account_connection_ready_cb (TpConnection *connection,
    const GError *error,
    gpointer user_data)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (user_data);

  if (error != NULL)
    {
      DEBUG ("(%s) Connection failed to become ready: %s",
        empathy_account_get_unique_name (account), error->message);
      empathy_account_free_connection (account);
    }
  else
    {
      DEBUG ("(%s) Connection ready",
        empathy_account_get_unique_name (account));
      g_object_notify (G_OBJECT (account), "connection");
    }
}
Esempio n. 11
0
static void
account_widget_account_enabled_cb (GObject *source_object,
    GAsyncResult *res,
    gpointer user_data)
{
  GError *error = NULL;
  EmpathyAccount *account = EMPATHY_ACCOUNT (source_object);
  EmpathyAccountWidget *widget = EMPATHY_ACCOUNT_WIDGET (user_data);

  empathy_account_set_enabled_finish (account, res, &error);

  if (error != NULL)
    {
      DEBUG ("Could not automatically enable new account: %s", error->message);
      g_error_free (error);
    }
  else
    {
      g_signal_emit (widget, signals[ACCOUNT_CREATED], 0);
    }
}
Esempio n. 12
0
static void
empathy_account_got_all_cb (TpProxy *proxy,
    GHashTable *properties,
    const GError *error,
    gpointer user_data,
    GObject *weak_object)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (weak_object);

  DEBUG ("Got whole set of properties for %s",
    empathy_account_get_unique_name (account));

  if (error != NULL)
    {
      DEBUG ("Failed to get the initial set of account properties: %s",
        error->message);
      return;
    }

  empathy_account_update (account, properties);
}
Esempio n. 13
0
static void
_empathy_account_connection_invalidated_cb (TpProxy *self,
  guint    domain,
  gint     code,
  gchar   *message,
  gpointer user_data)
{
  EmpathyAccount *account = EMPATHY_ACCOUNT (user_data);
  EmpathyAccountPriv *priv = GET_PRIV (account);

  if (priv->connection == NULL)
    return;

  DEBUG ("(%s) Connection invalidated",
    empathy_account_get_unique_name (account));

  g_assert (priv->connection == TP_CONNECTION (self));

  empathy_account_free_connection (account);

  g_object_notify (G_OBJECT (account), "connection");
}
Esempio n. 14
0
static void
account_assistant_account_enabled_cb (GObject *source,
    GAsyncResult *result,
    gpointer user_data)
{
  GError *error = NULL;
  EmpathyAccountAssistant *self = user_data;
  EmpathyAccountAssistantPriv *priv = GET_PRIV (self);

  empathy_account_set_enabled_finish (EMPATHY_ACCOUNT (source),
      result, &error);

  if (error)
    {
      g_warning ("Error enabling an account: %s", error->message);
      g_error_free (error);
    }

  if (priv->create_enter_resp == RESPONSE_CREATE_STOP)
    g_signal_emit_by_name (self, "close");
  else
    account_assistant_reset_enter_create_page (self);
}