diff options
author | Marco Barisione <marco.barisione@collabora.co.uk> | 2013-05-08 21:39:41 +0800 |
---|---|---|
committer | Marco Barisione <marco.barisione@collabora.co.uk> | 2013-08-20 18:03:05 +0800 |
commit | fa2f3a41fd62737b803b9307b51415aa32dc6715 (patch) | |
tree | b43cb11eb368187ec189a5a59d38ead4db025b33 | |
parent | e72ddde10dd32bcad39c604c579faa04c822d2be (diff) | |
download | gsoc2013-empathy-fa2f3a41fd62737b803b9307b51415aa32dc6715.tar.gz gsoc2013-empathy-fa2f3a41fd62737b803b9307b51415aa32dc6715.tar.zst gsoc2013-empathy-fa2f3a41fd62737b803b9307b51415aa32dc6715.zip |
account-settings: move from Empathy to tp-account-widgets
https://bugzilla.gnome.org/show_bug.cgi?id=699492
19 files changed, 592 insertions, 594 deletions
diff --git a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c index d9fecc1c0..04275282a 100644 --- a/libempathy-gtk/empathy-local-xmpp-assistant-widget.c +++ b/libempathy-gtk/empathy-local-xmpp-assistant-widget.c @@ -42,7 +42,7 @@ static gulong signals[LAST_SIGNAL] = { 0, }; struct _EmpathyLocalXmppAssistantWidgetPrivate { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; }; static void @@ -96,7 +96,7 @@ empathy_local_xmpp_assistant_widget_constructed (GObject *object) g_object_unref (pix); } - self->priv->settings = empathy_account_settings_new ("salut", "local-xmpp", + self->priv->settings = tpaw_account_settings_new ("salut", "local-xmpp", NULL, _("People nearby")); account_widget = tpaw_account_widget_new_for_protocol ( @@ -191,11 +191,11 @@ apply_account_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (source); TpAccount *account; GError *error = NULL; - if (!empathy_account_settings_apply_finish (settings, result, NULL, &error)) + if (!tpaw_account_settings_apply_finish (settings, result, NULL, &error)) { DEBUG ("Failed to create account: %s", error->message); g_error_free (error); @@ -203,7 +203,7 @@ apply_account_cb (GObject *source, } /* enable the newly created account */ - account = empathy_account_settings_get_account (settings); + account = tpaw_account_settings_get_account (settings); tp_account_set_enabled_async (account, TRUE, account_enabled_cb, NULL); } @@ -211,7 +211,7 @@ void empathy_local_xmpp_assistant_widget_create_account ( EmpathyLocalXmppAssistantWidget *self) { - empathy_account_settings_apply_async (self->priv->settings, + tpaw_account_settings_apply_async (self->priv->settings, apply_account_cb, NULL); } @@ -244,5 +244,5 @@ gboolean empathy_local_xmpp_assistant_widget_is_valid ( EmpathyLocalXmppAssistantWidget *self) { - return empathy_account_settings_is_valid (self->priv->settings); + return tpaw_account_settings_is_valid (self->priv->settings); } diff --git a/libempathy-gtk/empathy-new-account-dialog.c b/libempathy-gtk/empathy-new-account-dialog.c index eaa8b07ed..5f77fe2ce 100644 --- a/libempathy-gtk/empathy-new-account-dialog.c +++ b/libempathy-gtk/empathy-new-account-dialog.c @@ -38,7 +38,7 @@ struct _EmpathyNewAccountDialogPrivate GtkWidget *main_vbox; GtkWidget *connect_button; - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; }; static void @@ -53,7 +53,7 @@ static void protocol_changed_cb (GtkComboBox *chooser, EmpathyNewAccountDialog *self) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpawAccountWidget *account_widget; gchar *password = NULL, *account = NULL; @@ -66,10 +66,10 @@ protocol_changed_cb (GtkComboBox *chooser, /* Save "account" and "password" parameters */ if (self->priv->settings != NULL) { - account = empathy_account_settings_dup_string ( + account = tpaw_account_settings_dup_string ( self->priv->settings, "account"); - password = empathy_account_settings_dup_string ( + password = tpaw_account_settings_dup_string ( self->priv->settings, "password"); g_object_unref (self->priv->settings); @@ -190,7 +190,7 @@ empathy_new_account_dialog_new (GtkWindow *parent) return result; } -EmpathyAccountSettings * +TpawAccountSettings * empathy_new_account_dialog_get_settings (EmpathyNewAccountDialog *self) { return self->priv->settings; diff --git a/libempathy-gtk/empathy-new-account-dialog.h b/libempathy-gtk/empathy-new-account-dialog.h index 6a5d5c2d5..1fa6b43f8 100644 --- a/libempathy-gtk/empathy-new-account-dialog.h +++ b/libempathy-gtk/empathy-new-account-dialog.h @@ -21,8 +21,7 @@ #define ___EMPATHY_NEW_ACCOUNT_DIALOG_H__ #include <gtk/gtk.h> - -#include "empathy-account-settings.h" +#include <tp-account-widgets/tpaw-account-settings.h> G_BEGIN_DECLS @@ -51,7 +50,7 @@ GType empathy_new_account_dialog_get_type (void) G_GNUC_CONST; GtkWidget * empathy_new_account_dialog_new (GtkWindow *parent); -EmpathyAccountSettings * empathy_new_account_dialog_get_settings ( +TpawAccountSettings * empathy_new_account_dialog_get_settings ( EmpathyNewAccountDialog *self); G_END_DECLS diff --git a/libempathy-gtk/empathy-protocol-chooser.c b/libempathy-gtk/empathy-protocol-chooser.c index a060d9f7e..b2fec5e0f 100644 --- a/libempathy-gtk/empathy-protocol-chooser.c +++ b/libempathy-gtk/empathy-protocol-chooser.c @@ -576,10 +576,10 @@ empathy_protocol_chooser_set_visible (EmpathyProtocolChooser *protocol_chooser, gtk_combo_box_set_active (GTK_COMBO_BOX (protocol_chooser), 0); } -EmpathyAccountSettings * +TpawAccountSettings * empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self) { - EmpathyAccountSettings *settings = NULL; + TpawAccountSettings *settings = NULL; gchar *str; const gchar *display_name; TpConnectionManager *cm; @@ -602,7 +602,7 @@ empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self) */ str = g_strdup_printf (_("New %s account"), display_name); - settings = empathy_account_settings_new (tp_connection_manager_get_name (cm), + settings = tpaw_account_settings_new (tp_connection_manager_get_name (cm), tp_protocol_get_name (proto), service, str); g_free (str); @@ -619,19 +619,19 @@ empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self) "talk.google.com", NULL}; - empathy_account_settings_set_icon_name_async (settings, "im-google-talk", + tpaw_account_settings_set_icon_name_async (settings, "im-google-talk", NULL, NULL); - empathy_account_settings_set (settings, "server", + tpaw_account_settings_set (settings, "server", g_variant_new_string (extra_certificate_identities[0])); - empathy_account_settings_set (settings, "require-encryption", + tpaw_account_settings_set (settings, "require-encryption", g_variant_new_boolean (TRUE)); - empathy_account_settings_set (settings, "fallback-servers", + tpaw_account_settings_set (settings, "fallback-servers", g_variant_new_strv (fallback_servers, -1)); - if (empathy_account_settings_have_tp_param (settings, + if (tpaw_account_settings_have_tp_param (settings, "extra-certificate-identities")) { - empathy_account_settings_set (settings, + tpaw_account_settings_set (settings, "extra-certificate-identities", g_variant_new_strv (extra_certificate_identities, -1)); } @@ -642,13 +642,13 @@ empathy_protocol_chooser_create_account_settings (EmpathyProtocolChooser *self) "chat.facebook.com:443", NULL }; - empathy_account_settings_set_icon_name_async (settings, "im-facebook", + tpaw_account_settings_set_icon_name_async (settings, "im-facebook", NULL, NULL); - empathy_account_settings_set (settings, "require-encryption", + tpaw_account_settings_set (settings, "require-encryption", g_variant_new_boolean (TRUE)); - empathy_account_settings_set (settings, "server", + tpaw_account_settings_set (settings, "server", g_variant_new_string ("chat.facebook.com")); - empathy_account_settings_set (settings, "fallback-servers", + tpaw_account_settings_set (settings, "fallback-servers", g_variant_new_strv (fallback_servers, -1)); } diff --git a/libempathy-gtk/empathy-protocol-chooser.h b/libempathy-gtk/empathy-protocol-chooser.h index 2ae8017ef..520f71f53 100644 --- a/libempathy-gtk/empathy-protocol-chooser.h +++ b/libempathy-gtk/empathy-protocol-chooser.h @@ -25,8 +25,7 @@ #include <gtk/gtk.h> #include <telepathy-glib/telepathy-glib.h> - -#include "empathy-account-settings.h" +#include <tp-account-widgets/tpaw-account-settings.h> G_BEGIN_DECLS @@ -75,7 +74,7 @@ void empathy_protocol_chooser_set_visible ( EmpathyProtocolChooserFilterFunc func, gpointer user_data); -EmpathyAccountSettings * empathy_protocol_chooser_create_account_settings ( +TpawAccountSettings * empathy_protocol_chooser_create_account_settings ( EmpathyProtocolChooser *self); G_END_DECLS diff --git a/libempathy/Makefile.am b/libempathy/Makefile.am index 56fb12202..d7a638859 100644 --- a/libempathy/Makefile.am +++ b/libempathy/Makefile.am @@ -27,7 +27,6 @@ BUILT_SOURCES = \ libempathy_headers = \ action-chain-internal.h \ - empathy-account-settings.h \ empathy-auth-factory.h \ empathy-camera-monitor.h \ empathy-chatroom-manager.h \ @@ -61,7 +60,6 @@ libempathy_headers = \ libempathy_handwritten_source = \ $(libempathy_headers) \ action-chain.c \ - empathy-account-settings.c \ empathy-auth-factory.c \ empathy-camera-monitor.c \ empathy-chatroom-manager.c \ diff --git a/libempathy/empathy-account-settings.h b/libempathy/empathy-account-settings.h deleted file mode 100644 index 6e4713c4c..000000000 --- a/libempathy/empathy-account-settings.h +++ /dev/null @@ -1,204 +0,0 @@ -/* - * empathy-account-settings.h - Header for EmpathyAccountSettings - * Copyright (C) 2009 Collabora Ltd. - * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#ifndef __EMPATHY_ACCOUNT_SETTINGS_H__ -#define __EMPATHY_ACCOUNT_SETTINGS_H__ - -#include <glib-object.h> -#include <gio/gio.h> -#include <telepathy-glib/telepathy-glib.h> - -G_BEGIN_DECLS - -typedef struct _EmpathyAccountSettings EmpathyAccountSettings; -typedef struct _EmpathyAccountSettingsClass EmpathyAccountSettingsClass; - -struct _EmpathyAccountSettingsClass { - GObjectClass parent_class; -}; - -struct _EmpathyAccountSettings { - GObject parent; - gpointer priv; -}; - -GType empathy_account_settings_get_type (void); - -/* TYPE MACROS */ -#define EMPATHY_TYPE_ACCOUNT_SETTINGS \ - (empathy_account_settings_get_type ()) -#define EMPATHY_ACCOUNT_SETTINGS(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - EMPATHY_TYPE_ACCOUNT_SETTINGS, EmpathyAccountSettings)) -#define EMPATHY_ACCOUNT_SETTINGS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), EMPATHY_TYPE_ACCOUNT_SETTINGS, \ - EmpathyAccountSettingsClass)) -#define EMPATHY_IS_ACCOUNT_SETTINGS(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), EMPATHY_TYPE_ACCOUNT_SETTINGS)) -#define EMPATHY_IS_ACCOUNT_SETTINGS_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), EMPATHY_TYPE_ACCOUNT_SETTINGS)) -#define EMPATHY_ACCOUNT_SETTINGS_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), EMPATHY_TYPE_ACCOUNT_SETTINGS, \ - EmpathyAccountSettingsClass)) - -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 ( - TpAccount *account); - -gboolean empathy_account_settings_is_ready (EmpathyAccountSettings *settings); - -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); - -void empathy_account_settings_set_service (EmpathyAccountSettings *settings, - const gchar *service); - -TpAccount *empathy_account_settings_get_account ( - EmpathyAccountSettings *settings); - -gboolean empathy_account_settings_has_account ( - EmpathyAccountSettings *settings, TpAccount *account); - -GList * empathy_account_settings_dup_tp_params ( - EmpathyAccountSettings *settings); - -gboolean empathy_account_settings_have_tp_param ( - EmpathyAccountSettings *settings, - const gchar *param); - -void empathy_account_settings_unset (EmpathyAccountSettings *settings, - const gchar *param); - -void empathy_account_settings_discard_changes ( - EmpathyAccountSettings *settings); - -const gchar * -empathy_account_settings_get_dbus_signature (EmpathyAccountSettings *setting, - const gchar *param); - -GVariant * -empathy_account_settings_dup_default (EmpathyAccountSettings *settings, - const gchar *param); - -gchar * empathy_account_settings_dup_string ( - EmpathyAccountSettings *settings, - const gchar *param); -GStrv empathy_account_settings_dup_strv ( - EmpathyAccountSettings *settings, - const gchar *param); - -gint32 empathy_account_settings_get_int32 (EmpathyAccountSettings *settings, - const gchar *param); -gint64 empathy_account_settings_get_int64 (EmpathyAccountSettings *settings, - const gchar *param); -guint32 empathy_account_settings_get_uint32 (EmpathyAccountSettings *settings, - const gchar *param); -guint64 empathy_account_settings_get_uint64 (EmpathyAccountSettings *settings, - const gchar *param); -gboolean empathy_account_settings_get_boolean (EmpathyAccountSettings *settings, - const gchar *param); - -void empathy_account_settings_set (EmpathyAccountSettings *settings, - const gchar *param, - GVariant *v); - -gchar *empathy_account_settings_get_icon_name ( - EmpathyAccountSettings *settings); - -void empathy_account_settings_set_icon_name_async ( - EmpathyAccountSettings *settings, - const gchar *name, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean empathy_account_settings_set_icon_name_finish ( - EmpathyAccountSettings *settings, - GAsyncResult *result, - GError **error); - -const gchar *empathy_account_settings_get_display_name ( - EmpathyAccountSettings *settings); - -void empathy_account_settings_set_display_name_async ( - EmpathyAccountSettings *settings, - const gchar *name, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean empathy_account_settings_set_display_name_finish ( - EmpathyAccountSettings *settings, - GAsyncResult *result, - GError **error); - -void empathy_account_settings_apply_async (EmpathyAccountSettings *settings, - GAsyncReadyCallback callback, - gpointer user_data); - -gboolean empathy_account_settings_apply_finish ( - EmpathyAccountSettings *settings, - GAsyncResult *result, - gboolean *reconnect_required, - GError **error); - -void empathy_account_settings_set_regex (EmpathyAccountSettings *settings, - const gchar *param, - const gchar *regex); - -gboolean empathy_account_settings_parameter_is_valid ( - EmpathyAccountSettings *settings, - const gchar *param); - -gboolean empathy_account_settings_is_valid (EmpathyAccountSettings *settings); - -TpProtocol * empathy_account_settings_get_tp_protocol ( - EmpathyAccountSettings *settings); - -gboolean empathy_account_settings_supports_sasl (EmpathyAccountSettings *self); - -gboolean empathy_account_settings_param_is_supported ( - EmpathyAccountSettings *self, - const gchar *param); - -void empathy_account_settings_set_uri_scheme_tel (EmpathyAccountSettings *self, - gboolean associate); - -gboolean empathy_account_settings_has_uri_scheme_tel ( - EmpathyAccountSettings *self); - -void empathy_account_settings_set_storage_provider ( - EmpathyAccountSettings *self, - const gchar *storage); - -void empathy_account_settings_set_remember_password ( - EmpathyAccountSettings *self, - gboolean remember); - -G_END_DECLS - -#endif /* #ifndef __EMPATHY_ACCOUNT_SETTINGS_H__*/ diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c index a175261ba..73d67485d 100644 --- a/src/empathy-accounts-dialog.c +++ b/src/empathy-accounts-dialog.c @@ -111,7 +111,7 @@ typedef struct { guint connecting_id; gulong settings_ready_id; - EmpathyAccountSettings *settings_ready; + TpawAccountSettings *settings_ready; TpAccountManager *account_manager; EmpathyConnectionManagers *cms; @@ -143,13 +143,13 @@ enum { PROP_PARENT = 1 }; -static EmpathyAccountSettings * accounts_dialog_model_get_selected_settings ( +static TpawAccountSettings * accounts_dialog_model_get_selected_settings ( EmpathyAccountsDialog *dialog); static void accounts_dialog_model_select_first (EmpathyAccountsDialog *dialog); static void accounts_dialog_update_settings (EmpathyAccountsDialog *dialog, - EmpathyAccountSettings *settings); + TpawAccountSettings *settings); static void accounts_dialog_model_set_selected (EmpathyAccountsDialog *dialog, TpAccount *account); @@ -230,7 +230,7 @@ accounts_dialog_enable_switch_active_cb (GtkSwitch *sw, GParamSpec *spec, EmpathyAccountsDialog *dialog) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpAccount *account; gboolean enable; @@ -238,7 +238,7 @@ accounts_dialog_enable_switch_active_cb (GtkSwitch *sw, if (settings == NULL) return; - account = empathy_account_settings_get_account (settings); + account = tpaw_account_settings_get_account (settings); if (account == NULL) return; @@ -504,7 +504,7 @@ empathy_account_dialog_cancel (EmpathyAccountsDialog *dialog) GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpAccount *account; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); @@ -576,7 +576,7 @@ static void account_dialog_create_edit_params_dialog (EmpathyAccountsDialog *dialog) { EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; GtkWidget *subdialog, *content_area, *align; settings = accounts_dialog_model_get_selected_settings (dialog); @@ -655,7 +655,7 @@ static void account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog, GtkButton *button) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpAccount *account; TpStorageRestrictionFlags storage_restrictions; @@ -663,7 +663,7 @@ account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog, if (settings == NULL) return; - account = empathy_account_settings_get_account (settings); + account = tpaw_account_settings_get_account (settings); g_return_if_fail (account != NULL); storage_restrictions = tp_account_get_storage_restrictions (account); @@ -683,7 +683,7 @@ account_dialow_show_edit_params_dialog (EmpathyAccountsDialog *dialog, static void account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog, - EmpathyAccountSettings *settings) + TpawAccountSettings *settings) { EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); const gchar *icon_name; @@ -691,7 +691,7 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog, GtkWidget *bbox, *button; GtkWidget *alig; - account = empathy_account_settings_get_account (settings); + account = tpaw_account_settings_get_account (settings); priv->dialog_content = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_container_add (GTK_CONTAINER (priv->alignment_settings), @@ -716,7 +716,7 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog, g_signal_connect_swapped (button, "clicked", G_CALLBACK (account_dialow_show_edit_params_dialog), dialog); - icon_name = empathy_account_settings_get_icon_name (settings); + icon_name = tpaw_account_settings_get_icon_name (settings); if (!gtk_icon_theme_has_icon (gtk_icon_theme_get_default (), icon_name)) @@ -729,18 +729,18 @@ account_dialog_create_dialog_content (EmpathyAccountsDialog *dialog, icon_name, GTK_ICON_SIZE_DIALOG); gtk_widget_set_tooltip_text (priv->image_type, empathy_protocol_name_to_display_name - (empathy_account_settings_get_protocol (settings))); + (tpaw_account_settings_get_protocol (settings))); gtk_widget_show (priv->image_type); accounts_dialog_update_status_infobar (dialog, account); } static void -account_dialog_settings_ready_cb (EmpathyAccountSettings *settings, +account_dialog_settings_ready_cb (TpawAccountSettings *settings, GParamSpec *spec, EmpathyAccountsDialog *dialog) { - if (empathy_account_settings_is_ready (settings)) + if (tpaw_account_settings_is_ready (settings)) account_dialog_create_dialog_content (dialog, settings); } @@ -857,7 +857,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, if (response == GTK_RESPONSE_APPLY) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpAccount *account; settings = empathy_new_account_dialog_get_settings ( @@ -866,7 +866,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, /* The newly created account has already been added by * accounts_dialog_account_validity_changed_cb so we just * have to select it. */ - account = empathy_account_settings_get_account (settings); + account = tpaw_account_settings_get_account (settings); accounts_dialog_model_set_selected (self, account); } @@ -875,7 +875,7 @@ accounts_dialog_button_add_clicked_cb (GtkWidget *button, static void accounts_dialog_update_settings (EmpathyAccountsDialog *dialog, - EmpathyAccountSettings *settings) + TpawAccountSettings *settings) { EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); @@ -933,7 +933,7 @@ accounts_dialog_update_settings (EmpathyAccountsDialog *dialog, priv->dialog_content = NULL; } - if (empathy_account_settings_is_ready (settings)) + if (tpaw_account_settings_is_ready (settings)) { account_dialog_create_dialog_content (dialog, settings); } @@ -1067,7 +1067,7 @@ accounts_dialog_model_protocol_pixbuf_data_func (GtkTreeViewColumn *tree_column, GtkTreeIter *iter, EmpathyAccountsDialog *dialog) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; gchar *icon_name; GdkPixbuf *pixbuf; TpConnectionStatus status; @@ -1077,7 +1077,7 @@ accounts_dialog_model_protocol_pixbuf_data_func (GtkTreeViewColumn *tree_column, COL_ACCOUNT_SETTINGS, &settings, -1); - icon_name = empathy_account_settings_get_icon_name (settings); + icon_name = tpaw_account_settings_get_icon_name (settings); pixbuf = ensure_icon (dialog, icon_name); g_object_set (cell, @@ -1139,7 +1139,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer, gchar *new_text, EmpathyAccountsDialog *dialog) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; GtkTreeModel *model; GtkTreePath *treepath; GtkTreeIter iter; @@ -1166,7 +1166,7 @@ accounts_dialog_name_edited_cb (GtkCellRendererText *renderer, -1); gtk_tree_path_free (treepath); - empathy_account_settings_set_display_name_async (settings, new_text, + tpaw_account_settings_set_display_name_async (settings, new_text, NULL, NULL); g_object_set (settings, "display-name-overridden", TRUE, NULL); g_object_unref (settings); @@ -1324,14 +1324,14 @@ accounts_dialog_model_add_columns (EmpathyAccountsDialog *dialog) g_object_set (priv->name_renderer, "ypad", 4, NULL); } -static EmpathyAccountSettings * +static TpawAccountSettings * accounts_dialog_model_get_selected_settings (EmpathyAccountsDialog *dialog) { GtkTreeView *view; GtkTreeModel *model; GtkTreeSelection *selection; GtkTreeIter iter; - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); view = GTK_TREE_VIEW (priv->treeview); @@ -1351,7 +1351,7 @@ accounts_dialog_model_selection_changed (GtkTreeSelection *selection, EmpathyAccountsDialog *dialog) { EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog); - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; GtkTreeModel *model; GtkTreeIter iter; gboolean is_selection; @@ -1481,7 +1481,7 @@ accounts_dialog_model_setup (EmpathyAccountsDialog *dialog) G_TYPE_STRING, /* name */ G_TYPE_UINT, /* status */ TP_TYPE_ACCOUNT, /* account */ - EMPATHY_TYPE_ACCOUNT_SETTINGS); /* settings */ + TPAW_TYPE_ACCOUNT_SETTINGS); /* settings */ gtk_tree_view_set_model (GTK_TREE_VIEW (priv->treeview), GTK_TREE_MODEL (store)); @@ -1687,7 +1687,7 @@ finally: static void reload_account_widget (EmpathyAccountsDialog *self) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; settings = accounts_dialog_model_get_selected_settings (self); accounts_dialog_update_settings (self, settings); @@ -1830,7 +1830,7 @@ static void accounts_dialog_add_account (EmpathyAccountsDialog *dialog, TpAccount *account) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; GtkTreeModel *model; GtkTreeIter iter; TpConnectionStatus status; @@ -1843,7 +1843,7 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog, status = tp_account_get_connection_status (account, NULL); name = tp_account_get_display_name (account); - settings = empathy_account_settings_new_for_account (account); + settings = tpaw_account_settings_new_for_account (account); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)); diff --git a/tp-account-widgets/Makefile.am b/tp-account-widgets/Makefile.am index 0d2d5011d..554c1a639 100644 --- a/tp-account-widgets/Makefile.am +++ b/tp-account-widgets/Makefile.am @@ -16,6 +16,7 @@ BUILT_SOURCES = \ $(NULL) libtp_account_widgets_sources = \ + tpaw-account-settings.c \ tpaw-account-widget.c \ tpaw-account-widget-irc.c \ tpaw-account-widget-private.h \ @@ -30,6 +31,7 @@ libtp_account_widgets_sources = \ $(NULL) libtp_account_widgets_headers = \ + tpaw-account-settings.h \ tpaw-account-widget.h \ tpaw-account-widget-irc.h \ tpaw-account-widget-sip.h \ diff --git a/libempathy/empathy-account-settings.c b/tp-account-widgets/tpaw-account-settings.c index 9cb48c36c..b97da2790 100644 --- a/libempathy/empathy-account-settings.c +++ b/tp-account-widgets/tpaw-account-settings.c @@ -1,5 +1,5 @@ /* - * empathy-account-settings.c - Source for EmpathyAccountSettings + * tpaw-account-settings.c - Source for TpawAccountSettings * Copyright (C) 2009 Collabora Ltd. * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> * @@ -19,7 +19,7 @@ */ #include "config.h" -#include "empathy-account-settings.h" +#include "tpaw-account-settings.h" #include "empathy-connection-managers.h" #include "empathy-keyring.h" @@ -29,9 +29,9 @@ #define DEBUG_FLAG EMPATHY_DEBUG_ACCOUNT #include "empathy-debug.h" -#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, EmpathyAccountSettings) +#define GET_PRIV(obj) EMPATHY_GET_PRIV (obj, TpawAccountSettings) -G_DEFINE_TYPE(EmpathyAccountSettings, empathy_account_settings, G_TYPE_OBJECT) +G_DEFINE_TYPE(TpawAccountSettings, tpaw_account_settings, G_TYPE_OBJECT) enum { PROP_ACCOUNT = 1, @@ -51,9 +51,9 @@ enum { static gulong signals[LAST_SIGNAL] = { 0, }; /* private structure */ -typedef struct _EmpathyAccountSettingsPriv EmpathyAccountSettingsPriv; +typedef struct _TpawAccountSettingsPriv TpawAccountSettingsPriv; -struct _EmpathyAccountSettingsPriv +struct _TpawAccountSettingsPriv { gboolean dispose_has_run; EmpathyConnectionManagers *managers; @@ -104,10 +104,10 @@ struct _EmpathyAccountSettingsPriv }; static void -empathy_account_settings_init (EmpathyAccountSettings *obj) +tpaw_account_settings_init (TpawAccountSettings *obj) { - EmpathyAccountSettingsPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE ((obj), - EMPATHY_TYPE_ACCOUNT_SETTINGS, EmpathyAccountSettingsPriv); + TpawAccountSettingsPriv *priv = G_TYPE_INSTANCE_GET_PRIVATE ((obj), + TPAW_TYPE_ACCOUNT_SETTINGS, TpawAccountSettingsPriv); obj->priv = priv; @@ -126,23 +126,23 @@ empathy_account_settings_init (EmpathyAccountSettings *obj) priv->required_params = NULL; } -static void empathy_account_settings_dispose (GObject *object); -static void empathy_account_settings_finalize (GObject *object); -static void empathy_account_settings_account_ready_cb (GObject *source_object, +static void tpaw_account_settings_dispose (GObject *object); +static void tpaw_account_settings_finalize (GObject *object); +static void tpaw_account_settings_account_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data); -static void empathy_account_settings_managers_ready_cb (GObject *obj, +static void tpaw_account_settings_managers_ready_cb (GObject *obj, GParamSpec *pspec, gpointer user_data); -static void empathy_account_settings_check_readyness ( - EmpathyAccountSettings *self); +static void tpaw_account_settings_check_readyness ( + TpawAccountSettings *self); static void -empathy_account_settings_set_property (GObject *object, +tpaw_account_settings_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (object); - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (object); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); switch (prop_id) { @@ -171,13 +171,13 @@ empathy_account_settings_set_property (GObject *object, } static void -empathy_account_settings_get_property (GObject *object, +tpaw_account_settings_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (object); - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (object); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); switch (prop_id) { @@ -209,10 +209,10 @@ empathy_account_settings_get_property (GObject *object, } static void -empathy_account_settings_constructed (GObject *object) +tpaw_account_settings_constructed (GObject *object) { - EmpathyAccountSettings *self = EMPATHY_ACCOUNT_SETTINGS (object); - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettings *self = TPAW_ACCOUNT_SETTINGS (object); + TpawAccountSettingsPriv *priv = GET_PRIV (self); if (priv->account != NULL) { @@ -236,7 +236,7 @@ empathy_account_settings_constructed (GObject *object) g_assert (priv->cm_name != NULL && priv->protocol != NULL); - empathy_account_settings_check_readyness (self); + tpaw_account_settings_check_readyness (self); if (!priv->ready) { @@ -249,34 +249,34 @@ empathy_account_settings_constructed (GObject *object) if (priv->account != NULL) { tp_proxy_prepare_async (priv->account, features, - empathy_account_settings_account_ready_cb, self); + tpaw_account_settings_account_ready_cb, self); } tp_g_signal_connect_object (priv->managers, "notify::ready", - G_CALLBACK (empathy_account_settings_managers_ready_cb), object, 0); + G_CALLBACK (tpaw_account_settings_managers_ready_cb), object, 0); } if (G_OBJECT_CLASS ( - empathy_account_settings_parent_class)->constructed != NULL) + tpaw_account_settings_parent_class)->constructed != NULL) G_OBJECT_CLASS ( - empathy_account_settings_parent_class)->constructed (object); + tpaw_account_settings_parent_class)->constructed (object); } static void -empathy_account_settings_class_init ( - EmpathyAccountSettingsClass *empathy_account_settings_class) +tpaw_account_settings_class_init ( + TpawAccountSettingsClass *tpaw_account_settings_class) { - GObjectClass *object_class = G_OBJECT_CLASS (empathy_account_settings_class); + GObjectClass *object_class = G_OBJECT_CLASS (tpaw_account_settings_class); - g_type_class_add_private (empathy_account_settings_class, sizeof - (EmpathyAccountSettingsPriv)); + g_type_class_add_private (tpaw_account_settings_class, sizeof + (TpawAccountSettingsPriv)); - object_class->dispose = empathy_account_settings_dispose; - object_class->finalize = empathy_account_settings_finalize; - object_class->set_property = empathy_account_settings_set_property; - object_class->get_property = empathy_account_settings_get_property; - object_class->constructed = empathy_account_settings_constructed; + object_class->dispose = tpaw_account_settings_dispose; + object_class->finalize = tpaw_account_settings_finalize; + object_class->set_property = tpaw_account_settings_set_property; + object_class->get_property = tpaw_account_settings_get_property; + object_class->constructed = tpaw_account_settings_constructed; g_object_class_install_property (object_class, PROP_ACCOUNT, g_param_spec_object ("account", @@ -330,17 +330,17 @@ empathy_account_settings_class_init ( signals[PASSWORD_RETRIEVED] = g_signal_new ("password-retrieved", - G_TYPE_FROM_CLASS (empathy_account_settings_class), + G_TYPE_FROM_CLASS (tpaw_account_settings_class), G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_generic, G_TYPE_NONE, 0); } static void -empathy_account_settings_dispose (GObject *object) +tpaw_account_settings_dispose (GObject *object) { - EmpathyAccountSettings *self = EMPATHY_ACCOUNT_SETTINGS (object); - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettings *self = TPAW_ACCOUNT_SETTINGS (object); + TpawAccountSettingsPriv *priv = GET_PRIV (self); if (priv->dispose_has_run) return; @@ -358,15 +358,15 @@ empathy_account_settings_dispose (GObject *object) tp_clear_object (&priv->protocol_obj); /* release any references held by the object here */ - if (G_OBJECT_CLASS (empathy_account_settings_parent_class)->dispose) - G_OBJECT_CLASS (empathy_account_settings_parent_class)->dispose (object); + if (G_OBJECT_CLASS (tpaw_account_settings_parent_class)->dispose) + G_OBJECT_CLASS (tpaw_account_settings_parent_class)->dispose (object); } static void -empathy_account_settings_free_unset_parameters ( - EmpathyAccountSettings *settings) +tpaw_account_settings_free_unset_parameters ( + TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); guint i; for (i = 0 ; i < priv->unset_parameters->len; i++) @@ -376,10 +376,10 @@ empathy_account_settings_free_unset_parameters ( } static void -empathy_account_settings_finalize (GObject *object) +tpaw_account_settings_finalize (GObject *object) { - EmpathyAccountSettings *self = EMPATHY_ACCOUNT_SETTINGS (object); - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettings *self = TPAW_ACCOUNT_SETTINGS (object); + TpawAccountSettingsPriv *priv = GET_PRIV (self); GList *l; /* free any data held directly by the object here */ @@ -402,18 +402,18 @@ empathy_account_settings_finalize (GObject *object) g_hash_table_unref (priv->parameters); g_hash_table_unref (priv->param_regexps); - empathy_account_settings_free_unset_parameters (self); + tpaw_account_settings_free_unset_parameters (self); g_array_unref (priv->unset_parameters); - G_OBJECT_CLASS (empathy_account_settings_parent_class)->finalize (object); + G_OBJECT_CLASS (tpaw_account_settings_parent_class)->finalize (object); } static void -empathy_account_settings_protocol_obj_prepared_cb (GObject *source, +tpaw_account_settings_protocol_obj_prepared_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *self = user_data; + TpawAccountSettings *self = user_data; GError *error = NULL; if (!tp_proxy_prepare_finish (source, result, &error)) @@ -423,16 +423,16 @@ empathy_account_settings_protocol_obj_prepared_cb (GObject *source, return; } - empathy_account_settings_check_readyness (self); + tpaw_account_settings_check_readyness (self); } static void -empathy_account_settings_get_password_cb (GObject *source, +tpaw_account_settings_get_password_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *self = user_data; - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettings *self = user_data; + TpawAccountSettingsPriv *priv = GET_PRIV (self); const gchar *password; GError *error = NULL; @@ -457,14 +457,14 @@ empathy_account_settings_get_password_cb (GObject *source, g_signal_emit (self, signals[PASSWORD_RETRIEVED], 0); } -static GVariant * empathy_account_settings_dup ( - EmpathyAccountSettings *settings, +static GVariant * tpaw_account_settings_dup ( + TpawAccountSettings *settings, const gchar *param); static void -empathy_account_settings_check_readyness (EmpathyAccountSettings *self) +tpaw_account_settings_check_readyness (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); GQuark features[] = { TP_PROTOCOL_FEATURE_CORE, 0 }; if (priv->ready) @@ -513,7 +513,7 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self) { priv->preparing_protocol = TRUE; tp_proxy_prepare_async (priv->protocol_obj, features, - empathy_account_settings_protocol_obj_prepared_cb, self); + tpaw_account_settings_protocol_obj_prepared_cb, self); return; } else @@ -556,7 +556,7 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self) /* Make this call but don't block on its readiness. We'll signal * if it's updated later with ::password-retrieved. */ empathy_keyring_get_account_password_async (priv->account, - empathy_account_settings_get_password_cb, self); + tpaw_account_settings_get_password_cb, self); } priv->ready = TRUE; @@ -564,11 +564,11 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self) } static void -empathy_account_settings_account_ready_cb (GObject *source_object, +tpaw_account_settings_account_ready_cb (GObject *source_object, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (user_data); TpAccount *account = TP_ACCOUNT (source_object); GError *error = NULL; @@ -579,26 +579,26 @@ empathy_account_settings_account_ready_cb (GObject *source_object, return; } - empathy_account_settings_check_readyness (settings); + tpaw_account_settings_check_readyness (settings); } static void -empathy_account_settings_managers_ready_cb (GObject *object, +tpaw_account_settings_managers_ready_cb (GObject *object, GParamSpec *pspec, gpointer user_data) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (user_data); - empathy_account_settings_check_readyness (settings); + tpaw_account_settings_check_readyness (settings); } -EmpathyAccountSettings * -empathy_account_settings_new (const gchar *connection_manager, +TpawAccountSettings * +tpaw_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, + return g_object_new (TPAW_TYPE_ACCOUNT_SETTINGS, "connection-manager", connection_manager, "protocol", protocol, "service", service, @@ -606,18 +606,18 @@ empathy_account_settings_new (const gchar *connection_manager, NULL); } -EmpathyAccountSettings * -empathy_account_settings_new_for_account (TpAccount *account) +TpawAccountSettings * +tpaw_account_settings_new_for_account (TpAccount *account) { - return g_object_new (EMPATHY_TYPE_ACCOUNT_SETTINGS, + return g_object_new (TPAW_TYPE_ACCOUNT_SETTINGS, "account", account, NULL); } GList * -empathy_account_settings_dup_tp_params (EmpathyAccountSettings *settings) +tpaw_account_settings_dup_tp_params (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); g_return_val_if_fail (priv->protocol_obj != NULL, NULL); @@ -625,42 +625,42 @@ empathy_account_settings_dup_tp_params (EmpathyAccountSettings *settings) } gboolean -empathy_account_settings_is_ready (EmpathyAccountSettings *settings) +tpaw_account_settings_is_ready (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->ready; } const gchar * -empathy_account_settings_get_cm (EmpathyAccountSettings *settings) +tpaw_account_settings_get_cm (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->cm_name; } const gchar * -empathy_account_settings_get_protocol (EmpathyAccountSettings *settings) +tpaw_account_settings_get_protocol (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->protocol; } const gchar * -empathy_account_settings_get_service (EmpathyAccountSettings *settings) +tpaw_account_settings_get_service (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->service; } void -empathy_account_settings_set_service (EmpathyAccountSettings *settings, +tpaw_account_settings_set_service (TpawAccountSettings *settings, const gchar *service) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); if (!tp_strdiff (priv->service, service)) return; @@ -672,34 +672,34 @@ empathy_account_settings_set_service (EmpathyAccountSettings *settings, } gchar * -empathy_account_settings_get_icon_name (EmpathyAccountSettings *settings) +tpaw_account_settings_get_icon_name (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->icon_name; } const gchar * -empathy_account_settings_get_display_name (EmpathyAccountSettings *settings) +tpaw_account_settings_get_display_name (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->display_name; } TpAccount * -empathy_account_settings_get_account (EmpathyAccountSettings *settings) +tpaw_account_settings_get_account (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return priv->account; } static gboolean -empathy_account_settings_is_unset (EmpathyAccountSettings *settings, +tpaw_account_settings_is_unset (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GArray *a; guint i; @@ -715,26 +715,26 @@ empathy_account_settings_is_unset (EmpathyAccountSettings *settings, } static const TpConnectionManagerParam * -empathy_account_settings_get_tp_param (EmpathyAccountSettings *settings, +tpaw_account_settings_get_tp_param (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); return tp_protocol_get_param (priv->protocol_obj, param); } gboolean -empathy_account_settings_have_tp_param (EmpathyAccountSettings *settings, +tpaw_account_settings_have_tp_param (TpawAccountSettings *settings, const gchar *param) { - return (empathy_account_settings_get_tp_param (settings, param) != NULL); + return (tpaw_account_settings_get_tp_param (settings, param) != NULL); } static void -account_settings_remove_from_unset (EmpathyAccountSettings *settings, +account_settings_remove_from_unset (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); guint idx; gchar *val; @@ -754,12 +754,12 @@ account_settings_remove_from_unset (EmpathyAccountSettings *settings, } GVariant * -empathy_account_settings_dup_default (EmpathyAccountSettings *settings, +tpaw_account_settings_dup_default (TpawAccountSettings *settings, const gchar *param) { const TpConnectionManagerParam *p; - p = empathy_account_settings_get_tp_param (settings, param); + p = tpaw_account_settings_get_tp_param (settings, param); if (p == NULL) return NULL; @@ -767,12 +767,12 @@ empathy_account_settings_dup_default (EmpathyAccountSettings *settings, } const gchar * -empathy_account_settings_get_dbus_signature (EmpathyAccountSettings *settings, +tpaw_account_settings_get_dbus_signature (TpawAccountSettings *settings, const gchar *param) { const TpConnectionManagerParam *p; - p = empathy_account_settings_get_tp_param (settings, param); + p = tpaw_account_settings_get_tp_param (settings, param); if (p == NULL) return NULL; @@ -781,10 +781,10 @@ empathy_account_settings_get_dbus_signature (EmpathyAccountSettings *settings, } static GVariant * -empathy_account_settings_dup (EmpathyAccountSettings *settings, +tpaw_account_settings_dup (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GVariant *result; /* Lookup the update parameters we set */ @@ -794,7 +794,7 @@ empathy_account_settings_dup (EmpathyAccountSettings *settings, /* If the parameters isn't unset use the accounts setting if any */ if (priv->account != NULL - && !empathy_account_settings_is_unset (settings, param)) + && !tpaw_account_settings_is_unset (settings, param)) { GVariant *parameters; @@ -808,16 +808,16 @@ empathy_account_settings_dup (EmpathyAccountSettings *settings, } /* fallback to the default */ - return empathy_account_settings_dup_default (settings, param); + return tpaw_account_settings_dup_default (settings, param); } void -empathy_account_settings_unset (EmpathyAccountSettings *settings, +tpaw_account_settings_unset (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); gchar *v; - if (empathy_account_settings_is_unset (settings, param)) + if (tpaw_account_settings_is_unset (settings, param)) return; if (priv->supports_sasl && !tp_strdiff (param, "password")) @@ -834,12 +834,12 @@ empathy_account_settings_unset (EmpathyAccountSettings *settings, } void -empathy_account_settings_discard_changes (EmpathyAccountSettings *settings) +tpaw_account_settings_discard_changes (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); g_hash_table_remove_all (priv->parameters); - empathy_account_settings_free_unset_parameters (settings); + tpaw_account_settings_free_unset_parameters (settings); g_free (priv->password); priv->password = g_strdup (priv->password_original); @@ -851,10 +851,10 @@ empathy_account_settings_discard_changes (EmpathyAccountSettings *settings) } gchar * -empathy_account_settings_dup_string (EmpathyAccountSettings *settings, +tpaw_account_settings_dup_string (TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GVariant *v; gchar *result = NULL; @@ -863,7 +863,7 @@ empathy_account_settings_dup_string (EmpathyAccountSettings *settings, return g_strdup (priv->password); } - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return NULL; @@ -875,13 +875,13 @@ empathy_account_settings_dup_string (EmpathyAccountSettings *settings, } GStrv -empathy_account_settings_dup_strv (EmpathyAccountSettings *settings, +tpaw_account_settings_dup_strv (TpawAccountSettings *settings, const gchar *param) { GVariant *v; GStrv result = NULL; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return NULL; @@ -893,13 +893,13 @@ empathy_account_settings_dup_strv (EmpathyAccountSettings *settings, } gint32 -empathy_account_settings_get_int32 (EmpathyAccountSettings *settings, +tpaw_account_settings_get_int32 (TpawAccountSettings *settings, const gchar *param) { GVariant *v; gint32 ret = 0; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return 0; @@ -928,13 +928,13 @@ empathy_account_settings_get_int32 (EmpathyAccountSettings *settings, } gint64 -empathy_account_settings_get_int64 (EmpathyAccountSettings *settings, +tpaw_account_settings_get_int64 (TpawAccountSettings *settings, const gchar *param) { GVariant *v; gint64 ret = 0; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return 0; @@ -962,13 +962,13 @@ empathy_account_settings_get_int64 (EmpathyAccountSettings *settings, } guint32 -empathy_account_settings_get_uint32 (EmpathyAccountSettings *settings, +tpaw_account_settings_get_uint32 (TpawAccountSettings *settings, const gchar *param) { GVariant *v; guint32 ret = 0; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return 0; @@ -996,13 +996,13 @@ empathy_account_settings_get_uint32 (EmpathyAccountSettings *settings, } guint64 -empathy_account_settings_get_uint64 (EmpathyAccountSettings *settings, +tpaw_account_settings_get_uint64 (TpawAccountSettings *settings, const gchar *param) { GVariant *v; guint64 ret = 0; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return 0; @@ -1031,13 +1031,13 @@ empathy_account_settings_get_uint64 (EmpathyAccountSettings *settings, } gboolean -empathy_account_settings_get_boolean (EmpathyAccountSettings *settings, +tpaw_account_settings_get_boolean (TpawAccountSettings *settings, const gchar *param) { GVariant *v; gboolean result = FALSE; - v = empathy_account_settings_dup (settings, param); + v = tpaw_account_settings_dup (settings, param); if (v == NULL) return result; @@ -1048,11 +1048,11 @@ empathy_account_settings_get_boolean (EmpathyAccountSettings *settings, } void -empathy_account_settings_set (EmpathyAccountSettings *settings, +tpaw_account_settings_set (TpawAccountSettings *settings, const gchar *param, GVariant *v) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); g_return_if_fail (param != NULL); g_return_if_fail (v != NULL); @@ -1094,19 +1094,19 @@ account_settings_display_name_set_cb (GObject *src, } void -empathy_account_settings_set_display_name_async ( - EmpathyAccountSettings *settings, +tpaw_account_settings_set_display_name_async ( + TpawAccountSettings *settings, const gchar *name, GAsyncReadyCallback callback, gpointer user_data) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GSimpleAsyncResult *result; g_return_if_fail (name != NULL); result = g_simple_async_result_new (G_OBJECT (settings), - callback, user_data, empathy_account_settings_set_display_name_finish); + callback, user_data, tpaw_account_settings_set_display_name_finish); if (!tp_strdiff (name, priv->display_name)) { @@ -1129,8 +1129,8 @@ empathy_account_settings_set_display_name_async ( } gboolean -empathy_account_settings_set_display_name_finish ( - EmpathyAccountSettings *settings, +tpaw_account_settings_set_display_name_finish ( + TpawAccountSettings *settings, GAsyncResult *result, GError **error) { @@ -1139,7 +1139,7 @@ empathy_account_settings_set_display_name_finish ( return FALSE; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (settings), empathy_account_settings_set_display_name_finish), + G_OBJECT (settings), tpaw_account_settings_set_display_name_finish), FALSE); return TRUE; @@ -1167,19 +1167,19 @@ account_settings_icon_name_set_cb (GObject *src, } void -empathy_account_settings_set_icon_name_async ( - EmpathyAccountSettings *settings, +tpaw_account_settings_set_icon_name_async ( + TpawAccountSettings *settings, const gchar *name, GAsyncReadyCallback callback, gpointer user_data) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GSimpleAsyncResult *result; g_return_if_fail (name != NULL); result = g_simple_async_result_new (G_OBJECT (settings), - callback, user_data, empathy_account_settings_set_icon_name_finish); + callback, user_data, tpaw_account_settings_set_icon_name_finish); if (priv->account == NULL) { @@ -1198,8 +1198,8 @@ empathy_account_settings_set_icon_name_async ( } gboolean -empathy_account_settings_set_icon_name_finish ( - EmpathyAccountSettings *settings, +tpaw_account_settings_set_icon_name_finish ( + TpawAccountSettings *settings, GAsyncResult *result, GError **error) { @@ -1208,20 +1208,20 @@ empathy_account_settings_set_icon_name_finish ( return FALSE; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (settings), empathy_account_settings_set_icon_name_finish), + G_OBJECT (settings), tpaw_account_settings_set_icon_name_finish), FALSE); return TRUE; } static void -empathy_account_settings_processed_password (GObject *source, +tpaw_account_settings_processed_password (GObject *source, GAsyncResult *result, gpointer user_data, gpointer finish_func) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data); - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (user_data); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GSimpleAsyncResult *r; GError *error = NULL; gboolean (*func) (TpAccount *source, GAsyncResult *result, GError **error) = @@ -1236,7 +1236,7 @@ empathy_account_settings_processed_password (GObject *source, g_error_free (error); } - empathy_account_settings_discard_changes (settings); + tpaw_account_settings_discard_changes (settings); r = priv->apply_result; priv->apply_result = NULL; @@ -1246,27 +1246,27 @@ empathy_account_settings_processed_password (GObject *source, } static void -empathy_account_settings_set_password_cb (GObject *source, +tpaw_account_settings_set_password_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - empathy_account_settings_processed_password (source, result, user_data, + tpaw_account_settings_processed_password (source, result, user_data, empathy_keyring_set_account_password_finish); } static void -empathy_account_settings_delete_password_cb (GObject *source, +tpaw_account_settings_delete_password_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - empathy_account_settings_processed_password (source, result, user_data, + tpaw_account_settings_processed_password (source, result, user_data, empathy_keyring_delete_account_password_finish); } static void -update_account_uri_schemes (EmpathyAccountSettings *self) +update_account_uri_schemes (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); if (priv->uri_scheme_tel == empathy_account_has_uri_scheme_tel ( priv->account)) @@ -1291,9 +1291,9 @@ set_service_cb (GObject *source, } static void -update_account_service (EmpathyAccountSettings *self) +update_account_service (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); if (!priv->update_service) return; @@ -1303,12 +1303,12 @@ update_account_service (EmpathyAccountSettings *self) } static void -empathy_account_settings_account_updated (GObject *source, +tpaw_account_settings_account_updated (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data); - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (user_data); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GSimpleAsyncResult *r; GError *error = NULL; GStrv reconnect_required = NULL; @@ -1337,19 +1337,19 @@ empathy_account_settings_account_updated (GObject *source, * at this point (fdo #35382). */ empathy_keyring_set_account_password_async (priv->account, priv->password, priv->remember_password, - empathy_account_settings_set_password_cb, settings); + tpaw_account_settings_set_password_cb, settings); } else { empathy_keyring_delete_account_password_async (priv->account, - empathy_account_settings_delete_password_cb, settings); + tpaw_account_settings_delete_password_cb, settings); } return; } out: - empathy_account_settings_discard_changes (settings); + tpaw_account_settings_discard_changes (settings); r = priv->apply_result; priv->apply_result = NULL; @@ -1360,12 +1360,12 @@ out: } static void -empathy_account_settings_created_cb (GObject *source, +tpaw_account_settings_created_cb (GObject *source, GAsyncResult *result, gpointer user_data) { - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (user_data); - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (user_data); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GError *error = NULL; GSimpleAsyncResult *r; @@ -1386,14 +1386,14 @@ empathy_account_settings_created_cb (GObject *source, * at this point (fdo #35382). */ empathy_keyring_set_account_password_async (priv->account, priv->password, priv->remember_password, - empathy_account_settings_set_password_cb, + tpaw_account_settings_set_password_cb, settings); return; } update_account_uri_schemes (settings); - empathy_account_settings_discard_changes (settings); + tpaw_account_settings_discard_changes (settings); } r = priv->apply_result; @@ -1404,9 +1404,9 @@ empathy_account_settings_created_cb (GObject *source, } static void -empathy_account_settings_do_create_account (EmpathyAccountSettings *self) +tpaw_account_settings_do_create_account (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); TpAccountRequest *account_req; TpConnectionPresenceType type; gchar *status; @@ -1452,13 +1452,13 @@ empathy_account_settings_do_create_account (EmpathyAccountSettings *self) } tp_account_request_create_account_async (account_req, - empathy_account_settings_created_cb, self); + tpaw_account_settings_created_cb, self); } static GVariant * -build_parameters_variant (EmpathyAccountSettings *self) +build_parameters_variant (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); GVariantBuilder *builder; GHashTableIter iter; gpointer k, v; @@ -1482,11 +1482,11 @@ build_parameters_variant (EmpathyAccountSettings *self) } void -empathy_account_settings_apply_async (EmpathyAccountSettings *settings, +tpaw_account_settings_apply_async (TpawAccountSettings *settings, GAsyncReadyCallback callback, gpointer user_data) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); if (priv->apply_result != NULL) { @@ -1497,7 +1497,7 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings, } priv->apply_result = g_simple_async_result_new (G_OBJECT (settings), - callback, user_data, empathy_account_settings_apply_finish); + callback, user_data, tpaw_account_settings_apply_finish); /* We'll have to reconnect only if we change none DBus_Property on an * existing account. */ @@ -1507,19 +1507,19 @@ empathy_account_settings_apply_async (EmpathyAccountSettings *settings, { g_assert (priv->apply_result != NULL && priv->account == NULL); - empathy_account_settings_do_create_account (settings); + tpaw_account_settings_do_create_account (settings); } else { tp_account_update_parameters_vardict_async (priv->account, build_parameters_variant (settings), (const gchar **) priv->unset_parameters->data, - empathy_account_settings_account_updated, settings); + tpaw_account_settings_account_updated, settings); } } gboolean -empathy_account_settings_apply_finish (EmpathyAccountSettings *settings, +tpaw_account_settings_apply_finish (TpawAccountSettings *settings, GAsyncResult *result, gboolean *reconnect_required, GError **error) @@ -1529,7 +1529,7 @@ empathy_account_settings_apply_finish (EmpathyAccountSettings *settings, return FALSE; g_return_val_if_fail (g_simple_async_result_is_valid (result, - G_OBJECT (settings), empathy_account_settings_apply_finish), FALSE); + G_OBJECT (settings), tpaw_account_settings_apply_finish), FALSE); if (reconnect_required != NULL) *reconnect_required = g_simple_async_result_get_op_res_gboolean ( @@ -1539,14 +1539,14 @@ empathy_account_settings_apply_finish (EmpathyAccountSettings *settings, } gboolean -empathy_account_settings_has_account (EmpathyAccountSettings *settings, +tpaw_account_settings_has_account (TpawAccountSettings *settings, TpAccount *account) { - EmpathyAccountSettingsPriv *priv; + TpawAccountSettingsPriv *priv; const gchar *account_path; const gchar *priv_account_path; - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), FALSE); + g_return_val_if_fail (TPAW_IS_ACCOUNT_SETTINGS (settings), FALSE); g_return_val_if_fail (TP_IS_ACCOUNT (account), FALSE); priv = GET_PRIV (settings); @@ -1561,11 +1561,11 @@ empathy_account_settings_has_account (EmpathyAccountSettings *settings, } void -empathy_account_settings_set_regex (EmpathyAccountSettings *settings, +tpaw_account_settings_set_regex (TpawAccountSettings *settings, const gchar *param, const gchar *pattern) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (settings); + TpawAccountSettingsPriv *priv = GET_PRIV (settings); GRegex *regex; GError *error = NULL; @@ -1581,14 +1581,14 @@ empathy_account_settings_set_regex (EmpathyAccountSettings *settings, } gboolean -empathy_account_settings_parameter_is_valid ( - EmpathyAccountSettings *settings, +tpaw_account_settings_parameter_is_valid ( + TpawAccountSettings *settings, const gchar *param) { - EmpathyAccountSettingsPriv *priv; + TpawAccountSettingsPriv *priv; const GRegex *regex; - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), FALSE); + g_return_val_if_fail (TPAW_IS_ACCOUNT_SETTINGS (settings), FALSE); priv = GET_PRIV (settings); @@ -1600,7 +1600,7 @@ empathy_account_settings_parameter_is_valid ( /* if we did not unset the parameter, look if it's in the account */ if (priv->account != NULL && - !empathy_account_settings_is_unset (settings, param)) + !tpaw_account_settings_is_unset (settings, param)) { const GHashTable *account_params; @@ -1620,7 +1620,7 @@ test_regex: gchar *value; gboolean match; - value = empathy_account_settings_dup_string (settings, param); + value = tpaw_account_settings_dup_string (settings, param); if (value == NULL) return FALSE; @@ -1634,27 +1634,27 @@ test_regex: } gboolean -empathy_account_settings_is_valid (EmpathyAccountSettings *settings) +tpaw_account_settings_is_valid (TpawAccountSettings *settings) { - EmpathyAccountSettingsPriv *priv; + TpawAccountSettingsPriv *priv; const gchar *param; GHashTableIter iter; GList *l; - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), FALSE); + g_return_val_if_fail (TPAW_IS_ACCOUNT_SETTINGS (settings), FALSE); priv = GET_PRIV (settings); for (l = priv->required_params; l; l = l->next) { - if (!empathy_account_settings_parameter_is_valid (settings, l->data)) + if (!tpaw_account_settings_parameter_is_valid (settings, l->data)) return FALSE; } g_hash_table_iter_init (&iter, priv->param_regexps); while (g_hash_table_iter_next (&iter, (gpointer *) ¶m, NULL)) { - if (!empathy_account_settings_parameter_is_valid (settings, param)) + if (!tpaw_account_settings_parameter_is_valid (settings, param)) return FALSE; } @@ -1662,63 +1662,63 @@ empathy_account_settings_is_valid (EmpathyAccountSettings *settings) } TpProtocol * -empathy_account_settings_get_tp_protocol (EmpathyAccountSettings *self) +tpaw_account_settings_get_tp_protocol (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); return priv->protocol_obj; } gboolean -empathy_account_settings_supports_sasl (EmpathyAccountSettings *self) +tpaw_account_settings_supports_sasl (TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); return priv->supports_sasl; } gboolean -empathy_account_settings_param_is_supported (EmpathyAccountSettings *self, +tpaw_account_settings_param_is_supported (TpawAccountSettings *self, const gchar *param) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); return tp_protocol_has_param (priv->protocol_obj, param); } void -empathy_account_settings_set_uri_scheme_tel (EmpathyAccountSettings *self, +tpaw_account_settings_set_uri_scheme_tel (TpawAccountSettings *self, gboolean associate) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); priv->uri_scheme_tel = associate; } gboolean -empathy_account_settings_has_uri_scheme_tel ( - EmpathyAccountSettings *self) +tpaw_account_settings_has_uri_scheme_tel ( + TpawAccountSettings *self) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); return priv->uri_scheme_tel; } void -empathy_account_settings_set_storage_provider (EmpathyAccountSettings *self, +tpaw_account_settings_set_storage_provider (TpawAccountSettings *self, const gchar *storage) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); g_free (priv->storage_provider); priv->storage_provider = g_strdup (storage); } void -empathy_account_settings_set_remember_password (EmpathyAccountSettings *self, +tpaw_account_settings_set_remember_password (TpawAccountSettings *self, gboolean remember) { - EmpathyAccountSettingsPriv *priv = GET_PRIV (self); + TpawAccountSettingsPriv *priv = GET_PRIV (self); priv->remember_password = remember; } diff --git a/tp-account-widgets/tpaw-account-settings.h b/tp-account-widgets/tpaw-account-settings.h new file mode 100644 index 000000000..ad0c70aa5 --- /dev/null +++ b/tp-account-widgets/tpaw-account-settings.h @@ -0,0 +1,204 @@ +/* + * tpaw-account-settings.h - Header for TpawAccountSettings + * Copyright (C) 2009 Collabora Ltd. + * @author Sjoerd Simons <sjoerd.simons@collabora.co.uk> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef __TPAW_ACCOUNT_SETTINGS_H__ +#define __TPAW_ACCOUNT_SETTINGS_H__ + +#include <glib-object.h> +#include <gio/gio.h> +#include <telepathy-glib/telepathy-glib.h> + +G_BEGIN_DECLS + +typedef struct _TpawAccountSettings TpawAccountSettings; +typedef struct _TpawAccountSettingsClass TpawAccountSettingsClass; + +struct _TpawAccountSettingsClass { + GObjectClass parent_class; +}; + +struct _TpawAccountSettings { + GObject parent; + gpointer priv; +}; + +GType tpaw_account_settings_get_type (void); + +/* TYPE MACROS */ +#define TPAW_TYPE_ACCOUNT_SETTINGS \ + (tpaw_account_settings_get_type ()) +#define TPAW_ACCOUNT_SETTINGS(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST((obj), \ + TPAW_TYPE_ACCOUNT_SETTINGS, TpawAccountSettings)) +#define TPAW_ACCOUNT_SETTINGS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_CAST((klass), TPAW_TYPE_ACCOUNT_SETTINGS, \ + TpawAccountSettingsClass)) +#define TPAW_IS_ACCOUNT_SETTINGS(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), TPAW_TYPE_ACCOUNT_SETTINGS)) +#define TPAW_IS_ACCOUNT_SETTINGS_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), TPAW_TYPE_ACCOUNT_SETTINGS)) +#define TPAW_ACCOUNT_SETTINGS_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS ((obj), TPAW_TYPE_ACCOUNT_SETTINGS, \ + TpawAccountSettingsClass)) + +TpawAccountSettings * tpaw_account_settings_new ( + const gchar *connection_manager, + const gchar *protocol, + const gchar *service, + const char *display_name); + +TpawAccountSettings * tpaw_account_settings_new_for_account ( + TpAccount *account); + +gboolean tpaw_account_settings_is_ready (TpawAccountSettings *settings); + +const gchar *tpaw_account_settings_get_cm (TpawAccountSettings *settings); +const gchar *tpaw_account_settings_get_protocol ( + TpawAccountSettings *settings); + +const gchar *tpaw_account_settings_get_service ( + TpawAccountSettings *settings); + +void tpaw_account_settings_set_service (TpawAccountSettings *settings, + const gchar *service); + +TpAccount *tpaw_account_settings_get_account ( + TpawAccountSettings *settings); + +gboolean tpaw_account_settings_has_account ( + TpawAccountSettings *settings, TpAccount *account); + +GList * tpaw_account_settings_dup_tp_params ( + TpawAccountSettings *settings); + +gboolean tpaw_account_settings_have_tp_param ( + TpawAccountSettings *settings, + const gchar *param); + +void tpaw_account_settings_unset (TpawAccountSettings *settings, + const gchar *param); + +void tpaw_account_settings_discard_changes ( + TpawAccountSettings *settings); + +const gchar * +tpaw_account_settings_get_dbus_signature (TpawAccountSettings *setting, + const gchar *param); + +GVariant * +tpaw_account_settings_dup_default (TpawAccountSettings *settings, + const gchar *param); + +gchar * tpaw_account_settings_dup_string ( + TpawAccountSettings *settings, + const gchar *param); +GStrv tpaw_account_settings_dup_strv ( + TpawAccountSettings *settings, + const gchar *param); + +gint32 tpaw_account_settings_get_int32 (TpawAccountSettings *settings, + const gchar *param); +gint64 tpaw_account_settings_get_int64 (TpawAccountSettings *settings, + const gchar *param); +guint32 tpaw_account_settings_get_uint32 (TpawAccountSettings *settings, + const gchar *param); +guint64 tpaw_account_settings_get_uint64 (TpawAccountSettings *settings, + const gchar *param); +gboolean tpaw_account_settings_get_boolean (TpawAccountSettings *settings, + const gchar *param); + +void tpaw_account_settings_set (TpawAccountSettings *settings, + const gchar *param, + GVariant *v); + +gchar *tpaw_account_settings_get_icon_name ( + TpawAccountSettings *settings); + +void tpaw_account_settings_set_icon_name_async ( + TpawAccountSettings *settings, + const gchar *name, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean tpaw_account_settings_set_icon_name_finish ( + TpawAccountSettings *settings, + GAsyncResult *result, + GError **error); + +const gchar *tpaw_account_settings_get_display_name ( + TpawAccountSettings *settings); + +void tpaw_account_settings_set_display_name_async ( + TpawAccountSettings *settings, + const gchar *name, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean tpaw_account_settings_set_display_name_finish ( + TpawAccountSettings *settings, + GAsyncResult *result, + GError **error); + +void tpaw_account_settings_apply_async (TpawAccountSettings *settings, + GAsyncReadyCallback callback, + gpointer user_data); + +gboolean tpaw_account_settings_apply_finish ( + TpawAccountSettings *settings, + GAsyncResult *result, + gboolean *reconnect_required, + GError **error); + +void tpaw_account_settings_set_regex (TpawAccountSettings *settings, + const gchar *param, + const gchar *regex); + +gboolean tpaw_account_settings_parameter_is_valid ( + TpawAccountSettings *settings, + const gchar *param); + +gboolean tpaw_account_settings_is_valid (TpawAccountSettings *settings); + +TpProtocol * tpaw_account_settings_get_tp_protocol ( + TpawAccountSettings *settings); + +gboolean tpaw_account_settings_supports_sasl (TpawAccountSettings *self); + +gboolean tpaw_account_settings_param_is_supported ( + TpawAccountSettings *self, + const gchar *param); + +void tpaw_account_settings_set_uri_scheme_tel (TpawAccountSettings *self, + gboolean associate); + +gboolean tpaw_account_settings_has_uri_scheme_tel ( + TpawAccountSettings *self); + +void tpaw_account_settings_set_storage_provider ( + TpawAccountSettings *self, + const gchar *storage); + +void tpaw_account_settings_set_remember_password ( + TpawAccountSettings *self, + gboolean remember); + +G_END_DECLS + +#endif /* #ifndef __TPAW_ACCOUNT_SETTINGS_H__*/ diff --git a/tp-account-widgets/tpaw-account-widget-irc.c b/tp-account-widgets/tpaw-account-widget-irc.c index f98394bf9..a547a2309 100644 --- a/tp-account-widgets/tpaw-account-widget-irc.c +++ b/tp-account-widgets/tpaw-account-widget-irc.c @@ -47,19 +47,19 @@ account_widget_irc_setup (TpawAccountWidgetIrc *settings) { gchar *nick = NULL; gchar *fullname = NULL; - EmpathyAccountSettings *ac_settings; + TpawAccountSettings *ac_settings; g_object_get (settings->self, "settings", &ac_settings, NULL); - nick = empathy_account_settings_dup_string (ac_settings, "account"); - fullname = empathy_account_settings_dup_string (ac_settings, + nick = tpaw_account_settings_dup_string (ac_settings, "account"); + fullname = tpaw_account_settings_dup_string (ac_settings, "fullname"); if (nick == NULL) { nick = g_strdup (g_get_user_name ()); - empathy_account_settings_set (ac_settings, + tpaw_account_settings_set (ac_settings, "account", g_variant_new_string (nick)); } @@ -70,7 +70,7 @@ account_widget_irc_setup (TpawAccountWidgetIrc *settings) if (fullname == NULL) fullname = g_strdup (nick); - empathy_account_settings_set (ac_settings, + tpaw_account_settings_set (ac_settings, "fullname", g_variant_new_string (fullname)); } @@ -95,18 +95,18 @@ network_changed_cb (TpawIrcNetworkChooser *chooser, * Return: %TRUE if the password-prompt param has been changed */ static gboolean -set_password_prompt_if_needed (EmpathyAccountSettings *ac_settings, +set_password_prompt_if_needed (TpawAccountSettings *ac_settings, const gchar *password) { gboolean prompt; prompt = !tp_str_empty (password); - if (prompt == empathy_account_settings_get_boolean (ac_settings, + if (prompt == tpaw_account_settings_get_boolean (ac_settings, "password-prompt")) return FALSE; - empathy_account_settings_set (ac_settings, "password-prompt", + tpaw_account_settings_set (ac_settings, "password-prompt", g_variant_new_boolean (prompt)); return TRUE; @@ -117,7 +117,7 @@ entry_password_changed_cb (GtkEntry *entry, TpawAccountWidgetIrc *settings) { const gchar *password; - EmpathyAccountSettings *ac_settings; + TpawAccountSettings *ac_settings; g_object_get (settings->self, "settings", &ac_settings, NULL); @@ -135,7 +135,7 @@ tpaw_account_widget_irc_build (TpawAccountWidget *self, GtkWidget **box) { TpawAccountWidgetIrc *settings; - EmpathyAccountSettings *ac_settings; + TpawAccountSettings *ac_settings; GtkWidget *entry_password; gchar *password; @@ -181,12 +181,12 @@ tpaw_account_widget_irc_build (TpawAccountWidget *self, g_object_unref (ac_settings); /* Automatically set password-prompt when needed */ - password = empathy_account_settings_dup_string (ac_settings, "password"); + password = tpaw_account_settings_dup_string (ac_settings, "password"); if (set_password_prompt_if_needed (ac_settings, password)) { /* Apply right now to save password-prompt */ - empathy_account_settings_apply_async (ac_settings, NULL, NULL); + tpaw_account_settings_apply_async (ac_settings, NULL, NULL); } g_free (password); @@ -203,7 +203,7 @@ tpaw_account_widget_irc_build_simple (TpawAccountWidget *self, GtkWidget **box) { TpawAccountWidgetIrc *settings; - EmpathyAccountSettings *ac_settings; + TpawAccountSettings *ac_settings; GtkAlignment *alignment; settings = g_slice_new0 (TpawAccountWidgetIrc); diff --git a/tp-account-widgets/tpaw-account-widget-sip.c b/tp-account-widgets/tpaw-account-widget-sip.c index b28b0897d..44d5aecf3 100644 --- a/tp-account-widgets/tpaw-account-widget-sip.c +++ b/tp-account-widgets/tpaw-account-widget-sip.c @@ -89,11 +89,11 @@ checkbutton_tel_toggled ( GtkWidget *checkbox, TpawAccountWidgetSip *sip_settings) { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; settings = tpaw_account_widget_get_settings (sip_settings->self); - empathy_account_settings_set_uri_scheme_tel (settings, + tpaw_account_settings_set_uri_scheme_tel (settings, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox))); tpaw_account_widget_changed (sip_settings->self); @@ -149,7 +149,7 @@ tpaw_account_widget_sip_build (TpawAccountWidget *self, settings->vbox_settings = vbox_settings; gtk_toggle_button_set_active (checkbutton_tel, - empathy_account_settings_has_uri_scheme_tel ( + tpaw_account_settings_has_uri_scheme_tel ( tpaw_account_widget_get_settings (self))); tpaw_account_widget_handle_params (self, diff --git a/tp-account-widgets/tpaw-account-widget.c b/tp-account-widgets/tpaw-account-widget.c index 8bc3a91d7..fcde66f36 100644 --- a/tp-account-widgets/tpaw-account-widget.c +++ b/tp-account-widgets/tpaw-account-widget.c @@ -62,7 +62,7 @@ static ServiceInfo services_infos[N_SERVICES] = { }; struct _TpawAccountWidgetPriv { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; GtkWidget *grid_common_settings; GtkWidget *apply_button; @@ -243,7 +243,7 @@ account_widget_handle_control_buttons_sensitivity (TpawAccountWidget *self) { gboolean is_valid; - is_valid = empathy_account_settings_is_valid (self->priv->settings); + is_valid = tpaw_account_settings_is_valid (self->priv->settings); account_widget_set_control_buttons_sensitivity (self, is_valid); @@ -261,18 +261,18 @@ account_widget_entry_changed_common (TpawAccountWidget *self, str = gtk_entry_get_text (entry); param_name = g_object_get_data (G_OBJECT (entry), "param_name"); - prev_status = empathy_account_settings_parameter_is_valid ( + prev_status = tpaw_account_settings_parameter_is_valid ( self->priv->settings, param_name); if (EMP_STR_EMPTY (str)) { - empathy_account_settings_unset (self->priv->settings, param_name); + tpaw_account_settings_unset (self->priv->settings, param_name); if (focus) { gchar *value; - value = empathy_account_settings_dup_string (self->priv->settings, + value = tpaw_account_settings_dup_string (self->priv->settings, param_name); DEBUG ("Unset %s and restore to %s", param_name, value); @@ -284,11 +284,11 @@ account_widget_entry_changed_common (TpawAccountWidget *self, { DEBUG ("Setting %s to %s", param_name, tp_strdiff (param_name, "password") ? str : "***"); - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_string (str)); } - curr_status = empathy_account_settings_parameter_is_valid ( + curr_status = tpaw_account_settings_parameter_is_valid ( self->priv->settings, param_name); if (curr_status != prev_status) @@ -315,7 +315,7 @@ account_widget_entry_map_cb (GtkEntry *entry, /* need to initialize input highlighting */ param_name = g_object_get_data (G_OBJECT (entry), "param_name"); - is_valid = empathy_account_settings_parameter_is_valid (self->priv->settings, + is_valid = tpaw_account_settings_parameter_is_valid (self->priv->settings, param_name); account_widget_set_entry_highlighting (entry, !is_valid); } @@ -331,7 +331,7 @@ account_widget_int_changed_cb (GtkWidget *widget, value = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); param_name = g_object_get_data (G_OBJECT (widget), "param_name"); - signature = empathy_account_settings_get_dbus_signature (self->priv->settings, + signature = tpaw_account_settings_get_dbus_signature (self->priv->settings, param_name); g_return_if_fail (signature != NULL); @@ -341,20 +341,20 @@ account_widget_int_changed_cb (GtkWidget *widget, { case DBUS_TYPE_INT16: case DBUS_TYPE_INT32: - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_int32 (value)); break; case DBUS_TYPE_INT64: - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_int64 (value)); break; case DBUS_TYPE_UINT16: case DBUS_TYPE_UINT32: - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_uint32 (value)); break; case DBUS_TYPE_UINT64: - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_uint64 (value)); break; default: @@ -378,8 +378,8 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, /* FIXME: This is ugly! checkbox don't have a "not-set" value so we * always unset the param and set the value if different from the * default value. */ - empathy_account_settings_unset (self->priv->settings, param_name); - default_value = empathy_account_settings_get_boolean (self->priv->settings, + tpaw_account_settings_unset (self->priv->settings, param_name); + default_value = tpaw_account_settings_get_boolean (self->priv->settings, param_name); if (default_value == value) @@ -389,7 +389,7 @@ account_widget_checkbutton_toggled_cb (GtkWidget *widget, else { DEBUG ("Setting %s to %d", param_name, value); - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_boolean (value)); } @@ -404,7 +404,7 @@ account_widget_jabber_ssl_toggled_cb (GtkWidget *checkbutton_ssl, gint32 port = 0; value = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbutton_ssl)); - port = empathy_account_settings_get_uint32 (self->priv->settings, "port"); + port = tpaw_account_settings_get_uint32 (self->priv->settings, "port"); if (value) { @@ -443,19 +443,19 @@ account_widget_combobox_changed_cb (GtkWidget *widget, param_name = g_object_get_data (G_OBJECT (widget), "param_name"); - v = empathy_account_settings_dup_default (self->priv->settings, param_name); + v = tpaw_account_settings_dup_default (self->priv->settings, param_name); if (v != NULL && g_variant_is_of_type (v, G_VARIANT_TYPE_STRING)) default_value = g_variant_get_string (v, NULL); if (!tp_strdiff (value, default_value)) { DEBUG ("Unset %s and restore to %s", param_name, default_value); - empathy_account_settings_unset (self->priv->settings, param_name); + tpaw_account_settings_unset (self->priv->settings, param_name); } else { DEBUG ("Setting %s to %s", param_name, value); - empathy_account_settings_set (self->priv->settings, param_name, + tpaw_account_settings_set (self->priv->settings, param_name, g_variant_new_string (value)); } @@ -475,7 +475,7 @@ clear_icon_released_cb (GtkEntry *entry, param_name = g_object_get_data (G_OBJECT (entry), "param_name"); DEBUG ("Unset %s", param_name); - empathy_account_settings_unset (self->priv->settings, param_name); + tpaw_account_settings_unset (self->priv->settings, param_name); gtk_entry_set_text (entry, ""); tpaw_account_widget_changed (self); @@ -522,7 +522,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, gint value = 0; const gchar *signature; - signature = empathy_account_settings_get_dbus_signature ( + signature = tpaw_account_settings_get_dbus_signature ( self->priv->settings, param_name); g_return_if_fail (signature != NULL); @@ -530,20 +530,20 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, { case DBUS_TYPE_INT16: case DBUS_TYPE_INT32: - value = empathy_account_settings_get_int32 (self->priv->settings, + value = tpaw_account_settings_get_int32 (self->priv->settings, param_name); break; case DBUS_TYPE_INT64: - value = empathy_account_settings_get_int64 (self->priv->settings, + value = tpaw_account_settings_get_int64 (self->priv->settings, param_name); break; case DBUS_TYPE_UINT16: case DBUS_TYPE_UINT32: - value = empathy_account_settings_get_uint32 (self->priv->settings, + value = tpaw_account_settings_get_uint32 (self->priv->settings, param_name); break; case DBUS_TYPE_UINT64: - value = empathy_account_settings_get_uint64 (self->priv->settings, + value = tpaw_account_settings_get_uint64 (self->priv->settings, param_name); break; default: @@ -560,7 +560,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, { gchar *str; - str = empathy_account_settings_dup_string (self->priv->settings, + str = tpaw_account_settings_dup_string (self->priv->settings, param_name); gtk_entry_set_text (GTK_ENTRY (widget), str ? str : ""); @@ -602,7 +602,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, { gboolean value = FALSE; - value = empathy_account_settings_get_boolean (self->priv->settings, + value = tpaw_account_settings_get_boolean (self->priv->settings, param_name); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), value); @@ -619,7 +619,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, GtkTreeIter iter; gboolean valid; - str = empathy_account_settings_dup_string (self->priv->settings, + str = tpaw_account_settings_dup_string (self->priv->settings, param_name); model = gtk_combo_box_get_model (GTK_COMBO_BOX (widget)); @@ -654,7 +654,7 @@ tpaw_account_widget_setup_widget (TpawAccountWidget *self, } gtk_widget_set_sensitive (widget, - empathy_account_settings_param_is_supported (self->priv->settings, + tpaw_account_settings_param_is_supported (self->priv->settings, param_name)); } @@ -716,7 +716,7 @@ accounts_widget_generic_setup (TpawAccountWidget *self, GList *params, *l; guint row_common = 0, row_advanced = 0; - params = empathy_account_settings_dup_tp_params (self->priv->settings); + params = tpaw_account_settings_dup_tp_params (self->priv->settings); for (l = params; l != NULL; l = g_list_next (l)) { @@ -911,12 +911,12 @@ account_widget_applied_cb (GObject *source_object, { GError *error = NULL; TpAccount *account; - EmpathyAccountSettings *settings = EMPATHY_ACCOUNT_SETTINGS (source_object); + TpawAccountSettings *settings = TPAW_ACCOUNT_SETTINGS (source_object); TpawAccountWidget *self = TPAW_ACCOUNT_WIDGET (user_data); gboolean reconnect_required; gboolean fire_close = TRUE; - empathy_account_settings_apply_finish (settings, res, &reconnect_required, + tpaw_account_settings_apply_finish (settings, res, &reconnect_required, &error); if (error != NULL) @@ -926,7 +926,7 @@ account_widget_applied_cb (GObject *source_object, return; } - account = empathy_account_settings_get_account (self->priv->settings); + account = tpaw_account_settings_get_account (self->priv->settings); if (account != NULL) { @@ -991,7 +991,7 @@ tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self) self->priv->radiobutton_reuse)); DEBUG ("Set register param: %d", !reuse); - empathy_account_settings_set (self->priv->settings, "register", + tpaw_account_settings_set (self->priv->settings, "register", g_variant_new_boolean (!reuse)); } @@ -1006,7 +1006,7 @@ tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self) * manually override it. */ display_name = tpaw_account_widget_get_default_display_name (self); - empathy_account_settings_set_display_name_async (self->priv->settings, + tpaw_account_settings_set_display_name_async (self->priv->settings, display_name, NULL, NULL); g_free (display_name); @@ -1014,7 +1014,7 @@ tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self) /* workaround to keep widget alive during async call */ g_object_ref (self); - empathy_account_settings_apply_async (self->priv->settings, + tpaw_account_settings_apply_async (self->priv->settings, account_widget_applied_cb, self); } @@ -1043,13 +1043,13 @@ account_widget_setup_generic (TpawAccountWidget *self) } static void -account_widget_settings_ready_cb (EmpathyAccountSettings *settings, +account_widget_settings_ready_cb (TpawAccountSettings *settings, GParamSpec *pspec, gpointer user_data) { TpawAccountWidget *self = user_data; - if (empathy_account_settings_is_ready (self->priv->settings)) + if (tpaw_account_settings_is_ready (self->priv->settings)) account_widget_setup_generic (self); } @@ -1070,7 +1070,7 @@ account_widget_build_generic (TpawAccountWidget *self, g_object_ref (self->ui_details->gui); - if (empathy_account_settings_is_ready (self->priv->settings)) + if (tpaw_account_settings_is_ready (self->priv->settings)) account_widget_setup_generic (self); else g_signal_connect (self->priv->settings, "notify::ready", @@ -1114,7 +1114,7 @@ account_widget_build_irc (TpawAccountWidget *self, { GtkWidget *box; - empathy_account_settings_set_regex (self->priv->settings, "account", + tpaw_account_settings_set_regex (self->priv->settings, "account", ACCOUNT_REGEX_IRC); if (self->priv->simple) @@ -1161,7 +1161,7 @@ account_widget_build_msn (TpawAccountWidget *self, { GtkWidget *box; - empathy_account_settings_set_regex (self->priv->settings, "account", + tpaw_account_settings_set_regex (self->priv->settings, "account", ACCOUNT_REGEX_MSN); if (self->priv->simple) @@ -1214,7 +1214,7 @@ suffix_id_widget_changed_cb (GtkWidget *entry, account_widget_entry_changed_common (self, GTK_ENTRY (entry), FALSE); - account = empathy_account_settings_dup_string (self->priv->settings, + account = tpaw_account_settings_dup_string (self->priv->settings, "account"); if (!EMP_STR_EMPTY (account) && @@ -1226,7 +1226,7 @@ suffix_id_widget_changed_cb (GtkWidget *entry, DEBUG ("Change account from '%s' to '%s'", account, tmp); - empathy_account_settings_set (self->priv->settings, "account", + tpaw_account_settings_set (self->priv->settings, "account", g_variant_new_string (tmp)); g_free (tmp); } @@ -1261,7 +1261,7 @@ setup_id_widget_with_suffix (TpawAccountWidget *self, g_assert (self->priv->jid_suffix == NULL); self->priv->jid_suffix = g_strdup (suffix); - str = empathy_account_settings_dup_string (self->priv->settings, "account"); + str = tpaw_account_settings_dup_string (self->priv->settings, "account"); if (str != NULL) { gchar *tmp; @@ -1283,8 +1283,8 @@ account_widget_get_service (TpawAccountWidget *self) { const gchar *icon_name, *service; - icon_name = empathy_account_settings_get_icon_name (self->priv->settings); - service = empathy_account_settings_get_service (self->priv->settings); + icon_name = tpaw_account_settings_get_icon_name (self->priv->settings); + service = tpaw_account_settings_get_service (self->priv->settings); /* Previous versions of Tpaw didn't set the Service property on Facebook * and gtalk accounts, so we check using the icon name as well. */ @@ -1316,7 +1316,7 @@ account_widget_build_jabber (TpawAccountWidget *self, service = account_widget_get_service (self); - empathy_account_settings_set_regex (self->priv->settings, "account", + tpaw_account_settings_set_regex (self->priv->settings, "account", ACCOUNT_REGEX_JABBER); if (self->priv->simple && service == NO_SERVICE) @@ -1330,7 +1330,7 @@ account_widget_build_jabber (TpawAccountWidget *self, "label_password_create", &label_password_create, NULL); - if (empathy_account_settings_get_boolean (self->priv->settings, + if (tpaw_account_settings_get_boolean (self->priv->settings, "register")) { gtk_widget_hide (label_id); @@ -1468,7 +1468,7 @@ account_widget_build_icq (TpawAccountWidget *self, GtkWidget *spinbutton_port; GtkWidget *box; - empathy_account_settings_set_regex (self->priv->settings, "account", + tpaw_account_settings_set_regex (self->priv->settings, "account", ACCOUNT_REGEX_ICQ); if (self->priv->simple) @@ -1566,7 +1566,7 @@ account_widget_build_yahoo (TpawAccountWidget *self, { GtkWidget *box; - empathy_account_settings_set_regex (self->priv->settings, "account", + tpaw_account_settings_set_regex (self->priv->settings, "account", ACCOUNT_REGEX_YAHOO); if (self->priv->simple) @@ -1707,7 +1707,7 @@ do_get_property (GObject *object, { case PROP_PROTOCOL: g_value_set_string (value, - empathy_account_settings_get_protocol (self->priv->settings)); + tpaw_account_settings_get_protocol (self->priv->settings)); break; case PROP_SETTINGS: g_value_set_object (value, self->priv->settings); @@ -1820,7 +1820,7 @@ add_register_buttons (TpawAccountWidget *self, if (!self->priv->creating_account) return; - protocol = empathy_account_settings_get_tp_protocol (self->priv->settings); + protocol = tpaw_account_settings_get_tp_protocol (self->priv->settings); if (protocol == NULL) return; @@ -1853,7 +1853,7 @@ static void remember_password_toggled_cb (GtkToggleButton *button, TpawAccountWidget *self) { - empathy_account_settings_set_remember_password (self->priv->settings, + tpaw_account_settings_set_remember_password (self->priv->settings, gtk_toggle_button_get_active (button)); if (!self->priv->automatic_change) @@ -1867,7 +1867,7 @@ account_settings_password_retrieved_cb (GObject *object, TpawAccountWidget *self = user_data; gchar *password; - password = empathy_account_settings_dup_string ( + password = tpaw_account_settings_dup_string ( self->priv->settings, "password"); /* We have to do this so that when we call gtk_entry_set_text, @@ -1917,10 +1917,10 @@ do_constructed (GObject *obj) const gchar *protocol, *cm_name; GtkWidget *box; - account = empathy_account_settings_get_account (self->priv->settings); + account = tpaw_account_settings_get_account (self->priv->settings); - cm_name = empathy_account_settings_get_cm (self->priv->settings); - protocol = empathy_account_settings_get_protocol (self->priv->settings); + cm_name = tpaw_account_settings_get_cm (self->priv->settings); + protocol = tpaw_account_settings_get_protocol (self->priv->settings); for (i = 0 ; i < G_N_ELEMENTS (widgets); i++) { @@ -1955,7 +1955,7 @@ do_constructed (GObject *obj) /* remember password */ if (self->priv->param_password_widget != NULL && self->priv->remember_password_widget != NULL - && empathy_account_settings_supports_sasl (self->priv->settings)) + && tpaw_account_settings_supports_sasl (self->priv->settings)) { if (self->priv->simple) { @@ -1966,7 +1966,7 @@ do_constructed (GObject *obj) { gchar *password; - password = empathy_account_settings_dup_string (self->priv->settings, + password = tpaw_account_settings_dup_string (self->priv->settings, "password"); /* FIXME: we should enable this checkbox only if the password is @@ -1995,10 +1995,10 @@ do_constructed (GObject *obj) self->priv->automatic_change = FALSE; } else if (self->priv->remember_password_widget != NULL - && !empathy_account_settings_supports_sasl (self->priv->settings)) + && !tpaw_account_settings_supports_sasl (self->priv->settings)) { gtk_widget_set_visible (self->priv->remember_password_widget, FALSE); - empathy_account_settings_set_remember_password (self->priv->settings, + tpaw_account_settings_set_remember_password (self->priv->settings, TRUE); } @@ -2054,7 +2054,7 @@ do_constructed (GObject *obj) g_clear_object (&self->ui_details->gui); - display_name = empathy_account_settings_get_display_name ( + display_name = tpaw_account_settings_get_display_name ( self->priv->settings); default_display_name = tpaw_account_widget_get_default_display_name (self); @@ -2114,7 +2114,7 @@ tpaw_account_widget_class_init (TpawAccountWidgetClass *klass) param_spec = g_param_spec_object ("settings", "settings", "The settings of the account", - EMPATHY_TYPE_ACCOUNT_SETTINGS, + TPAW_TYPE_ACCOUNT_SETTINGS, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS | G_PARAM_CONSTRUCT_ONLY); g_object_class_install_property (oclass, PROP_SETTINGS, param_spec); @@ -2185,7 +2185,7 @@ tpaw_account_widget_init (TpawAccountWidget *self) void tpaw_account_widget_discard_pending_changes (TpawAccountWidget *self) { - empathy_account_settings_discard_changes (self->priv->settings); + tpaw_account_settings_discard_changes (self->priv->settings); self->priv->contains_pending_changes = FALSE; } @@ -2208,17 +2208,17 @@ tpaw_account_widget_handle_params (TpawAccountWidget *self, } TpawAccountWidget * -tpaw_account_widget_new_for_protocol (EmpathyAccountSettings *settings, +tpaw_account_widget_new_for_protocol (TpawAccountSettings *settings, gboolean simple) { - g_return_val_if_fail (EMPATHY_IS_ACCOUNT_SETTINGS (settings), NULL); + g_return_val_if_fail (TPAW_IS_ACCOUNT_SETTINGS (settings), NULL); return g_object_new (TPAW_TYPE_ACCOUNT_WIDGET, "orientation", GTK_ORIENTATION_VERTICAL, "settings", settings, "simple", simple, "creating-account", - empathy_account_settings_get_account (settings) == NULL, + tpaw_account_settings_get_account (settings) == NULL, NULL); } @@ -2230,9 +2230,9 @@ tpaw_account_widget_get_default_display_name (TpawAccountWidget *self) gchar *default_display_name; Service service; - login_id = empathy_account_settings_dup_string (self->priv->settings, + login_id = tpaw_account_settings_dup_string (self->priv->settings, "account"); - protocol = empathy_account_settings_get_protocol (self->priv->settings); + protocol = tpaw_account_settings_get_protocol (self->priv->settings); service = account_widget_get_service (self); if (login_id != NULL) @@ -2317,7 +2317,7 @@ tpaw_account_widget_set_password_param (TpawAccountWidget *self, gtk_entry_set_text (GTK_ENTRY (self->priv->param_password_widget), account); } -EmpathyAccountSettings * +TpawAccountSettings * tpaw_account_widget_get_settings (TpawAccountWidget *self) { return self->priv->settings; diff --git a/tp-account-widgets/tpaw-account-widget.h b/tp-account-widgets/tpaw-account-widget.h index 8ca1000ca..7e2c627ed 100644 --- a/tp-account-widgets/tpaw-account-widget.h +++ b/tp-account-widgets/tpaw-account-widget.h @@ -25,7 +25,7 @@ #include <gtk/gtk.h> -#include "empathy-account-settings.h" +#include "tpaw-account-settings.h" G_BEGIN_DECLS @@ -59,7 +59,7 @@ typedef struct { GType tpaw_account_widget_get_type (void); TpawAccountWidget * tpaw_account_widget_new_for_protocol ( - EmpathyAccountSettings *settings, + TpawAccountSettings *settings, gboolean simple); gboolean tpaw_account_widget_contains_pending_changes @@ -86,7 +86,7 @@ void tpaw_account_widget_apply_and_log_in (TpawAccountWidget *self); /* protected methods */ void tpaw_account_widget_changed (TpawAccountWidget *widget); -EmpathyAccountSettings * tpaw_account_widget_get_settings ( +TpawAccountSettings * tpaw_account_widget_get_settings ( TpawAccountWidget *self); G_END_DECLS diff --git a/tp-account-widgets/tpaw-irc-network-chooser-dialog.c b/tp-account-widgets/tpaw-irc-network-chooser-dialog.c index 2d50b8a00..c7995a56f 100644 --- a/tp-account-widgets/tpaw-irc-network-chooser-dialog.c +++ b/tp-account-widgets/tpaw-irc-network-chooser-dialog.c @@ -46,7 +46,7 @@ enum { }; typedef struct { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpawIrcNetwork *network; TpawIrcNetworkManager *network_manager; @@ -682,8 +682,8 @@ tpaw_irc_network_chooser_dialog_class_init (TpawIrcNetworkChooserDialogClass *kl g_object_class_install_property (object_class, PROP_SETTINGS, g_param_spec_object ("settings", "Settings", - "The EmpathyAccountSettings to show and edit", - EMPATHY_TYPE_ACCOUNT_SETTINGS, + "The TpawAccountSettings to show and edit", + TPAW_TYPE_ACCOUNT_SETTINGS, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, PROP_NETWORK, @@ -710,7 +710,7 @@ tpaw_irc_network_chooser_dialog_init (TpawIrcNetworkChooserDialog *self) } GtkWidget * -tpaw_irc_network_chooser_dialog_new (EmpathyAccountSettings *settings, +tpaw_irc_network_chooser_dialog_new (TpawAccountSettings *settings, TpawIrcNetwork *network, GtkWindow *parent) { diff --git a/tp-account-widgets/tpaw-irc-network-chooser-dialog.h b/tp-account-widgets/tpaw-irc-network-chooser-dialog.h index e20802901..6549b7063 100644 --- a/tp-account-widgets/tpaw-irc-network-chooser-dialog.h +++ b/tp-account-widgets/tpaw-irc-network-chooser-dialog.h @@ -24,7 +24,7 @@ #include <gtk/gtk.h> -#include "empathy-account-settings.h" +#include "tpaw-account-settings.h" #include "tpaw-irc-network.h" G_BEGIN_DECLS @@ -56,7 +56,7 @@ typedef struct { GType tpaw_irc_network_chooser_dialog_get_type (void) G_GNUC_CONST; GtkWidget * tpaw_irc_network_chooser_dialog_new ( - EmpathyAccountSettings *settings, + TpawAccountSettings *settings, TpawIrcNetwork *network, GtkWindow *parent); diff --git a/tp-account-widgets/tpaw-irc-network-chooser.c b/tp-account-widgets/tpaw-irc-network-chooser.c index 9d0ac0133..7a01a56f0 100644 --- a/tp-account-widgets/tpaw-irc-network-chooser.c +++ b/tp-account-widgets/tpaw-irc-network-chooser.c @@ -48,7 +48,7 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; typedef struct { - EmpathyAccountSettings *settings; + TpawAccountSettings *settings; TpawIrcNetworkManager *network_manager; GtkWidget *dialog; @@ -103,9 +103,9 @@ unset_server_params (TpawIrcNetworkChooser *self) TpawIrcNetworkChooserPriv *priv = GET_PRIV (self); DEBUG ("Unset server, port and use-ssl"); - empathy_account_settings_unset (priv->settings, "server"); - empathy_account_settings_unset (priv->settings, "port"); - empathy_account_settings_unset (priv->settings, "use-ssl"); + tpaw_account_settings_unset (priv->settings, "server"); + tpaw_account_settings_unset (priv->settings, "port"); + tpaw_account_settings_unset (priv->settings, "use-ssl"); } static gchar * @@ -153,7 +153,7 @@ update_server_params (TpawIrcNetworkChooser *self) charset = tpaw_irc_network_get_charset (priv->network); DEBUG ("Setting charset to %s", charset); - empathy_account_settings_set (priv->settings, "charset", + tpaw_account_settings_set (priv->settings, "charset", g_variant_new_string (charset)); servers = tpaw_irc_network_get_servers (priv->network); @@ -173,19 +173,19 @@ update_server_params (TpawIrcNetworkChooser *self) NULL); DEBUG ("Setting server to %s", address); - empathy_account_settings_set (priv->settings, "server", + tpaw_account_settings_set (priv->settings, "server", g_variant_new_string (address)); DEBUG ("Setting port to %u", port); - empathy_account_settings_set (priv->settings, "port", + tpaw_account_settings_set (priv->settings, "port", g_variant_new_uint32 (port)); DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" ); - empathy_account_settings_set (priv->settings, "use-ssl", + tpaw_account_settings_set (priv->settings, "use-ssl", g_variant_new_boolean (ssl)); /* Set Account.Service */ service = dup_network_service (priv->network); DEBUG ("Setting Service to %s", service); - empathy_account_settings_set_service (priv->settings, service); + tpaw_account_settings_set_service (priv->settings, service); g_free (address); g_free (service); @@ -219,7 +219,7 @@ set_label_from_settings (TpawIrcNetworkChooser *self) tp_clear_object (&priv->network); - server = empathy_account_settings_dup_string (priv->settings, "server"); + server = tpaw_account_settings_dup_string (priv->settings, "server"); if (server != NULL) { @@ -239,8 +239,8 @@ set_label_from_settings (TpawIrcNetworkChooser *self) } /* We don't have this network. Let's create it */ - port = empathy_account_settings_get_uint32 (priv->settings, "port"); - ssl = empathy_account_settings_get_boolean (priv->settings, + port = tpaw_account_settings_get_uint32 (priv->settings, "port"); + ssl = tpaw_account_settings_get_boolean (priv->settings, "use-ssl"); DEBUG ("Create a network %s", server); @@ -375,8 +375,8 @@ tpaw_irc_network_chooser_class_init (TpawIrcNetworkChooserClass *klass) g_object_class_install_property (object_class, PROP_SETTINGS, g_param_spec_object ("settings", "Settings", - "The EmpathyAccountSettings to show and edit", - EMPATHY_TYPE_ACCOUNT_SETTINGS, + "The TpawAccountSettings to show and edit", + TPAW_TYPE_ACCOUNT_SETTINGS, G_PARAM_STATIC_STRINGS | G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); signals[SIG_CHANGED] = g_signal_new ("changed", @@ -405,7 +405,7 @@ tpaw_irc_network_chooser_init (TpawIrcNetworkChooser *self) } GtkWidget * -tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings) +tpaw_irc_network_chooser_new (TpawAccountSettings *settings) { return g_object_new (TPAW_TYPE_IRC_NETWORK_CHOOSER, "settings", settings, diff --git a/tp-account-widgets/tpaw-irc-network-chooser.h b/tp-account-widgets/tpaw-irc-network-chooser.h index fcba21ab4..cb664d09f 100644 --- a/tp-account-widgets/tpaw-irc-network-chooser.h +++ b/tp-account-widgets/tpaw-irc-network-chooser.h @@ -24,7 +24,7 @@ #include <gtk/gtk.h> -#include "empathy-account-settings.h" +#include "tpaw-account-settings.h" #include "tpaw-irc-network.h" G_BEGIN_DECLS @@ -55,7 +55,7 @@ typedef struct { GType tpaw_irc_network_chooser_get_type (void) G_GNUC_CONST; -GtkWidget * tpaw_irc_network_chooser_new (EmpathyAccountSettings *settings); +GtkWidget * tpaw_irc_network_chooser_new (TpawAccountSettings *settings); TpawIrcNetwork * tpaw_irc_network_chooser_get_network ( TpawIrcNetworkChooser *self); |