[empathy] Use the new APIs in the assistant and the dialog



commit 75d28a9ddb083210eddf98e40b420c366fc1d805
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Fri Aug 28 14:42:42 2009 +0200

    Use the new APIs in the assistant and the dialog

 src/empathy-account-assistant.c |   10 ++++++++--
 src/empathy-accounts-dialog.c   |   25 +++++++++++++++++--------
 2 files changed, 25 insertions(+), 10 deletions(-)
---
diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c
index c8379ae..9c55b36 100644
--- a/src/empathy-account-assistant.c
+++ b/src/empathy-account-assistant.c
@@ -305,11 +305,12 @@ account_assistant_protocol_changed_cb (GtkComboBox *chooser,
   char *str;
   GtkWidget *account_widget;
   EmpathyAccountWidget *widget_object = NULL;
+  gboolean is_gtalk;
 
   priv = GET_PRIV (self);
 
   cm = empathy_protocol_chooser_dup_selected (
-      EMPATHY_PROTOCOL_CHOOSER (chooser), &proto);
+      EMPATHY_PROTOCOL_CHOOSER (chooser), &proto, &is_gtalk);
 
   if (cm == NULL || proto == NULL)
     /* we are not ready yet */
@@ -317,10 +318,15 @@ account_assistant_protocol_changed_cb (GtkComboBox *chooser,
 
   /* Create account */
   /* To translator: %s is the protocol name */
-  str = g_strdup_printf (_("New %s account"), proto->name);
+  str = g_strdup_printf (_("New %s account"),
+      empathy_protocol_name_to_display_name (
+          is_gtalk ? "gtalk" : proto->name));
 
   settings = empathy_account_settings_new (cm->name, proto->name, str);
 
+  empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
+      NULL, NULL);
+
   if (priv->first_resp == RESPONSE_CREATE_ACCOUNT)
     empathy_account_settings_set_boolean (settings, "register", TRUE);
 
diff --git a/src/empathy-accounts-dialog.c b/src/empathy-accounts-dialog.c
index a00c1b5..f7d6fa2 100644
--- a/src/empathy-accounts-dialog.c
+++ b/src/empathy-accounts-dialog.c
@@ -170,7 +170,8 @@ accounts_dialog_update_name_label (EmpathyAccountsDialog *dialog,
 }
 
 static void
-empathy_account_dialog_widget_cancelled_cb (EmpathyAccountWidget *widget_object,
+empathy_account_dialog_widget_cancelled_cb (
+    EmpathyAccountWidget *widget_object,
     EmpathyAccountsDialog *dialog)
 {
   GtkTreeView *view;
@@ -369,10 +370,11 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget,
 {
   TpConnectionManager *cm;
   TpConnectionManagerProtocol *proto;
+  gboolean is_gtalk;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
 
   cm = empathy_protocol_chooser_dup_selected (
-      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto);
+      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk);
 
   if (cm == NULL)
     return;
@@ -383,7 +385,7 @@ accounts_dialog_protocol_changed_cb (GtkWidget *widget,
       return;
     }
 
-  if (tp_connection_manager_protocol_can_register (proto))
+  if (tp_connection_manager_protocol_can_register (proto) && !is_gtalk)
     {
       gtk_widget_show (priv->radiobutton_register);
       gtk_widget_show (priv->radiobutton_reuse);
@@ -1222,11 +1224,11 @@ accounts_dialog_add_account (EmpathyAccountsDialog *dialog,
   name = empathy_account_get_display_name (account);
   enabled = empathy_account_is_enabled (account);
 
+  settings = empathy_account_settings_new_for_account (account);
+
   if (!accounts_dialog_get_account_iter (dialog, account, &iter))
     gtk_list_store_append (GTK_LIST_STORE (model), &iter);
 
-  settings = empathy_account_settings_new_for_account (account);
-
   gtk_list_store_set (GTK_LIST_STORE (model), &iter,
       COL_NAME, name,
       COL_STATUS, status,
@@ -1379,10 +1381,13 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button,
   TpConnectionManager *cm;
   TpConnectionManagerProtocol *proto;
   EmpathyAccountsDialogPriv *priv = GET_PRIV (dialog);
+  gboolean is_gtalk;
 
   cm = empathy_protocol_chooser_dup_selected (
-      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto);
-  display_name = empathy_protocol_name_to_display_name (proto->name);
+      EMPATHY_PROTOCOL_CHOOSER (priv->combobox_protocol), &proto, &is_gtalk);
+
+  display_name = empathy_protocol_name_to_display_name (
+      is_gtalk ? "gtalk" : proto->name);
 
   if (display_name == NULL)
     display_name = proto->name;
@@ -1401,11 +1406,15 @@ accounts_dialog_button_create_clicked_cb (GtkWidget *button,
       gboolean active;
 
       active = gtk_toggle_button_get_active
-          (GTK_TOGGLE_BUTTON (priv->radiobutton_register));
+        (GTK_TOGGLE_BUTTON (priv->radiobutton_register));
       if (active)
         empathy_account_settings_set_boolean (settings, "register", TRUE);
     }
 
+  if (is_gtalk)
+    empathy_account_settings_set_icon_name_async (settings, "im-google-talk",
+        NULL, NULL);
+
   accounts_dialog_add (dialog, settings);
   accounts_dialog_model_set_selected (dialog, settings);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]