]> git.0d.be Git - empathy.git/commitdiff
empathy_account_settings_check_readyness: use the existing TpProtocol to list params
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Tue, 5 Jun 2012 12:28:47 +0000 (14:28 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Wed, 6 Jun 2012 09:28:40 +0000 (11:28 +0200)
No need to request another one.

https://bugzilla.gnome.org/show_bug.cgi?id=677465

libempathy/empathy-account-settings.c

index 7e3a745be1cac0f2b5ab9c4c5ba8afe81685f52c..f88ff3dd72d259807c73b73b9707294e1446a06c 100644 (file)
@@ -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);