|  |  |  | libseahorse Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
| SeahorseContextSeahorseContext — This is where all the action in a Seahorse process comes together. | 
#include <libseahorse/seahorse-context.h>
                    SeahorseContextPrivate;
struct              SeahorseContext;
void                (*SeahorseObjectFunc)               (struct _SeahorseObject *obj,
                                                         gpointer user_data);
#define             SCTX_APP
SeahorseContext *     seahorse_context_for_app          (void);
SeahorseContext *     seahorse_context_new              (guint flags);
void                seahorse_context_destroy            (SeahorseContext *sctx);
#define             seahorse_context_is_daemon          (ctx)
void                seahorse_context_add_source         (SeahorseContext *sctx,
                                                         SeahorseSource *sksrc);
void                seahorse_context_take_source        (SeahorseContext *sctx,
                                                         SeahorseSource *sksrc);
void                seahorse_context_remove_source      (SeahorseContext *sctx,
                                                         SeahorseSource *sksrc);
SeahorseSource *      seahorse_context_find_source      (SeahorseContext *sctx,
                                                         GQuark ktype,
                                                         SeahorseLocation location);
GSList *              seahorse_context_find_sources     (SeahorseContext *sctx,
                                                         GQuark ktype,
                                                         SeahorseLocation location);
SeahorseSource *      seahorse_context_remote_source    (SeahorseContext *sctx,
                                                         const gchar *uri);
void                seahorse_context_add_object         (SeahorseContext *sctx,
                                                         struct _SeahorseObject *sobj);
void                seahorse_context_take_object        (SeahorseContext *sctx,
                                                         struct _SeahorseObject *sobj);
guint               seahorse_context_get_count          (SeahorseContext *sctx);
struct _SeahorseObject *      seahorse_context_get_object
                                                        (SeahorseContext *sctx,
                                                         SeahorseSource *sksrc,
                                                         GQuark id);
GList *               seahorse_context_get_objects      (SeahorseContext *sctx,
                                                         SeahorseSource *sksrc);
struct _SeahorseObject *      seahorse_context_find_object
                                                        (SeahorseContext *sctx,
                                                         GQuark id,
                                                         SeahorseLocation location);
GList *               seahorse_context_find_objects     (SeahorseContext *sctx,
                                                         GQuark ktype,
                                                         SeahorseUsage usage,
                                                         SeahorseLocation location);
GList *               seahorse_context_find_objects_full
                                                        (SeahorseContext *self,
                                                         struct _SeahorseObjectPredicate *skpred);
void                seahorse_context_for_objects_full   (SeahorseContext *self,
                                                         struct _SeahorseObjectPredicate *skpred,
                                                         SeahorseObjectFunc func,
                                                         gpointer user_data);
void                seahorse_context_verify_objects     (SeahorseContext *self);
void                seahorse_context_remove_object      (SeahorseContext *sctx,
                                                         struct _SeahorseObject *sobj);
SeahorseServiceDiscovery * seahorse_context_get_discovery
                                                        (SeahorseContext *sctx);
struct _SeahorseObject * seahorse_context_get_default_key
                                                        (SeahorseContext *sctx);
void                seahorse_context_refresh_auto       (SeahorseContext *sctx);
SeahorseOperation *   seahorse_context_search_remote    (SeahorseContext *sctx,
                                                         const gchar *search);
SeahorseOperation *   seahorse_context_transfer_objects (SeahorseContext *sctx,
                                                         GList *objs,
                                                         SeahorseSource *to);
SeahorseOperation *   seahorse_context_retrieve_objects (SeahorseContext *sctx,
                                                         GQuark ktype,
                                                         GSList *ids,
                                                         SeahorseSource *to);
GList *               seahorse_context_discover_objects (SeahorseContext *sctx,
                                                         GQuark ktype,
                                                         GSList *ids);
struct _SeahorseObject *      seahorse_context_object_from_dbus
                                                        (SeahorseContext *sctx,
                                                         const gchar *dbusid);
gchar *               seahorse_context_object_to_dbus   (SeahorseContext *sctx,
                                                         struct _SeahorseObject *sobj);
gchar *               seahorse_context_id_to_dbus       (SeahorseContext *sctx,
                                                         GQuark id);
GQuark              (*SeahorseCanonizeFunc)             (const gchar *id);
GQuark              seahorse_context_canonize_id        (GQuark ktype,
                                                         const gchar *id);
