1
<!-- ##### SECTION Title ##### -->
4
<!-- ##### SECTION Short_Description ##### -->
5
a framework for unique application instance and automation
7
<!-- ##### SECTION Long_Description ##### -->
12
<!-- ##### SECTION See_Also ##### -->
17
<!-- ##### USER_FUNCTION BonoboAppHookFunc ##### -->
26
<!-- ##### FUNCTION bonobo_application_new ##### -->
35
<!-- ##### FUNCTION bonobo_application_register_message ##### -->
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.
46
<title>Function with a closure</title>
49
message_open_url_cb (BonoboApplication *app, const char *url, gboolean new_win)
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);
65
<title>Function accepting variable number of arguments</title>
68
message_open_url_cb (BonoboApplication *app, const char *message, GValueArray *args)
71
gboolean new_win = TRUE;
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 (&args->values[0]), NULL);
77
url = g_value_get_string (&args->values[0]);
78
if (args->n_values > 1)
80
g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&args->values[1]), NULL);
81
new_win = g_value_get_boolean (&args->values[1]);
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);
93
g_signal_connect (app, "message::open-url", G_CALLBACK (message_open_url_cb), NULL);
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>
113
<!-- ##### FUNCTION bonobo_application_register_message_v ##### -->
126
<!-- ##### FUNCTION bonobo_application_register_message_va ##### -->
140
<!-- ##### FUNCTION bonobo_application_new_instance ##### -->
151
<!-- ##### FUNCTION bonobo_application_create_serverinfo ##### -->
161
<!-- ##### FUNCTION bonobo_application_register_unique ##### -->
172
<!-- ##### FUNCTION bonobo_application_add_hook ##### -->
181
<!-- ##### FUNCTION bonobo_application_remove_hook ##### -->