aboutsummaryrefslogtreecommitdiff
path: root/doc/reference/libcontextprovider/html/libcontextprovider-Context-provider-setup.html
blob: fe07805fe7e30d684e0ae847e21b4abe14f2de80 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Context provider setup</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" href="index.html" title="libcontextprovider Reference Manual">
<link rel="up" href="ch01.html" title="ContextKit Context provider C Interface">
<link rel="prev" href="ch01.html" title="ContextKit Context provider C Interface">
<link rel="next" href="libcontextprovider-ContextProviderChangeSet.html" title="ContextProviderChangeSet">
<meta name="generator" content="GTK-Doc V1.11 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="ch01.html" title="ContextKit Context provider C Interface">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="ch01.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="ch01.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">libcontextprovider Reference Manual</th>
<td><a accesskey="n" href="libcontextprovider-ContextProviderChangeSet.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#libcontextprovider-Context-provider-setup.synopsis" class="shortcut">Top</a>
                 | 
                <a href="#libcontextprovider-Context-provider-setup.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry" lang="en">
<a name="libcontextprovider-Context-provider-setup"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="libcontextprovider-Context-provider-setup.top_of_page"></a>Context provider setup</span></h2>
<p>Context provider setup</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="libcontextprovider-Context-provider-setup.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
void                (<a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderGetCallback" title="ContextProviderGetCallback ()">*ContextProviderGetCallback</a>)       (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys,
                                                         <a class="link" href="libcontextprovider-ContextProviderChangeSet.html#ContextProviderChangeSet" title="ContextProviderChangeSet">ContextProviderChangeSet</a> *change_set,
                                                         void *user_data);
void                (<a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderSubscribedCallback" title="ContextProviderSubscribedCallback ()">*ContextProviderSubscribedCallback</a>)
                                                        (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_subscribed,
                                                         void *user_data);
void                (<a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderUnsubscribedCallback" title="ContextProviderUnsubscribedCallback ()">*ContextProviderUnsubscribedCallback</a>)
                                                        (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_unsubscribed,
                                                         <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_remaining,
                                                         void *user_data);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-init" title="context_provider_init ()">context_provider_init</a>               (DBusBusType bus_type,
                                                         const char *bus_name);
ContextProviderProvider* <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()">context_provider_install</a>       (char **provided_keys,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderGetCallback" title="ContextProviderGetCallback ()">ContextProviderGetCallback</a> get_cb,
                                                         void *get_cb_target,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderSubscribedCallback" title="ContextProviderSubscribedCallback ()">ContextProviderSubscribedCallback</a> subscribed_cb,
                                                         void *subscribed_cb_target,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderUnsubscribedCallback" title="ContextProviderUnsubscribedCallback ()">ContextProviderUnsubscribedCallback</a> unsubscribed_cb,
                                                         void *unsubscribed_cb_target);
void                <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-remove" title="context_provider_remove ()">context_provider_remove</a>             (ContextProviderProvider *provider);
<a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-no-of-subscribers" title="context_provider_no_of_subscribers ()">context_provider_no_of_subscribers</a>  (const char *key);
</pre>
</div>
<div class="refsect1" lang="en">
<a name="libcontextprovider-Context-provider-setup.description"></a><h2>Description</h2>
<p>
</p>
</div>
<div class="refsect1" lang="en">
<a name="libcontextprovider-Context-provider-setup.details"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="ContextProviderGetCallback"></a><h3>ContextProviderGetCallback ()</h3>
<pre class="programlisting">void                (*ContextProviderGetCallback)       (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys,
                                                         <a class="link" href="libcontextprovider-ContextProviderChangeSet.html#ContextProviderChangeSet" title="ContextProviderChangeSet">ContextProviderChangeSet</a> *change_set,
                                                         void *user_data);</pre>
<p>
Type definition for a function that will be called back when key values are needed.
The keys will only ever be keys that this provider registered as providing.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>keys</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet"><span class="type">ContextProviderStringSet</span></a> of keys for which values have been requested
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>change_set</code></em> :</span></p></td>
<td> a <span class="type">ContextProvideChangeSet</span> in which to fill in the requested values
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> the user data passed in <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()"><span class="type">context_provider_install</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="ContextProviderSubscribedCallback"></a><h3>ContextProviderSubscribedCallback ()</h3>
<pre class="programlisting">void                (*ContextProviderSubscribedCallback)
                                                        (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_subscribed,
                                                         void *user_data);</pre>
