diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-17 22:27:39 +0800 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2010-09-29 18:54:37 +0800 |
commit | d6e5c9087b7c611c8b03a5239dbf9eb5aa50a9b4 (patch) | |
tree | 9e63a76ab5f3c8b19d354806d865a9df4c9340c9 /libempathy | |
parent | 9cd957b56a67984b4fd3d89aec3e6606372462d7 (diff) | |
download | gsoc2013-empathy-d6e5c9087b7c611c8b03a5239dbf9eb5aa50a9b4.tar.gz gsoc2013-empathy-d6e5c9087b7c611c8b03a5239dbf9eb5aa50a9b4.tar.zst gsoc2013-empathy-d6e5c9087b7c611c8b03a5239dbf9eb5aa50a9b4.zip |
Allow to set the Service of newly created account (#629734)
Diffstat (limited to 'libempathy')
-rw-r--r-- | libempathy/empathy-account-settings.c | 32 | ||||
-rw-r--r-- | libempathy/empathy-account-settings.h | 4 |
2 files changed, 36 insertions, 0 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c index 1278bb441..9643920cb 100644 --- a/libempathy/empathy-account-settings.c +++ b/libempathy/empathy-account-settings.c @@ -43,6 +43,7 @@ enum { PROP_ACCOUNT = 1, PROP_CM_NAME, PROP_PROTOCOL, + PROP_SERVICE, PROP_DISPLAY_NAME, PROP_DISPLAY_NAME_OVERRIDDEN, PROP_READY @@ -62,6 +63,7 @@ struct _EmpathyAccountSettingsPriv TpAccount *account; gchar *cm_name; gchar *protocol; + gchar *service; gchar *display_name; gchar *icon_name; gboolean display_name_overridden; @@ -123,6 +125,9 @@ empathy_account_settings_set_property (GObject *object, case PROP_PROTOCOL: priv->protocol = g_value_dup_string (value); break; + case PROP_SERVICE: + priv->service = g_value_dup_string (value); + break; case PROP_DISPLAY_NAME: priv->display_name = g_value_dup_string (value); break; @@ -155,6 +160,9 @@ empathy_account_settings_get_property (GObject *object, case PROP_PROTOCOL: g_value_set_string (value, priv->protocol); break; + case PROP_SERVICE: + g_value_set_string (value, priv->service); + break; case PROP_DISPLAY_NAME: g_value_set_string (value, priv->display_name); break; @@ -180,11 +188,14 @@ empathy_account_settings_constructed (GObject *object) { g_free (priv->cm_name); g_free (priv->protocol); + g_free (priv->service); priv->cm_name = g_strdup (tp_account_get_connection_manager (priv->account)); priv->protocol = g_strdup (tp_account_get_protocol (priv->account)); + priv->service = + g_strdup (tp_account_get_service (priv->account)); priv->icon_name = g_strdup (tp_account_get_icon_name (priv->account)); } @@ -248,6 +259,13 @@ empathy_account_settings_class_init ( NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_SERVICE, + g_param_spec_string ("service", + "Service", + "The service of this account, or NULL", + NULL, + G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + g_object_class_install_property (object_class, PROP_DISPLAY_NAME, g_param_spec_string ("display-name", "display-name", @@ -329,6 +347,7 @@ empathy_account_settings_finalize (GObject *object) /* free any data held directly by the object here */ g_free (priv->cm_name); g_free (priv->protocol); + g_free (priv->service); g_free (priv->display_name); g_free (priv->icon_name); @@ -440,11 +459,13 @@ empathy_account_settings_managers_ready_cb (GObject *object, EmpathyAccountSettings * empathy_account_settings_new (const gchar *connection_manager, const gchar *protocol, + const gchar *service, const char *display_name) { return g_object_new (EMPATHY_TYPE_ACCOUNT_SETTINGS, "connection-manager", connection_manager, "protocol", protocol, + "service", service, "display-name", display_name, NULL); } @@ -502,6 +523,14 @@ empathy_account_settings_get_protocol (EmpathyAccountSettings *settings) return priv->protocol; } +const gchar * +empathy_account_settings_get_service (EmpathyAccountSettings *settings) +{ + EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + + return priv->service; +} + gchar * empathy_account_settings_get_icon_name (EmpathyAccountSettings *settings) { @@ -1189,6 +1218,9 @@ empathy_account_settings_do_create_account (EmpathyAccountSettings *settings) tp_asv_set_string (properties, TP_IFACE_ACCOUNT ".Icon", priv->icon_name); + if (priv->service != NULL) + tp_asv_set_string (properties, TP_PROP_ACCOUNT_SERVICE, priv->service); + tp_account_manager_create_account_async (priv->account_manager, priv->cm_name, priv->protocol, priv->display_name, priv->parameters, properties, diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h index 7b1a4d6f9..d3276e1a5 100644 --- a/libempathy/empathy-account-settings.h +++ b/libempathy/empathy-account-settings.h @@ -63,6 +63,7 @@ GType empathy_account_settings_get_type (void); EmpathyAccountSettings * empathy_account_settings_new ( const gchar *connection_manager, const gchar *protocol, + const gchar *service, const char *display_name); EmpathyAccountSettings * empathy_account_settings_new_for_account ( @@ -74,6 +75,9 @@ const gchar *empathy_account_settings_get_cm (EmpathyAccountSettings *settings); const gchar *empathy_account_settings_get_protocol ( EmpathyAccountSettings *settings); +const gchar *empathy_account_settings_get_service ( + EmpathyAccountSettings *settings); + TpAccount *empathy_account_settings_get_account ( EmpathyAccountSettings *settings); |