struct SeahorseContext {
	GObject parent;
	gboolean is_daemon;
};
This is where all the action in a Seahorse process comes together.
- Usually there's only one SeahorseContext per process created by passing
  SEAHORSE_CONTEXT_APP to seahorse_context_new(), and accessed via
  the SCTX_APP macro.
- Retains the list of all valid struct _SeahorseObject objects.
- Has a collection of SeahorseSource objects which add objects to the
  SeahorseContext.
Signals: added: A object was added to the context. removed: A object was removed from the context. changed: A object changed. destroy: The context was destroyed.
SeahorseContext *     seahorse_context_for_app          (void);
| Returns : | the application main context as SeahorseContext | 
SeahorseContext *     seahorse_context_new              (guint flags);
Creates a new SeahorseContext. Flags: SEAHORSE_CONTEXT_DAEMON: internal daemon flag will be set SEAHORSE_CONTEXT_APP: will support DNS-SD discovery and remote key sources
| 
 | Flags define the type of the context to create. | 
| Returns : | The new context | 
void                seahorse_context_destroy            (SeahorseContext *sctx);
Emits the destroy signal for sctx.
| 
 | SeahorseContext to destroy | 
void seahorse_context_add_source (SeahorseContext *sctx,SeahorseSource *sksrc);
Adds sksrc to the sctx. If sctx is NULL it will use the application context.
It also adds a reference to the new added source.
| 
 | A context to add a source to, can be NULL | 
| 
 | The source to add | 
void seahorse_context_take_source (SeahorseContext *sctx,SeahorseSource *sksrc);
Adds sksrc to the sctx. If sctx is NULL it will use the application context.
| 
 | A context to add a source to, can be NULL | 
| 
 | The source to add | 
void seahorse_context_remove_source (SeahorseContext *sctx,SeahorseSource *sksrc);
Remove all objects from source sksrc from the SeahorseContext sctx
| 
 | Context to remove objects from | 
| 
 | The source to remove | 
SeahorseSource * seahorse_context_find_source (SeahorseContext *sctx,GQuark ktype,SeahorseLocation location);
Finds a context where ktype and location match
| 
 | A SeahorseContext | 
| 
 | A seahorse tag (SEAHORSE_TAG_INVALID is wildcard) | 
| 
 | A location (SEAHORSE_LOCATION_INVALID is wildcard) | 
| Returns : | The context | 
GSList * seahorse_context_find_sources (SeahorseContext *sctx,GQuark ktype,SeahorseLocation location);
| 
 | the context to work with | 
| 
 | the type of the key to match. Or SEAHORSE_TAG_INVALID | 
| 
 | the location to match. Or SEAHORSE_LOCATION_INVALID | 
| Returns : | A list of seahorse sources matching ktypeandlocationas GSList. Must
be freed with g_slist_free | 
SeahorseSource * seahorse_context_remote_source (SeahorseContext *sctx,const gchar *uri);
Add a remote source to the Context sctx. If it already exists, the source
object will be returned.
| 
 | the context to add the source to (can be NULL) | 
| 
 | An URI to add as remote source | 
| Returns : | The SeahorseSource with this URI | 
void seahorse_context_add_object (SeahorseContext *sctx,struct _SeahorseObject *sobj);
Adds sobj to sctx. References sobj
| 
 | The context to add the object to | 
| 
 | The object to add | 
void seahorse_context_take_object (SeahorseContext *sctx,struct _SeahorseObject *sobj);
Adds sobj to sctx. If a similar object exists, it will be overwritten.
Emits the "added" signal.
| 
 | The SeahorseContext context to add an object to | 
| 
 | The SeahorseObject object to add | 
guint               seahorse_context_get_count          (SeahorseContext *sctx);
| 
 | The context. If NULL is passed it will take the application context | 
| Returns : | The number of objects in this context | 
struct _SeahorseObject * seahorse_context_get_object (SeahorseContext *sctx,SeahorseSource *sksrc,GQuark id);
Finds the object with the source sksrc and id in the context and returns it
| 
 | The SeahorseContext to look in | 
| 
 | The source to match | 
| 
 | the id to match | 
| Returns : | The matching object | 
GList * seahorse_context_get_objects (SeahorseContext *sctx,SeahorseSource *sksrc);
| Returns : | A GList of objects from selfthat match the sourcesource | 
struct _SeahorseObject * seahorse_context_find_object (SeahorseContext *sctx,GQuark id,SeahorseLocation location);
Finds the object with the id id at location location or better.
Local is better than remote...
| 
 | The SeahorseContext to work with (can be NULL) | 
