Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

Applications


Typedefs

typedef void( osso_application_exit_cb )(gboolean die_now, gpointer data)
typedef void( osso_application_top_cb_f )(const gchar *arguments, gpointer data)

Functions

osso_return_t osso_application_set_exit_cb (osso_context_t *osso, osso_application_exit_cb *cb, gpointer data)
osso_return_t osso_application_top (osso_context_t *osso, const gchar *application, const gchar *arguments)
osso_return_t osso_application_set_top_cb (osso_context_t *osso, osso_application_top_cb_f *cb, gpointer data)
osso_return_t osso_application_unset_top_cb (osso_context_t *osso, osso_application_top_cb_f *cb, gpointer data)

Typedef Documentation

typedef void( osso_application_exit_cb)(gboolean die_now, gpointer data)
 

This typedef is the application function that is registered via a call to osso_application_set_exit_cb.

Parameters:
die_now This boolean is set to TRUE if the application should save its state now and exit. if it is set to FALSE.
data The data given to osso_application_set_exit_cb.

typedef void( osso_application_top_cb_f)(const gchar *arguments, gpointer data)
 

This is the type for the top callback function.

Deprecated:
{ This feature will be removed from LibOSSO soon, use osso_rpc functions instead}
Parameters:
arguments This string lists some extra parameters for the application. It can be used to give the names of the files to open, etc.
data The data that was set with the osso_application_set_top_cb function.


Function Documentation

osso_return_t osso_application_set_exit_cb osso_context_t osso,
osso_application_exit_cb cb,
gpointer  data
 

This function will set

osso_return_t osso_application_set_top_cb osso_context_t osso,
osso_application_top_cb_f cb,
gpointer  data
 

This function registers a top-event handler.

Deprecated:
{ This feature will be removed from LibOSSO soon, use osso_rpc functions instead}
Parameters:
osso The library context as returned by osso_initialize.
cb The callback function.
data An arbitrary pointer to some application specific data.
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred or OSSO_INVALID if some parameter is invalid.

osso_return_t osso_application_top osso_context_t osso,
const gchar *  application,
const gchar *  arguments
 

This function topps an application. If the application is not running D-Bus will launch it via the Auto activation mechanism. By using this function only one instance of the application will be running. If the application is already running, this function will only "top" it.

Parameters:
osso The library context as returned by osso_initialize.
application The name of the application to top.
arguments This string lists some extra parameters for the application. It can be used to give the names of the files to open, etc. If no arguments are to be passed, set this to NULL.
Returns:
OSSO_OK if the application launch request was successfully sent to the dbus-daemon, OSSO_ERROR if not.

Example

This is an example on how to parse the argument from a top message. The format is the same as a commandline with long options, i.e. --param=value... So that the same arguments can be easily implemented as commandline arguments.

# include <unistd.h> # define _GNU_SOURCE # include <getopt.h> void top_handler(const gchar *arguments, gpointer data); { gchar **argv; gint argc; GError *err // this will split the arguments string into something similar to // what one would get in main. g_shell_parse_argv(arguments, &argc, &argv, &err); // This forces getopt to start from the first argument every time optind=0; optarg=argv; //call the generic commandline parser parse_commandline(argc, argv); // Free memory allocated previously. g_strfreev(argv); } void parse_commandline(int argc, char *argv[]) { static struct option long_options[] = { {"to", 1, 0, 't'}, // to requires an argument {"files", 1, 0, 'f'}, {"url", 1, 0, 'u'}, {0, 0, 0, 0} }; gint index = 0, r; while(1) { //This function will parse and return the next argument, //see getopt(3) for more info. r = getopt_long(argc, argv, "t:f:u:", long_options, &index); // No more arguments if(r == -1) break; switch(r) { case 't': // do something with the argument, optarg is a global, external // variable that will point to the parameter value handle_to(optarg); break; // And so on } } }

osso_return_t osso_application_unset_top_cb osso_context_t osso,
osso_application_top_cb_f cb,
gpointer  data
 

This function unregisters a top-event handler.

Deprecated:
{ This feature will be removed from LibOSSO soon, use osso_rpc functions instead}
Parameters:
osso The library context as returned by osso_initialize.
cb The callback function.
data The same pointer that was used with the call to osso_application_set_top_cb
Returns:
OSSO_OK if all goes well, OSSO_ERROR if an error occurred or OSSO_INVALID if some parameter is invalid.


Generated on Mon May 23 03:17:49 2005 for LibOSSO by doxygen 1.3.7