1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194
|
/*
* Seahorse
*
* Copyright (C) 2003 Jacob Perkins
* Copyright (C) 2004-2005 Stefan Walter
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SEAHORSE_CONTEXT_H__
#define __SEAHORSE_CONTEXT_H__
#include <gtk/gtk.h>
#include "seahorse-source.h"
#define SEAHORSE_TYPE_CONTEXT (seahorse_context_get_type ())
#define SEAHORSE_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SEAHORSE_TYPE_CONTEXT, SeahorseContext))
#define SEAHORSE_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SEAHORSE_TYPE_CONTEXT, SeahorseContextClass))
#define SEAHORSE_IS_CONTEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SEAHORSE_TYPE_CONTEXT))
#define SEAHORSE_IS_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SEAHORSE_TYPE_CONTEXT))
#define SEAHORSE_CONTEXT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SEAHORSE_TYPE_CONTEXT, SeahorseContextClass))
struct _SeahorseKey;
struct _SeahorseObject;
struct _SeahorseObjectPredicate;
typedef struct _SeahorseContext SeahorseContext;
typedef struct _SeahorseContextClass SeahorseContextClass;
typedef struct _SeahorseContextPrivate SeahorseContextPrivate;
/**
* SeahorseContext:
* @parent: The parent #GtkObject
* @is_daemon: a #gboolean indicating whether the context is being used in a
* program that is daemonized
*
* 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.
*/
struct _SeahorseContext {
GObject parent;
/*< public >*/
gboolean is_daemon;
/*< private >*/
SeahorseContextPrivate *pv;
};
struct _SeahorseContextClass {
GObjectClass parent_class;
/* signals --------------------------------------------------------- */
/* A object was added to this source */
void (*added) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
/* Removed a object from this source */
void (*removed) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
/* This object has changed */
void (*changed) (SeahorseContext *sctx, struct _SeahorseObject *sobj);
/* The source is being refreshed */
void (*refreshing) (SeahorseContext *sctx, SeahorseOperation *op);
void (*destroy) (SeahorseContext *sctx);
};
enum SeahorseContextType {
SEAHORSE_CONTEXT_APP = 1,
SEAHORSE_CONTEXT_DAEMON = 2,
};
typedef void (*SeahorseObjectFunc) (struct _SeahorseObject *obj, gpointer user_data);
#define SCTX_APP() (seahorse_context_for_app ())
GType seahorse_context_get_type (void);
SeahorseContext* seahorse_context_for_app (void);
SeahorseContext* seahorse_context_new (guint flags);
void seahorse_context_destroy (SeahorseContext *sctx);
#define seahorse_context_is_daemon(ctx) ((ctx)->is_daemon)
void seahorse_context_add_source (SeahorseContext *sctx,
SeahorseSource *sksrc);
void seahorse_context_take_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);
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_remove_object (SeahorseContext *sctx,
struct _SeahorseObject *sobj);
struct _SeahorseObject*
seahorse_context_get_default_key (SeahorseContext *sctx);
void seahorse_context_refresh_auto (SeahorseContext *sctx);
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);
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);
typedef GQuark (*SeahorseCanonizeFunc) (const gchar *id);
GQuark seahorse_context_canonize_id (GQuark ktype, const gchar *id);
#endif /* __SEAHORSE_CONTEXT_H__ */
|