| 
 | The id to look for | 
| 
 | The location to look for (at least) | 
| Returns : | the matching SeahorseObject or NULL if none is found | 
GList * seahorse_context_find_objects (SeahorseContext *sctx,GQuark ktype,SeahorseUsage usage,SeahorseLocation location);
| 
 | A SeahorseContext to look in (can be NULL) | 
| 
 | The tag to look for | 
| 
 | the usage (SeahorseUsage) | 
| 
 | the location to look for | 
| Returns : | A list of matching objects | 
GList * seahorse_context_find_objects_full (SeahorseContext *self,struct _SeahorseObjectPredicate *skpred);
Finds matching objects and adds them to the list
| 
 | The SeahorseContext to match objects in | 
| Returns : | a GList list containing the matching objects | 
void seahorse_context_for_objects_full (SeahorseContext *self,struct _SeahorseObjectPredicate *skpred,SeahorseObjectFunc func,gpointer user_data);
Calls func for every object in self matching the criteria in pred. user_data
is passed to this function
| 
 | SeahorseContext to work with | 
| 
 | Function to call for matching objects | 
| 
 | Data to pass to this function | 
void                seahorse_context_verify_objects     (SeahorseContext *self);
Verifies each key in the given context. An assertion handles failure.
| 
 | A SeahorseContext to verify | 
void seahorse_context_remove_object (SeahorseContext *sctx,struct _SeahorseObject *sobj);
Removes the object from the context
| 
 | The SeahorseContext (can be NULL) | 
| 
 | The SeahorseObject to remove | 
SeahorseServiceDiscovery * seahorse_context_get_discovery
                                                        (SeahorseContext *sctx);
seahorse_context_get_discovery is deprecated and should not be used in newly-written code. No replacement
Gets the Service Discovery object for this context.
| 
 | SeahorseContext object | 
| Returns : | The Service Discovery object. | 
struct _SeahorseObject * seahorse_context_get_default_key
                                                        (SeahorseContext *sctx);
seahorse_context_get_default_key is deprecated and should not be used in newly-written code. No replacement
| 
 | Current SeahorseContext | 
| Returns : | the secret key that's the default key | 
void                seahorse_context_refresh_auto       (SeahorseContext *sctx);
Starts a new refresh operation and emits the "refreshing" signal
| 
 | A SeahorseContext (can be NULL) | 
SeahorseOperation * seahorse_context_search_remote (SeahorseContext *sctx,const gchar *search);
Searches for the key matching search o the remote servers
| 
 | A SeahorseContext (can be NULL) | 
| 
 | a keyword (name, email address...) to search for | 
| Returns : | The created search operation | 
SeahorseOperation * seahorse_context_transfer_objects (SeahorseContext *sctx,GList *objs,SeahorseSource *to);
| 
 | The SeahorseContext (can be NULL) | 
| 
 | a source to import to (can be NULL) | 
| Returns : | A transfer operation | 
SeahorseOperation * seahorse_context_retrieve_objects (SeahorseContext *sctx,GQuark ktype,GSList *ids,SeahorseSource *to);
Copies remote objects to a local source
| 
 | A SeahorsecContext | 
| 
 | The type of the keys to transfer | 
| 
 | The key ids to transfer | 
| 
 | A SeahorseSource. If NULL, it will use ktypeto find a source | 
| Returns : | A SeahorseOperation | 
GList * seahorse_context_discover_objects (SeahorseContext *sctx,GQuark ktype,GSList *ids);
Downloads a list of keys from the keyserver
| 
 | the context to work with (can be NULL) | 
| 
 | the type of key to discover | 
| Returns : | The imported keys | 
struct _SeahorseObject * seahorse_context_object_from_dbus (SeahorseContext *sctx,const gchar *dbusid);
Finds an object basing on the key
| 
 | A SeahorseContext | 
| Returns : | The SeahorseObject found. NULL on not found. | 
gchar * seahorse_context_object_to_dbus (SeahorseContext *sctx,struct _SeahorseObject *sobj);
Translates an object to a string id
| 
 | A seahorse context | 
| 
 | the object | 
| Returns : | The string id of the object. Free with g_free | 
gchar * seahorse_context_id_to_dbus (SeahorseContext *sctx,GQuark id);
Translates an id to a dbus compatible string
| 
 | ignored | 
| 
 | the id to translate | 
| Returns : | A string, free with g_free |