![]() |
![]() |
![]() |
libgalago Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Signals |
#define GALAGO_DBUS_CORE_INTERFACE #define GALAGO_DBUS_CORE_OBJECT enum GalagoInitFlags; struct GalagoCore; gboolean galago_init (const char *name
,GalagoInitFlags flags
); void galago_uninit (void
); gboolean galago_is_initted (void
); gboolean galago_is_connected (void
); gboolean galago_is_registered (void
); gboolean galago_is_daemon_active (void
); gboolean galago_is_daemon (void
); DBusConnection * galago_get_dbus_conn (void
); const char * galago_get_uid (void
); const char * galago_get_client_obj_path (void
); gboolean galago_is_feed (void
); void galago_set_watch_all (gboolean watch_all
); gboolean galago_get_watch_all (void
); GalagoService * galago_create_service (const char *id
,const char *name
,GalagoServiceFlags flags
); GalagoService * galago_get_service (const char *id
,GalagoOrigin origin
,gboolean query
); GList * galago_get_services (GalagoOrigin origin
,gboolean query
); GalagoPerson * galago_create_person (const char *uid
); GalagoPerson * galago_get_person (const char *uid
,GalagoOrigin origin
,gboolean query
); GList * galago_get_people (GalagoOrigin origin
,gboolean query
); GalagoPerson * galago_get_me (GalagoOrigin origin
,gboolean query
); GalagoCore * galago_get_core (void
);
"calc-priority-account" :Run Last
"person-added" :Action
"person-removed" :Action
"registered" :Action
"service-added" :Action
"service-removed" :Action
"unregistered" :Action
The core API of Galago. These functions are used for initializing Galago, creating and retrieving top-level GalagoPerson and GalagoService objects, and listening to signals.
There is only one GalagoCore object, and it exists as long as Galago is
initialized (by calling galago_init()
). You can retrieve a pointer to it
using galago_get_core()
.
#define GALAGO_DBUS_CORE_INTERFACE "org.freedesktop.Galago.Core"
The D-BUS interface that GalagoCore maps to.
#define GALAGO_DBUS_CORE_OBJECT "/org/freedesktop/Galago/Core"
The D-BUS object path to the remote Core object.
typedef enum { GALAGO_INIT_CLIENT = 0, GALAGO_INIT_FEED = 1 << 0, GALAGO_INIT_NO_ACTIVATION = 1 << 1 } GalagoInitFlags;
Initialization flags passed to galago_init()
.
Initialize as a client. The connection will be used for querying data only. | |
Initialize as a feed. The connection will feed service, account, person,
and presence data to galago-daemon. This takes precedence over
GALAGO_INIT_CLIENT .
|
|
Don't activate the Galago service automatically. |
struct GalagoCore;
The core object. Fields should not be used directly. Use the accessor functions below.
gboolean galago_init (const char *name
,GalagoInitFlags flags
);
Initializes Galago.
|
The ID name used for this connection. It's often the name of the program, without spaces or special characters. |
|
The flags used for this connection. |
Returns : |
TRUE if initialization was successful, or FALSE otherwise. |
void galago_uninit (void
);
Uninitializes Galago.
This will be called automatically on exit, but can be called manually.
gboolean galago_is_initted (void
);
Returns whether or not Galago has been initialized.
Returns : |
TRUE if Galago has been initialized, or FALSE otherwise. |
gboolean galago_is_connected (void
);
Returns whether or not Galago is connected to the daemon.
Returns : |
TRUE if Galago is connected, or FALSE otherwise. |
gboolean galago_is_registered (void
);
Returns whether or not Galago is successfully registered to the daemon.
Returns : |
TRUE if this Galago connection is registered, or FALSE otherwise. |
gboolean galago_is_daemon_active (void
);
Returns whether or not the Galago daemon is active.
Returns : |
TRUE if the daemon is active, or FALSE. |
gboolean galago_is_daemon (void
);
Returns whether or not this instance of Galago is the daemon.
Returns : |
TRUE if this is the daemon, or FALSE. |
DBusConnection * galago_get_dbus_conn (void
);
Returns Galago's D-BUS connection.
Returns : |
The D-BUS connection. |
const char * galago_get_uid (void
);
Returns the local Galago connection's unique ID.
This ID is used in D-BUS object paths. The function is intended for internal purposes only.
Returns : |
This connection's unique ID. |
const char * galago_get_client_obj_path (void
);
Returns the D-BUS object path representing this connection.
Returns : |
This connection's D-BUS object path. |
gboolean galago_is_feed (void
);
Returns whether or not this Galago connection works as a feed.
Returns : |
TRUE if this connection works as a feed, or FALSE if not. |
void galago_set_watch_all (gboolean watch_all
);
Sets whether or not all services, accounts, etc. should be watched for property updates.
This will only add accounts, persons, presences, etc. that have a known parent object. That is, if a signal arrives for an account on a service that the local program does not know about, it will be ignored. If you wish to get information on every single object, call the list query functions first.
|
TRUE if everything should be watched, or FALSE. |
gboolean galago_get_watch_all (void
);
Returns whether or not all services, accounts, etc. is being watched for property updates.
Returns : |
TRUE if everything is being watched, or FALSE. |
GalagoService * galago_create_service (const char *id
,const char *name
,GalagoServiceFlags flags
);
Creates a service and adds it to the local cache.
The name and flags will be computed if the ID is understood internally. Otherwise, they will have to be provided.
|
The service ID. |
|
The service name. |
|
The flags. |
Returns : |
The new service, or a pointer to an existing one of the same ID. |
GalagoService * galago_get_service (const char *id
,GalagoOrigin origin
,gboolean query
);
Returns the service with the specified ID.
|
The service ID. |
|
The desired service's origin. |
|
TRUE if a remote query should be done if there is no local service found, or FALSE. |
Returns : |
The service, if found, or NULL. |
GList * galago_get_services (GalagoOrigin origin
,gboolean query
);
Returns a list of known services.
This may emit a service-added signal for every object that returns. If
your code connects to this signal and calls galago_get_services()
as
a result, you will want to add a lock so that you don't end up with
unwanted side-effects.
|
The desired origin. |
|
TRUE if a remote query should be done if there are no local services found, or FALSE. |
Returns : |
The list of services, or NULL. |
GalagoPerson * galago_create_person (const char *uid
);
Creates a person and adds it to the local cache.
|
The person UID. |
Returns : |
The new person, or an existing one if one already exists with this UID. |
GalagoPerson * galago_get_person (const char *uid
,GalagoOrigin origin
,gboolean query
);
Returns the person with the specified UID.
|
The person's UID. |
|
The desired person's origin. |
|
TRUE if a remote query should be done if there is no local person found, or FALSE. |
Returns : |
The person, if found, or NULL. |
GList * galago_get_people (GalagoOrigin origin
,gboolean query
);
Returns a list of known people.
This may emit a person-added signal for every object that returns. If
your code connects to this signal and calls galago_get_people()
as
a result, you will want to add a lock so that you don't end up with
unwanted side-effects.
|
The desired origin. |
|
TRUE if a remote query should be done if there is no local people found, or FALSE. |
Returns : |
The people, if found, or NULL. |
GalagoPerson * galago_get_me (GalagoOrigin origin
,gboolean query
);
Returns the "Me" person.
If origin is GALAGO_LOCAL, this will always return a "Me" person. In the remote case, it will only return one if query is TRUE, or if it has already retrieved a remote "Me" person.
|
The desired person's origin. |
|
TRUE if a remote query should be done if there is no local person found, or FALSE. |
Returns : |
The "Me" person, if found, or NULL. |
GalagoCore * galago_get_core (void
);
Returns the core object.
This is needed for signals.
Returns : |
The core object. |
"calc-priority-account"
signalGalagoAccount* user_function (GalagoCore *core,
GalagoPerson *person,
gpointer user_data) : Run Last
Emitted when the priority account for a person needs to be calculated. The callback function should return the account that is considered the priority, which is by default the most available one.
|
The object which received the signal. |
|
The person the priority account is being calculated for. |
|
user data set when the signal handler was connected. |
Returns : |
The priority account. |
"person-added"
signalvoid user_function (GalagoCore *core,
GalagoPerson *person,
gpointer user_data) : Action
Emitted when a person is added.
|
The object which received the signal. |
|
The person added. |
|
user data set when the signal handler was connected. |
"person-removed"
signalvoid user_function (GalagoCore *core,
GalagoPerson *person,
gpointer user_data) : Action
Emitted when a person is removed.
|
The object which received the signal. |
|
The person removed. |
|
user data set when the signal handler was connected. |
"registered"
signalvoid user_function (GalagoCore *core,
gpointer user_data) : Action
Emitted when the application successfully registers with the daemon.
|
The object which received the signal. |
|
user data set when the signal handler was connected. |
"service-added"
signalvoid user_function (GalagoCore *core,
GalagoService *service,
gpointer user_data) : Action
Emitted when a service is added.
|
The object which received the signal. |
|
The service added. |
|
user data set when the signal handler was connected. |
"service-removed"
signalvoid user_function (GalagoCore *core,
GalagoService *service,
gpointer user_data) : Action
Emitted when a service is removed.
|
The object which received the signal. |
|
The service removed. |
|
user data set when the signal handler was connected. |
"unregistered"
signalvoid user_function (GalagoCore *core,
gpointer user_data) : Action
Emitted when the application unregisters with the daemon.
|
The object which received the signal. |
|
user data set when the signal handler was connected. |