| Libbonobo Reference Manual | ||||
|---|---|---|---|---|
void (*BonoboAppHookFunc) (BonoboApplication *app,gpointer data);BonoboApplication * bonobo_application_new (constchar *name);void bonobo_application_register_message (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType first_arg_type, ...);void bonobo_application_register_message_v (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType const arg_types[]);void bonobo_application_register_message_va (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType first_arg_type,va_list var_args);gint bonobo_application_new_instance (BonoboApplication *app,gint argc,gchar *argv[]);gchar * bonobo_application_create_serverinfo (BonoboApplication *app,gchar const *envp[]);Bonobo_RegistrationResult bonobo_application_register_unique (BonoboApplication *app,gchar const *serverinfo,BonoboAppClient **client);void bonobo_application_add_hook (BonoboAppHookFunc func,gpointer data);void bonobo_application_remove_hook (BonoboAppHookFunc func,gpointer data);
void (*BonoboAppHookFunc) (BonoboApplication *app,gpointer data);
app : |
|
data : |
BonoboApplication * bonobo_application_new (constchar *name);
Creates a new
name : |
application name |
| Returns : | a new |
void bonobo_application_register_message (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType first_arg_type, ...);
Registers a new message type that the application supports.
When opt_closure is provided (and is non-NULLopt_closure is NULL
Example 5. Function with a closure
static void
message_open_url_cb (BonoboApplication *app, const char *url, gboolean new_win)
{
...
}
...
closure = g_cclosure_new (G_CALLBACK (message_open_url_cb), NULL, NULL);
g_closure_set_marshal (closure, my_marshal_VOID__STRING_BOOLEAN);
bonobo_application_register_message (app, "open-url", "Opens a new URL in the browser."
" Parameters: url(string), open-in-new-window(boolean)",
closure, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_NONE);
Example 6. Function accepting variable number of arguments
static GValue *
message_open_url_cb (BonoboApplication *app, const char *message, GValueArray *args)
{
const char *url;
gboolean new_win = TRUE;
g_return_val_if_fail (strcmp (message, "open-url") == 0, NULL);
g_return_val_if_fail (args->n_values > 0, NULL);
g_return_val_if_fail (G_VALUE_HOLDS_STRING (&args->values[0]), NULL);
url = g_value_get_string (&args->values[0]);
if (args->n_values > 1)
{
g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&args->values[1]), NULL);
new_win = g_value_get_boolean (&args->values[1]);
}
...
return NULL;
}
...
bonobo_application_register_message (app, "open-url", "Opens a new URL in the browser."
" Parameters: url(string) [, open-in-new-window(boolean)]",
NULL, G_TYPE_NONE, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_NONE);
g_signal_connect (app, "message::open-url", G_CALLBACK (message_open_url_cb), NULL);
bonobo_app_client_msg_list()
app : |
a |
name : |
message string identifier |
description : |
a string containing a human readable description of the message |
opt_closure : |
a NULL |
return_type : |
Message return |
first_arg_type : |
G_TYPE_NONE |
... : |
G_TYPE_NONE |
void bonobo_application_register_message_v (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType const arg_types[]);
See bonobo_application_register_message().
app : |
a |
name : |
message string identifier |
description : |
a string containing a human readable description of the message |
opt_closure : |
a NULL |
return_type : |
Message return |
arg_types : |
G_TYPE_NONE |
void bonobo_application_register_message_va (BonoboApplication *app, constgchar *name, constgchar *description,GClosure *opt_closure,GType return_type,GType first_arg_type,va_list var_args);
See bonobo_application_register_message().
app : |
a |
name : |
message string identifier |
description : |
a string containing a human readable description of the message |
opt_closure : |
a NULL |
return_type : |
Message return |
first_arg_type : |
G_TYPE_NONE |
var_args : |
G_TYPE_NONE |
gint bonobo_application_new_instance (BonoboApplication *app,gint argc,gchar *argv[]);
Emit the "new-instance" signal of the
app : |
a |
argc : |
number of elements in argv
|
argv : |
array of strings (command-line arguments) |
| Returns : | signal return value |
gchar * bonobo_application_create_serverinfo (BonoboApplication *app,gchar const *envp[]);
This utility function provides a simple way to contruct a valid serverinfo XML string.
app : |
a |
envp : |
NULL |
| Returns : | a newly allocated string; caller must g_free() |
Bonobo_RegistrationResult bonobo_application_register_unique (BonoboApplication *app,gchar const *serverinfo,BonoboAppClient **client);
Try to register the running application, or check for an existing application already registered and get a reference to it. Applications already running but on different environments (as defined by the bonobo:environenment server property) than this one are ignored and do not interfere.
If the registration attempt indicates that another instance of this
application is already running, then the output variable
client will receive a newly created client is
set to NULL
app : |
a |
serverinfo : |
the XML server
description. bonobo_application_create_server_description() |
client : |
output parameter that will contain a client object, in
case another instance has already running, or NULL |
| Returns : | the registration result.
Bonobo_ACTIVATION_REG_SUCCESSBonobo_ACTIVATION_REG_ALREADY_ACTIVE |
void bonobo_application_add_hook (BonoboAppHookFunc func,gpointer data);
Add a hook function to be called whenever a new
func : |
hook function |
data : |
user data |
void bonobo_application_remove_hook (BonoboAppHookFunc func,gpointer data);
Removes a hook function previously set with bonobo_application_add_hook().
func : |
hook function |
data : |
user data |