[telepathy-mission-control/master] fd.o #21154: McdAccount: UpdateParameters: break API to return the parameters that will only change after a reconnect

Simon McVittie simon.mcvittie at collabora.co.uk
Wed Apr 29 07:54:34 PDT 2009


---
 doc/reference/libmcclient/tmpl/mc-account.sgml |    1 +
 src/mcd-account.c                              |    5 +--
 util/mc-tool.c                                 |   19 ++++++++++-
 xml/Account.xml                                |   43 +++++++++++++++++------
 xml/all.xml                                    |    2 +
 5 files changed, 55 insertions(+), 15 deletions(-)

diff --git a/doc/reference/libmcclient/tmpl/mc-account.sgml b/doc/reference/libmcclient/tmpl/mc-account.sgml
index dc65776..7397a45 100644
--- a/doc/reference/libmcclient/tmpl/mc-account.sgml
+++ b/doc/reference/libmcclient/tmpl/mc-account.sgml
@@ -749,6 +749,7 @@ mc-account
 </para>
 
 @proxy: 
+ at out_Reconnect_Required: 
 @error: 
 @user_data: 
 @weak_object: 
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 9d00e48..87163fc 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -1527,10 +1527,9 @@ account_update_parameters (McSvcAccount *self, GHashTable *set,
     mcd_account_manager_write_conf (priv->account_manager);
 
     g_ptr_array_add (not_yet, NULL);
-    /* FIXME: return this over D-Bus as a gchar ** (API break) */
-    (void) not_yet->pdata;
 
-    mc_svc_account_return_from_update_parameters (context);
+    mc_svc_account_return_from_update_parameters (context,
+        (const gchar **) not_yet->pdata);
     g_ptr_array_free (not_yet, TRUE);
 }
 
diff --git a/util/mc-tool.c b/util/mc-tool.c
index 56a5719..294f090 100644
--- a/util/mc-tool.c
+++ b/util/mc-tool.c
@@ -519,6 +519,23 @@ command_add (McAccountManager *manager)
 }
 
 static void
+callback_for_update_parameters (TpProxy *proxy,
+                                const gchar **unchanged G_GNUC_UNUSED,
+                                const GError *error,
+                                gpointer user_data,
+                                GObject *weak_object)
+{
+    if (error == NULL) {
+        command.common.ret = 0;
+    }
+    else {
+        fprintf (stderr, "%s %s: %s\n", app_name, command.common.name,
+                 error->message);
+    }
+    g_main_loop_quit (main_loop);
+}
+
+static void
 callback_for_void (TpProxy *proxy,
 		   const GError *error,
 		   gpointer user_data,
@@ -735,7 +752,7 @@ command_update (McAccount *account)
 					       command.update.set,
 					       (const gchar  **)
 					       command.update.unset->pdata,
-					       callback_for_void,
+					       callback_for_update_parameters,
 					       NULL, NULL, NULL);
 }
 
diff --git a/xml/Account.xml b/xml/Account.xml
index 16aa698..6651520 100644
--- a/xml/Account.xml
+++ b/xml/Account.xml
@@ -282,19 +282,22 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
     <method name="UpdateParameters" tp:name-for-bindings="Update_Parameters">
       <tp:docstring xmlns="http://www.w3.org/1999/xhtml">
-        Change the value of the <tp:member-ref>Parameters</tp:member-ref>
-        property. If any of the changed parameters'
-        <tp:type>Conn_Mgr_Param_Flags</tp:type> include
-        <code>DBus_Property</code>, the change will be applied to the
-        corresponding D-Bus Property on the active
-        <tp:member-ref>Connection</tp:member-ref> if there is one; changes to
-        other parameters will not take effect until the next time the account
-        is disconnected and reconnected.
+        <p>Change the value of the <tp:member-ref>Parameters</tp:member-ref>
+          property.</p>
+
+        <p>If any of the changed parameters'
+          <tp:type>Conn_Mgr_Param_Flags</tp:type> include
+          <code>DBus_Property</code>, the change will be applied to the
+          corresponding D-Bus Property on the active
+          <tp:member-ref>Connection</tp:member-ref>, if there is one. Changes to
+          other parameters will not take effect until the next time the account
+          is disconnected and reconnected.</p>
 
         <tp:rationale>
-          Migration tools that twiddle the settings of all accounts shouldn't
-          cause an automatic disconnect and reconnect, probably. I could be
-          persuaded otherwise, though. Or we could add a Reconnect() method.
+          <p>In general, reconnecting is a destructive operation that shouldn't
+            happen as a side-effect. In particular, migration tools that
+            twiddle the settings of all accounts shouldn't cause an automatic
+            disconnect and reconnect.</p>
         </tp:rationale>
       </tp:docstring>
 
@@ -303,12 +306,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         existing Connections
       </tp:changed>
 
+      <tp:changed version="0.17.UNRELEASED">
+        return an array of the parameters that won't change until the account
+        is reconnected
+      </tp:changed>
+
       <arg name="Set" type="a{sv}" direction="in">
         <tp:docstring>
           A mapping from parameter names to their values. These parameters
           should be stored for future use.
         </tp:docstring>
       </arg>
+
       <arg name="Unset" type="as" direction="in">
         <tp:docstring>
           A list of the names of parameters to be removed from the set of
@@ -319,6 +328,18 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
         </tp:docstring>
       </arg>
 
+      <arg name="Reconnect_Required" type="as" direction="out">
+        <tp:docstring>
+          A list of the names of parameters with changes that will not take
+          effect until the account is reconnected (this may be empty, e.g. if
+          all the parameters are D-Bus properties or parameters for which the
+          account manager has specific support). User interfaces that
+          require "instant apply" semantics MAY call
+          <tp:member-ref>Reconnect</tp:member-ref> in response to receiving
+          a non-empty list.
+        </tp:docstring>
+      </arg>
+
       <tp:possible-errors>
         <tp:error name="org.freedesktop.Telepathy.Error.PermissionDenied"/>
         <tp:error name="org.freedesktop.Telepathy.Error.InvalidArgument"/>
diff --git a/xml/all.xml b/xml/all.xml
index b6de1ea..e70c2db 100644
--- a/xml/all.xml
+++ b/xml/all.xml
@@ -21,6 +21,8 @@
 	from="Telepathy specification (ConnectionManager)"/>
     <tp:external-type name="Simple_Presence" type="(uss)"
 	from="Telepathy specification (SimplePresence)"/>
+    <tp:external-type name="Conn_Mgr_Param_Flags" type="u"
+	from="Telepathy specification (ConnectionManager)"/>
 </tp:generic-types>
 
 <xi:include href="generic-types.xml"/>
-- 
1.5.6.5




More information about the telepathy-commits mailing list