~ubuntu-branches/ubuntu/raring/libdmapsharing/raring

« back to all changes in this revision

Viewing changes to doc/html/serviceaddedcb.html

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-05-30 17:50:18 UTC
  • mfrom: (1.1.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20110530175018-bbz8iqkeu3e9zaba
Tags: 2.9.12-0ubuntu1
New upstream version

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
2
<html>
 
3
<head>
 
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 
5
<title>Service Added Callback</title>
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
 
7
<link rel="home" href="index.html" title="libdmapsharing Reference Manual">
 
8
<link rel="up" href="ch02.html" title="Libdmapsharing Browsing Overview">
 
9
<link rel="prev" href="browserapi.html" title="mDNS Browser API">
 
10
<link rel="next" href="connectedcb.html" title="Connected Callback">
 
11
<meta name="generator" content="GTK-Doc V1.17 (XML mode)">
 
12
<link rel="stylesheet" href="style.css" type="text/css">
 
13
</head>
 
14
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 
15
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"><tr valign="middle">
 
16
<td><a accesskey="p" href="browserapi.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
 
17
<td><a accesskey="u" href="ch02.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
 
18
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
 
19
<th width="100%" align="center">libdmapsharing Reference Manual</th>
 
20
<td><a accesskey="n" href="connectedcb.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
 
21
</tr></table>
 
22
<div class="refentry">
 
23
<a name="serviceaddedcb"></a><div class="titlepage"></div>
 
24
<div class="refnamediv"><table width="100%"><tr>
 
25
<td valign="top">
 
26
<h2><span class="refentrytitle">Service Added Callback</span></h2>
 
27
<p>Service Added Callback — 
 
28
                        Defining a Service Added Callback
 
29
                </p>
 
30
</td>
 
31
<td valign="top" align="right"></td>
 
32
</tr></table></div>
 
33
<div class="refsect1">
 
34
<a name="id583518"></a><h2>Service Added Callback</h2>
 
35
<p>
 
36
A "service-added" callback should create a media DB and a record
 
37
factory. Both of these objects will be passed to dmap_connection_new. This
 
38
object will interact with a DMAP share and populate the media DB. In
 
39
order to instruct the object to begin interrogating the DMAP service,
 
40
call the dmap_connection_connect function and pass it a "connected"
 
41
callback. The following is a simple "service-added" callback that creates
 
42
a DAAP connection:
 
43
 
 
44
                </p>
 
45
<pre class="screen">
 
46
static void
 
47
service_added_cb (DMAPMdnsBrowser *browser,
 
48
                  DMAPMdnsBrowserService *service,
 
49
                  gpointer user_data)
 
50
{
 
51
        DMAPRecordFactory *factory;
 
52
        DMAPConnection *conn;
 
53
        DMAPDb *db;
 
54
 
 
55
        db = DMAP_DB (my_dmap_db_new ());
 
56
        if (db == NULL) {
 
57
                g_error ("Error creating DB");
 
58
        }
 
59
 
 
60
        factory = DMAP_RECORD_FACTORY (my_daap_record_factory_new ());
 
61
        if (factory == NULL) {
 
62
                g_error ("Error creating record factory");
 
63
        }
 
64
        conn = DMAP_CONNECTION (dmap_connection_new (service-&gt;name,
 
65
                                                     service-&gt;host,
 
66
                                                     service-&gt;port,
 
67
                                                     FALSE,
 
68
                                                     db,
 
69
                                                     factory));
 
70
        dmap_connection_connect (DMAP_CONNECTION (conn),
 
71
                                (DMAPConnectionCallback) connected_cb,
 
72
                                 db);
 
73
}
 
74
                </pre>
 
75
</div>
 
76
</div>
 
77
<div class="footer">
 
78
<hr>
 
79
          Generated by GTK-Doc V1.17</div>
 
80
</body>
 
81
</html>
 
 
b'\\ No newline at end of file'