[Telepathy-commits] [telepathy-doc/master] Add tp-glib ListProtocols example to the docs

Davyd Madeley davyd at madeley.id.au
Mon Mar 23 22:55:28 PDT 2009


---
 docs/book/C/connection.xml                  |    8 +++++++-
 docs/examples/glib_list_protocols/example.c |   20 +++++++++++++++++---
 2 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/docs/book/C/connection.xml b/docs/book/C/connection.xml
index 3db91a0..20c1f10 100644
--- a/docs/book/C/connection.xml
+++ b/docs/book/C/connection.xml
@@ -180,7 +180,8 @@
      <para>
       telepathy-glib provides the
       <ulink url="&url_telepathy_glib_base;connection-manager.html#tp-list-connection-managers"><function>tp_list_connection_managers</function></ulink> function
-      to list the available connection managers.
+      to list the available connection managers. This is demonstrated in
+      <xref linkend="ex.connection.connection-manager.glib"/>.
      </para>
  
      <para>
@@ -191,6 +192,11 @@
       signal when it has returned. You can examine the
       TpConnectionManager::protocols struct field in your signal handler.
      </para>
+
+     <example id="ex.connection.connection-manager.glib"
+              file="glib_list_protocols/example.c">
+      <title>tp_list_connection_managers Example</title>
+     </example>
     </sect2>
     
   </sect1>
diff --git a/docs/examples/glib_list_protocols/example.c b/docs/examples/glib_list_protocols/example.c
index d9272f0..a79f974 100644
--- a/docs/examples/glib_list_protocols/example.c
+++ b/docs/examples/glib_list_protocols/example.c
@@ -5,6 +5,21 @@
 
 static GMainLoop *loop = NULL;
 
+static void got_connection_managers (TpConnectionManager	* const * cms,
+				     gsize			 ncms,
+				     const GError		*error,
+				     gpointer			 user_data,
+				     GObject			*weak_object);
+
+/* begin ex.connection.connection-manager.glib */
+static void
+get_connection_managers (TpDBusDaemon *bus_daemon)
+{
+	/* let's get a list of the connection managers */
+	tp_list_connection_managers (bus_daemon, got_connection_managers,
+			NULL, NULL, NULL);
+}
+
 static void
 got_connection_managers (TpConnectionManager	* const * cms,
 			 gsize			 ncms,
@@ -43,6 +58,7 @@ got_connection_managers (TpConnectionManager	* const * cms,
 		}
 	}
 }
+/* end ex.connection.connection-manager.glib */
 
 int main (int argc, char **argv)
 {
@@ -60,9 +76,7 @@ int main (int argc, char **argv)
 		g_error ("%s", error->message);
 	}
 
-	/* let's get a list of the connection managers */
-	tp_list_connection_managers (bus_daemon, got_connection_managers,
-			NULL, NULL, NULL);
+	get_connection_managers (bus_daemon);
 
 	g_main_loop_run (loop);
 
-- 
1.5.6.5



More information about the telepathy-commits mailing list