<p>
Type definition for a function that will be called back when a key is first subscribed to
The keys will only ever be keys that this provider registered as providing.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>keys_subscribed</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet"><span class="type">ContextProviderStringSet</span></a> of keys which have been newly subscibed
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> the user data passed in <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()"><span class="type">context_provider_install</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="ContextProviderUnsubscribedCallback"></a><h3>ContextProviderUnsubscribedCallback ()</h3>
<pre class="programlisting">void                (*ContextProviderUnsubscribedCallback)
                                                        (<a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_unsubscribed,
                                                         <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet">ContextProviderStringSet</a> *keys_remaining,
                                                         void *user_data);</pre>
<p>
Type definition for a function that will be called back when a key is last unsubscribed from.
The keys will only ever be keys that this provider registered as providing.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>keys_unsubscribed</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet"><span class="type">ContextProviderStringSet</span></a> of keys that have been newly unsubscribed
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>keys_remaining</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-ContextProviderStringSet.html#ContextProviderStringSet" title="ContextProviderStringSet"><span class="type">ContextProviderStringSet</span></a> of keys provided by this provider that are still
subscribed to
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>user_data</code></em> :</span></p></td>
<td> the user data passed in <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()"><span class="type">context_provider_install</span></a>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="context-provider-init"></a><h3>context_provider_init ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gboolean"
>gboolean</a>            context_provider_init               (DBusBusType bus_type,
                                                         const char *bus_name);</pre>
<p>
Initialise the Context Provider library.
</p>
<p>
This sets up the D-Bus connection and optionally requests a well known bus name.
It must be called before using any other context provider functionality.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_type</code></em> :</span></p></td>
<td> which bus to advertise context on
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>bus_name</code></em> :</span></p></td>
<td> A well-known bus name to register, or NULL if not required.
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> TRUE if successful, FALSE otherwise.
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="context-provider-install"></a><h3>context_provider_install ()</h3>
<pre class="programlisting">ContextProviderProvider* context_provider_install       (char **provided_keys,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderGetCallback" title="ContextProviderGetCallback ()">ContextProviderGetCallback</a> get_cb,
                                                         void *get_cb_target,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderSubscribedCallback" title="ContextProviderSubscribedCallback ()">ContextProviderSubscribedCallback</a> subscribed_cb,
                                                         void *subscribed_cb_target,
                                                         <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderUnsubscribedCallback" title="ContextProviderUnsubscribedCallback ()">ContextProviderUnsubscribedCallback</a> unsubscribed_cb,
                                                         void *unsubscribed_cb_target);</pre>
<p>
Install a new service providing context.</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>provided_keys</code></em> :</span></p></td>
<td> a NULL-terminated array of context key names
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>get_cb</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderGetCallback" title="ContextProviderGetCallback ()"><span class="type">ContextProviderGetCallback</span></a> to be called when values are requested for keys
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>get_cb_target</code></em> :</span></p></td>
<td> user data to pass to <span class="type">get_cb</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>subscribed_cb</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderSubscribedCallback" title="ContextProviderSubscribedCallback ()"><span class="type">ContextProviderSubscribedCallback</span></a> to be called when a key is first subscribed to
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>subscribed_cb_target</code></em> :</span></p></td>
<td> user data to pass to <span class="type">subscribed_cb</span>
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>unsubscribed_cb</code></em> :</span></p></td>
<td> a <a class="link" href="libcontextprovider-Context-provider-setup.html#ContextProviderUnsubscribedCallback" title="ContextProviderUnsubscribedCallback ()"><span class="type">ContextProviderUnsubscribedCallback</span></a> to be called when a key is last unsubscribed from
</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>unsubscribed_cb_target</code></em> :</span></p></td>
<td> user data to pass to <span class="type">unsubscribed_cb</span>
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> a new <span class="type">ContextProvider</span> object
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="context-provider-remove"></a><h3>context_provider_remove ()</h3>
<pre class="programlisting">void                context_provider_remove             (ContextProviderProvider *provider);</pre>
<p>
Remove and dealloctate resources for a <span class="type">ContextProvider</span> created with <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()"><span class="type">context_provider_install</span></a></p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>provider</code></em> :</span></p></td>
<td> a <span class="type">ContextProvder</span> created with <a class="link" href="libcontextprovider-Context-provider-setup.html#context-provider-install" title="context_provider_install ()"><span class="type">context_provider_install</span></a>.
</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="context-provider-no-of-subscribers"></a><h3>context_provider_no_of_subscribers ()</h3>
<pre class="programlisting"><a
href="/usr/share/gtk-doc/html/glib/glib-Basic-Types.html#gint"
>gint</a>                context_provider_no_of_subscribers  (const char *key);</pre>
<p>
</p>
<p>
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>key</code></em> :</span></p></td>
<td> the name of a context key
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td> the current number of subscribers for a given context key
</td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.11</div>
</body>
</html>