~ubuntu-branches/ubuntu/quantal/libbonobo/quantal-201207170711

« back to all changes in this revision

Viewing changes to doc/api/tmpl/bonobo-application.sgml

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2005-02-18 14:40:51 UTC
  • mto: (3.1.1 etch) (1.1.25 upstream)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20050218144051-fo4h9qh2gim8x3wt
Tags: upstream-2.8.1
ImportĀ upstreamĀ versionĀ 2.8.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!-- ##### SECTION Title ##### -->
 
2
bonobo-application
 
3
 
 
4
<!-- ##### SECTION Short_Description ##### -->
 
5
a framework for unique application instance and automation
 
6
 
 
7
<!-- ##### SECTION Long_Description ##### -->
 
8
<para>
 
9
 
 
10
</para>
 
11
 
 
12
<!-- ##### SECTION See_Also ##### -->
 
13
<para>
 
14
 
 
15
</para>
 
16
 
 
17
<!-- ##### USER_FUNCTION BonoboAppHookFunc ##### -->
 
18
<para>
 
19
 
 
20
</para>
 
21
 
 
22
@app: 
 
23
@data: 
 
24
 
 
25
 
 
26
<!-- ##### FUNCTION bonobo_application_new ##### -->
 
27
<para>
 
28
 
 
29
</para>
 
30
 
 
31
@name: 
 
32
@Returns: 
 
33
 
 
34
 
 
35
<!-- ##### FUNCTION bonobo_application_register_message ##### -->
 
36
<para>
 
37
When @opt_closure is provided (and is non-%NULL) it takes care of calling the
 
38
callback function with the same arguments as registered for the message.  On
 
39
the other hand if @opt_closure is %NULL, the function arguments are provided in
 
40
a #GValueArray.  This enables defining functions that accept variable number of
 
41
arguments, but is perhaps a little more tedious to implement.
 
42
</para>
 
43
 
 
44
<para>
 
45
<example>
 
46
<title>Function with a closure</title>
 
47
<programlisting>
 
48
static void
 
49
message_open_url_cb (BonoboApplication *app, const char *url, gboolean new_win)
 
50
{
 
51
        ...
 
52
}
 
53
...
 
54
closure = g_cclosure_new (G_CALLBACK (message_open_url_cb), NULL, NULL);
 
55
g_closure_set_marshal (closure, my_marshal_VOID__STRING_BOOLEAN);
 
56
bonobo_application_register_message (app, "open-url", "Opens a new URL in the browser."
 
57
                                     " Parameters: url(string), open-in-new-window(boolean)",
 
58
                                     closure, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_NONE);
 
59
</programlisting>
 
60
</example>
 
61
</para>
 
62
 
 
63
<para>
 
64
<example>
 
65
<title>Function accepting variable number of arguments</title>
 
66
<programlisting>
 
67
static GValue *
 
68
message_open_url_cb (BonoboApplication *app, const char *message, GValueArray *args)
 
69
{
 
70
        const char *url;
 
71
        gboolean    new_win = TRUE;
 
72
 
 
73
        g_return_val_if_fail (strcmp (message, "open-url") == 0, NULL);
 
74
        g_return_val_if_fail (args->n_values > 0, NULL);
 
75
        g_return_val_if_fail (G_VALUE_HOLDS_STRING (&amp;args->values[0]), NULL);
 
76
 
 
77
        url = g_value_get_string (&amp;args->values[0]);
 
78
        if (args->n_values > 1)
 
79
        {
 
80
                g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&amp;args->values[1]), NULL);
 
81
                new_win = g_value_get_boolean (&amp;args->values[1]);
 
82
        }
 
83
 
 
84
        ...
 
85
 
 
86
        return NULL;
 
87
}
 
88
...
 
89
bonobo_application_register_message (app, "open-url", "Opens a new URL in the browser."
 
90
                                     " Parameters: url(string) [, open-in-new-window(boolean)]",
 
91
                                     NULL, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_NONE);
 
92
 
 
93
g_signal_connect (app, "message::open-url", G_CALLBACK (message_open_url_cb), NULL);
 
94
</programlisting>
 
95
</example>
 
96
</para>
 
97
 
 
98
<para>
 
99
<note>You are not required to register any messages for your application.
 
100
However, only registered functions are included in the list returned by
 
101
bonobo_app_client_msg_list()</note>
 
102
</para>
 
103
 
 
104
@app: 
 
105
@name: 
 
106
@description: 
 
107
@opt_closure: 
 
108
@return_type: 
 
109
@first_arg_type: 
 
110
@Varargs: 
 
111
 
 
112
 
 
113
<!-- ##### FUNCTION bonobo_application_register_message_v ##### -->
 
114
<para>
 
115
 
 
116
</para>
 
117
 
 
118
@app: 
 
119
@name: 
 
120
@description: 
 
121
@opt_closure: 
 
122
@return_type: 
 
123
@arg_types: 
 
124
 
 
125
 
 
126
<!-- ##### FUNCTION bonobo_application_register_message_va ##### -->
 
127
<para>
 
128
 
 
129
</para>
 
130
 
 
131
@app: 
 
132
@name: 
 
133
@description: 
 
134
@opt_closure: 
 
135
@return_type: 
 
136
@first_arg_type: 
 
137
@var_args: 
 
138
 
 
139
 
 
140
<!-- ##### FUNCTION bonobo_application_new_instance ##### -->
 
141
<para>
 
142
 
 
143
</para>
 
144
 
 
145
@app: 
 
146
@argc: 
 
147
@argv: 
 
148
@Returns: 
 
149
 
 
150
 
 
151
<!-- ##### FUNCTION bonobo_application_create_serverinfo ##### -->
 
152
<para>
 
153
 
 
154
</para>
 
155
 
 
156
@app: 
 
157
@envp: 
 
158
@Returns: 
 
159
 
 
160
 
 
161
<!-- ##### FUNCTION bonobo_application_register_unique ##### -->
 
162
<para>
 
163
 
 
164
</para>
 
165
 
 
166
@app: 
 
167
@serverinfo: 
 
168
@client: 
 
169
@Returns: 
 
170
 
 
171
 
 
172
<!-- ##### FUNCTION bonobo_application_add_hook ##### -->
 
173
<para>
 
174
 
 
175
</para>
 
176
 
 
177
@func: 
 
178
@data: 
 
179
 
 
180
 
 
181
<!-- ##### FUNCTION bonobo_application_remove_hook ##### -->
 
182
<para>
 
183
 
 
184
</para>
 
185
 
 
186
@func: 
 
187
@data: 
 
188
 
 
189