aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-05 20:08:11 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-05 20:08:11 +0800
commit2d517a8bf5f8048a83d753fb0977d4949cbdeb7a (patch)
tree25d62bcf07ac413d974b3c5f701ebf3b67e2c40f /src
parentddcb104dfa874375ea17cac4de2f273af7327fc4 (diff)
downloadgsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar.gz
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar.bz2
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar.lz
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar.xz
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.tar.zst
gsoc2013-empathy-2d517a8bf5f8048a83d753fb0977d4949cbdeb7a.zip
Remove usage of McProfiles
Diffstat (limited to 'src')
-rw-r--r--src/empathy-accounts-dialog.c95
-rw-r--r--src/empathy-new-chatroom-dialog.c5
2 files changed, 41 insertions, 59 deletions
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index f427b9994..1b48c1488 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -164,13 +164,45 @@ accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
g_free (text);
}
+typedef GtkWidget *CreateWidget (EmpathyAccount *);
+
+static GtkWidget *
+get_account_setup_widget (EmpathyAccount *account)
+{
+ const gchar *cm = empathy_account_get_connection_manager (account);
+ const gchar *proto = empathy_account_get_protocol (account);
+ struct {
+ const gchar *cm;
+ const gchar *proto;
+ CreateWidget *cb;
+ } dialogs[] = {
+ { "gabble", "jabber", empathy_account_widget_jabber_new},
+ { "butterfly", "msn", empathy_account_widget_msn_new},
+ { "salut", "local-xmpp", empathy_account_widget_salut_new},
+ { "idle", "irc", empathy_account_widget_irc_new},
+ { "haze", "icq", empathy_account_widget_icq_new},
+ { "haze", "aim", empathy_account_widget_aim_new},
+ { "haze", "yahoo", empathy_account_widget_yahoo_new},
+ { "haze", "groupwise", empathy_account_widget_groupwise_new},
+ { "sofiasip", "sip", empathy_account_widget_sip_new},
+ { NULL, NULL, NULL }
+ };
+ int i;
+
+ for (i = 0; dialogs[i].cm != NULL; i++) {
+ if (!tp_strdiff (cm, dialogs[i].cm)
+ && !tp_strdiff (proto, dialogs[i].proto))
+ return dialogs[i].cb(account);
+ }
+
+ return empathy_account_widget_generic_new (account);
+}
+
+
static void
accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
EmpathyAccount *account)
{
- McProfile *profile;
- const gchar *config_ui;
-
if (!account) {
GtkTreeView *view;
GtkTreeModel *model;
@@ -215,48 +247,7 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
dialog->settings_widget = NULL;
}
- profile = empathy_account_get_profile (account);
- config_ui = mc_profile_get_configuration_ui (profile);
- if (!tp_strdiff (config_ui, "jabber")) {
- dialog->settings_widget =
- empathy_account_widget_jabber_new (account);
- }
- else if (!tp_strdiff (config_ui, "msn")) {
- dialog ->settings_widget =
- empathy_account_widget_msn_new (account);
- }
- else if (!tp_strdiff (config_ui, "local-xmpp")) {
- dialog->settings_widget =
- empathy_account_widget_salut_new (account);
- }
- else if (!tp_strdiff (config_ui, "irc")) {
- dialog->settings_widget =
- empathy_account_widget_irc_new (account);
- }
- else if (!tp_strdiff (config_ui, "icq")) {
- dialog->settings_widget =
- empathy_account_widget_icq_new (account);
- }
- else if (!tp_strdiff (config_ui, "aim")) {
- dialog->settings_widget =
- empathy_account_widget_aim_new (account);
- }
- else if (!tp_strdiff (config_ui, "yahoo")) {
- dialog->settings_widget =
- empathy_account_widget_yahoo_new (account);
- }
- else if (!tp_strdiff (config_ui, "sofiasip")) {
- dialog->settings_widget =
- empathy_account_widget_sip_new (account);
- }
- else if (!tp_strdiff (config_ui, "groupwise")) {
- dialog->settings_widget =
- empathy_account_widget_groupwise_new (account);
- }
- else {
- dialog->settings_widget =
- empathy_account_widget_generic_new (account);
- }
+ dialog->settings_widget = get_account_setup_widget (account);
gtk_container_add (GTK_CONTAINER (dialog->alignment_settings),
dialog->settings_widget);
@@ -264,14 +255,12 @@ accounts_dialog_update_account (EmpathyAccountsDialog *dialog,
gtk_image_set_from_icon_name (GTK_IMAGE (dialog->image_type),
- mc_profile_get_icon_name (profile),
+ empathy_account_get_icon_name (account),
GTK_ICON_SIZE_DIALOG);
gtk_widget_set_tooltip_text (dialog->image_type,
- mc_profile_get_display_name (profile));
+ empathy_account_get_protocol (account));
accounts_dialog_update_name_label (dialog, account);
-
- g_object_unref (profile);
}
static void
@@ -661,13 +650,10 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager,
current_name = empathy_account_get_display_name (account);
account_param = empathy_account_get_param_string (account, "account");
if (!EMP_STR_EMPTY (account_param)) {
- McProfile *profile;
- const gchar *profile_name;
gchar *new_name;
- profile = empathy_account_get_profile (account);
- profile_name = mc_profile_get_display_name (profile);
- new_name = g_strdup_printf ("%s (%s)", profile_name,
+ new_name = g_strdup_printf ("%s (%s)",
+ empathy_account_get_protocol (account),
account_param);
DEBUG ("Setting new display name for account %s: '%s'",
@@ -675,7 +661,6 @@ accounts_dialog_account_added_cb (EmpathyAccountManager *manager,
empathy_account_set_display_name (account, new_name);
g_free (new_name);
- g_object_unref (profile);
} else {
/* FIXME: This CM has no account parameter, what can be done? */
}
diff --git a/src/empathy-new-chatroom-dialog.c b/src/empathy-new-chatroom-dialog.c
index e16da91a7..7313fd1e6 100644
--- a/src/empathy-new-chatroom-dialog.c
+++ b/src/empathy-new-chatroom-dialog.c
@@ -358,14 +358,12 @@ new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
{
EmpathyAccountChooser *account_chooser;
EmpathyAccount *account;
- McProfile *profile;
const gchar *protocol;
const gchar *room;
account_chooser = EMPATHY_ACCOUNT_CHOOSER (dialog->account_chooser);
account = empathy_account_chooser_dup_account (account_chooser);
- profile = empathy_account_get_profile (account);
- protocol = mc_profile_get_protocol_name (profile);
+ protocol = empathy_account_get_protocol (account);
gtk_entry_set_text (GTK_ENTRY (dialog->entry_server), "");
@@ -390,7 +388,6 @@ new_chatroom_dialog_update_widgets (EmpathyNewChatroomDialog *dialog)
gtk_widget_grab_focus (dialog->entry_room);
g_object_unref (account);
- g_object_unref (profile);
}
static void