~ubuntu-branches/ubuntu/karmic/gedit/karmic

« back to all changes in this revision

Viewing changes to docs/reference/html/GeditMessageBus.html

  • Committer: Bazaar Package Importer
  • Author(s): Andreas Moog
  • Date: 2009-05-27 14:00:44 UTC
  • mfrom: (1.1.62 upstream)
  • Revision ID: james.westby@ubuntu.com-20090527140044-4h5ypu02i3s4zi0q
Tags: 2.27.1-0ubuntu1
* New upstream release: (LP: #380924)
  - Remove the mmap document loader (Paolo Borelli)
  - Remove open location dialog and sample plugin (Paolo Borelli)
  - Added public API for document saving (Jesse van den Kieboom)
  - Put external tools in a submenu (Jesse van den Kieboom)
  - Added language support for external tools (Jesse van den Kieboom)
  - Implemented asynchronous reading and writing on external tools (Jesse van den Kieboom)
  - Add Quick Open plugin (Jesse van den Kieboom)
  - Misc bugfixes
  - New and updated translations
* debian/patches/90_autoconf.patch
  - updated for new version
* Launchpad bugs fixed:
  - various crasher bugs (LP: #348536, LP: #368262, LP: #368495)
  - fix modeline scanning (LP: #367160)

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
<head>
4
4
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5
5
<title>GeditMessageBus</title>
6
 
<meta name="generator" content="DocBook XSL Stylesheets V1.74.3">
7
 
<link rel="home" href="index.html" title="gedit Reference Manual">
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
 
7
<link rel="start" href="index.html" title="gedit Reference Manual">
8
8
<link rel="up" href="ch01.html" title="gedit">
9
9
<link rel="prev" href="GeditMessageArea.html" title="GeditMessageArea">
10
10
<link rel="next" href="gedit-GeditMessageType.html" title="GeditMessageType">
43
43
<div class="refsynopsisdiv">
44
44
<a name="GeditMessageBus.synopsis"></a><h2>Synopsis</h2>
45
45
<pre class="synopsis">
46
 
 
47
46
#include &lt;gedit/gedit-message-bus.h&gt;
48
47
 
49
48
                    <a class="link" href="GeditMessageBus.html#GeditMessageBus-struct" title="GeditMessageBus">GeditMessageBus</a>;
154
153
<p>
155
154
</p>
156
155
<div class="example">
157
 
<a name="id519926"></a><p class="title"><b>Example 1. Registering a message type</b></p>
158
 
<div class="example-contents">
159
 
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
160
 
    <tbody>
161
 
      <tr>
162
 
        <td class="listing_lines" align="right"><pre>1
163
 
2
164
 
3
165
 
4
166
 
5
167
 
6
168
 
7
169
 
8</pre></td>
170
 
        <td class="listing_code"><pre class="programlisting">GeditMessageBus *bus = gedit_message_bus_get_default ();
171
 
 
172
 
<span class="comment">// Register 'method' at '/plugins/example' with one required</span>
173
 
<span class="comment">// string argument 'arg1'</span>
174
 
GeditMessageType *message_type = gedit_message_bus_register (<span class="number">&quot;/plugins/example&quot;</span>, <span class="number">&quot;method&quot;</span>,
175
 
                                                             <span class="number">0</span>,
176
 
                                                             <span class="number">&quot;arg1&quot;</span>, G_TYPE_STRING,
177
 
                                                             <span class="number">NULL</span>);</pre></td>
178
 
      </tr>
179
 
    </tbody>
180
 
  </table>
181
 
</div>
182
 
 
 
156
<a name="id3116149"></a><p class="title"><b>Example 1. Registering a message type</b></p>
 
157
<div class="example-contents"><pre class="programlisting">
 
158
GeditMessageBus *bus = gedit_message_bus_get_default ();
 
159
 
 
160
// Register 'method' at '/plugins/example' with one required
 
161
// string argument 'arg1'
 
162
GeditMessageType *message_type = gedit_message_bus_register ("/plugins/example", "method", 
 
163
                                                             0, 
 
164
                                                             "arg1", G_TYPE_STRING,
 
165
                                                             NULL);
 
166
</pre></div>
183
167
</div>
184
168
<p><br class="example-break">
185
169
</p>
186
170
<div class="example">
187
 
<a name="id519943"></a><p class="title"><b>Example 2. Connecting a callback</b></p>
188
 
<div class="example-contents">
189
 
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
190
 
    <tbody>
191
 
      <tr>
192
 
        <td class="listing_lines" align="right"><pre>1
193
 
2
194
 
3
195
 
4
196
 
5
197
 
6
198
 
7
199
 
8
200
 
9
201
 
10
202
 
11
203
 
12
204
 
13
205
 
14
206
 
15
207
 
16
208
 
17
209
 
18
210
 
19</pre></td>
211
 
        <td class="listing_code"><pre class="programlisting"><span class="type">static</span> <span class="type">void</span>
 
171
<a name="id3116169"></a><p class="title"><b>Example 2. Connecting a callback</b></p>
 
172
<div class="example-contents"><pre class="programlisting">
 
173
static void
212
174
example_method_cb (GeditMessageBus *bus,
213
175
                   GeditMessage    *message,
214
176
                   gpointer         userdata)
215
177
{
216
 
        gchar *arg1 = <span class="number">NULL</span>;
 
178
        gchar *arg1 = NULL;
217
179
 
218
 
        gedit_message_get (message, <span class="number">&quot;arg1&quot;</span>, &amp;arg1, <span class="number">NULL</span>);
219
 
        g_message (<span class="number">&quot;Evoked /plugins/example.method with: </span><span class="symbol">%s</span><span class="number">&quot;</span>, arg1);
220
 
        g_free (arg1);
 
180
        gedit_message_get (message, "arg1", &amp;arg1, NULL);
 
181
        g_message ("Evoked /plugins/example.method with: %s", arg1);
 
182
        g_free (arg1);
221
183
}
222
184
 
223
185
GeditMessageBus *bus = gedit_message_bus_get_default ();
224
186
 
225
 
guint id = gedit_message_bus_connect (bus,
226
 
                                      <span class="number">&quot;/plugins/example&quot;</span>, <span class="number">&quot;method&quot;</span>,
 
187
guint id = gedit_message_bus_connect (bus, 
 
188
                                      "/plugins/example", "method",
227
189
                                      example_method_cb,
228
 
                                      <span class="number">NULL</span>,
229
 
                                      <span class="number">NULL</span>);</pre></td>
230
 
      </tr>
231
 
    </tbody>
232
 
  </table>
233
 
</div>
234
 
 
 
190
                                      NULL,
 
191
                                      NULL);
 
192
                                       
 
193
</pre></div>
235
194
</div>
236
195
<p><br class="example-break">
237
196
</p>
238
197
<div class="example">
239
 
<a name="id519962"></a><p class="title"><b>Example 3. Sending a message</b></p>
240
 
<div class="example-contents">
241
 
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
242
 
    <tbody>
243
 
      <tr>
244
 
        <td class="listing_lines" align="right"><pre>1
245
 
2
246
 
3
247
 
4
248
 
5
249
 
6</pre></td>
250
 
        <td class="listing_code"><pre class="programlisting">GeditMessageBus *bus = gedit_message_bus_get_default ();
251
 
 
252
 
gedit_message_bus_send (bus,
253
 
                        <span class="number">&quot;/plugins/example&quot;</span>, <span class="number">&quot;method&quot;</span>,
254
 
                        <span class="number">&quot;arg1&quot;</span>, <span class="number">&quot;Hello World&quot;</span>,
255
 
                        <span class="number">NULL</span>);</pre></td>
256
 
      </tr>
257
 
    </tbody>
258
 
  </table>
259
 
</div>
260
 
 
 
198
<a name="id3116194"></a><p class="title"><b>Example 3. Sending a message</b></p>
 
199
<div class="example-contents"><pre class="programlisting">
 
200
GeditMessageBus *bus = gedit_message_bus_get_default ();
 
201
 
 
202
gedit_message_bus_send (bus, 
 
203
                        "/plugins/example", "method", 
 
204
                        "arg1", "Hello World", 
 
205
                        NULL);
 
206
</pre></div>
261
207
</div>
262
208
<p><br class="example-break"></p>
263
209
<p>
372
318
</tr>
373
319
<tr>
374
320
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
375
 
<td> the registered <a class="link" href="gedit-GeditMessageType.html#GeditMessageType" title="GeditMessageType"><span class="type">GeditMessageType</span></a> or <code class="literal">NULL</code> if no message type
 
321
<td> the registered <a class="link" href="gedit-GeditMessageType.html#GeditMessageType" title="GeditMessageType"><span class="type">GeditMessageType</span></a> or <a href="/opt/gnome2/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a> if no message type
376
322
              is registered for <em class="parameter"><code>method</code></em> at <em class="parameter"><code>object_path</code></em>
377
323
 
378
324
</td>
392
338
Register a message on the bus. A message must be registered on the bus before
393
339
it can be send. This function registers the type arguments for <em class="parameter"><code>method</code></em> at 
394
340
<em class="parameter"><code>object_path</code></em>. The arguments are specified with the variable arguments which 
395
 
should contain pairs of const gchar *key and GType terminated by <code class="literal">NULL</code>. The 
 
341
should contain pairs of const gchar *key and GType terminated by <a href="/opt/gnome2/share/gtk-doc/html/liboil/liboil-liboiljunk.html#NULL:CAPS"><code class="literal">NULL</code></a>. The 
396
342
last <em class="parameter"><code>num_optional</code></em> arguments are registered as optional (and are thus not
397
343
required when sending a message).
398
344
</p>