[empathy] empathy_account_settings_check_readyness: use the existing TpProtocol to list params



commit daf7a5ba63b13dca8cd93c84ba39f722a3713b9b
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Tue Jun 5 14:28:47 2012 +0200

    empathy_account_settings_check_readyness: use the existing TpProtocol to list params
    
    No need to request another one.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=677465

 libempathy/empathy-account-settings.c |   46 +++++++++++++++------------------
 1 files changed, 21 insertions(+), 25 deletions(-)
---
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index 7e3a745..f88ff3d 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -536,7 +536,6 @@ static void
 empathy_account_settings_check_readyness (EmpathyAccountSettings *self)
 {
   EmpathyAccountSettingsPriv *priv = GET_PRIV (self);
-  const TpConnectionManagerProtocol *tp_protocol;
   GQuark features[] = { TP_PROTOCOL_FEATURE_CORE, 0 };
 
   if (priv->ready)
@@ -573,34 +572,11 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self)
       priv->uri_scheme_tel = empathy_account_has_uri_scheme_tel (priv->account);
     }
 
-  tp_protocol = tp_connection_manager_get_protocol (priv->manager,
-    priv->protocol);
-
-  if (tp_protocol == NULL)
-    {
-      tp_clear_object (&priv->manager);
-      return;
-    }
-
-  if (priv->required_params == NULL)
-    {
-      TpConnectionManagerParam *cur;
-
-      for (cur = tp_protocol->params; cur->name != NULL; cur++)
-        {
-          if (tp_connection_manager_param_is_required (cur))
-            {
-              priv->required_params = g_list_append (priv->required_params,
-                                                     g_strdup (cur->name));
-            }
-        }
-    }
-
   if (priv->protocol_obj == NULL)
     {
       priv->protocol_obj = g_object_ref (
           tp_connection_manager_get_protocol_object (priv->manager,
-              priv->protocol));
+            priv->protocol));
     }
 
   if (!tp_proxy_is_prepared (priv->protocol_obj, TP_PROTOCOL_FEATURE_CORE)
@@ -621,6 +597,26 @@ empathy_account_settings_check_readyness (EmpathyAccountSettings *self)
         }
     }
 
+  if (priv->required_params == NULL)
+    {
+      GList *params, *l;
+
+      params = tp_protocol_dup_params (priv->protocol_obj);
+      for (l = params; l != NULL; l = g_list_next (l))
+        {
+          TpConnectionManagerParam *cur = l->data;
+
+          if (tp_connection_manager_param_is_required (cur))
+            {
+              priv->required_params = g_list_append (priv->required_params,
+                                                     g_strdup (cur->name));
+            }
+        }
+
+       g_list_free_full (params,
+           (GDestroyNotify) tp_connection_manager_param_free);
+    }
+
   /* NOTE: When removing MC migration code, remove this call, and the
    * function it's calling. That's it. */
   empathy_account_settings_try_migrating_password (self);



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