[seahorse/wip/nielsdg/src-port: 4/4] WIP
- From: Niels De Graef <nielsdg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [seahorse/wip/nielsdg/src-port: 4/4] WIP
- Date: Fri, 9 Feb 2018 20:03:02 +0000 (UTC)
commit 099b5d1cf4f40ae3cd532e8af7f443b1c584ddc2
Author: Niels De Graef <nielsdegraef gmail com>
Date: Thu Feb 1 19:49:46 2018 +0100
WIP
src/search-provider.vala | 826 ++++++++++++++++------------------------------
1 files changed, 276 insertions(+), 550 deletions(-)
---
diff --git a/src/search-provider.vala b/src/search-provider.vala
index 5941952..3cfa5da 100644
--- a/src/search-provider.vala
+++ b/src/search-provider.vala
@@ -17,554 +17,280 @@
* <http://www.gnu.org/licenses/>.
*/
-/* #define SECRET_API_SUBJECT_TO_CHANGE */
-
-struct _SeahorseSearchProvider {
- SeahorseShellSearchProvider2Skeleton parent;
-
- GcrUnionCollection *union_collection;
-
- SeahorsePredicate base_predicate;
- GcrCollection *collection;
- GHashTable *handles;
- GList *queued_requests;
- int n_loading;
-};
-
-struct _SeahorseSearchProviderClass {
- SeahorseShellSearchProvider2SkeletonClass parent_class;
-};
-
-static void seahorse_shell_search_provider2_iface_init (SeahorseShellSearchProvider2Iface *iface);
-
-G_DEFINE_TYPE_WITH_CODE (SeahorseSearchProvider, seahorse_search_provider,
SEAHORSE_TYPE_SHELL_SEARCH_PROVIDER2_SKELETON,
- G_IMPLEMENT_INTERFACE (SEAHORSE_TYPE_SHELL_SEARCH_PROVIDER2,
seahorse_shell_search_provider2_iface_init))
-
-typedef struct {
- GDBusMethodInvocation *invocation;
- char **terms;
-} QueuedRequest;
-
-/* Search through row for text */
-static gboolean
-object_contains_filtered_text (GObject *object,
- const gchar *text)
-{
- gchar* name = NULL;
- gchar* description = NULL;
- gchar* lower;
- gboolean ret = FALSE;
-
- g_object_get (object, "label", &name, NULL);
- if (name != NULL) {
- lower = g_utf8_strdown (name, -1);
- if (strstr (lower, text))
- ret = TRUE;
- g_free (lower);
- g_free (name);
- }
-
- if (!ret && g_object_class_find_property (G_OBJECT_GET_CLASS (object), "description")) {
- g_object_get (object, "description", &description, NULL);
- if (description != NULL) {
- lower = g_utf8_strdown (description, -1);
- if (strstr (lower, text))
- ret = TRUE;
- g_free (lower);
- g_free (description);
- }
- }
-
- return ret;
+//#define SECRET_API_SUBJECT_TO_CHANGE
+
+ /* SeahorseShellSearchProvider2SkeletonClass parent_class; */
+[DBus (name = "org.gnome.Shell.SearchProvider2")]
+public class Seahorse.SearchProvider {
+ private Gcr.UnionCollection union_collection;
+
+ private Predicate base_predicate;
+ private Gcr.Collection collection;
+ private HashTable<string, weak Seahorse.Object> handles;
+ private List<QueuedRequest?> queued_requests;
+ private int n_loading;
+
+ private struct QueuedRequest {
+ public DBusMethodInvocation invocation;
+ public string[] terms;
+ }
+
+ public SearchProvider() {
+ this.union_collection = new Gcr.UnionCollection();
+
+ this.base_predicate.flags = Flags.PERSONAL;
+ this.base_predicate.custom = check_object_type;
+ this.collection = new Seahorse.Collection.for_predicate (this.union_collection, this.base_predicate,
null);
+ this.handles = new HashTable.full<string, weak Seahorse.Object> (str_hash, str_equal, free, null);
+ }
+
+ ~SearchProvider() {
+ this.handles.foreach( (__, obj) => {
+ obj.weak_unref (on_object_gone, this.handles);
+ });
+ }
+
+ public void initialize() {
+ foreach (Backend backend in Backend.get_registered()) {
+ this.n_loading++;
+
+ backend.notify["loaded"].connect(on_backend_loaded);
+ backend.added.connect(on_place_added);
+ backend.removed.connect(on_place_removed);
+
+ foreach (GLib.Object place in backend.get_objects())
+ on_place_added (backend, place);
+ }
+ }
+
+ public async string[] GetInitialResultSet (string[] terms) {
+ hold_app ();
+
+ if (queue_request_if_not_loaded(invocation, terms))
+ return true;
+
+ Predicate predicate = Predicate () {
+ custom = object_matches_search,
+ custom_target = terms
+ };
+
+ string?[] results = {};
+ foreach (GLib.Object obj in this.collection.get_objects()) {
+ if (predicate.match(obj)) {
+ string str = "%p".printf(obj);
+
+ if (!(str in this.handles)) {
+ this.handles.insert(str, (Object) obj);
+ obj.weak_ref(on_object_gone, this.handles);
+ }
+ results += str;
+ }
+ }
+
+ release_app ();
+ results += null;
+ return results;
+ }
+
+ public async string[] GetSubsearchResultSet (string[] previous_results, string[] new_terms) {
+ if (error_request_if_not_loaded(invocation))
+ return true;
+
+ hold_app ();
+
+ Predicate predicate = Predicate () {
+ custom = object_matches_search,
+ custom_target = new_terms
+ };
+
+ string?[] results = {};
+ foreach (string previous_result in previous_results) {
+ GLib.Object? object = this.handles.lookup(previous_result);
+ if (object == null || !this.collection.contains(object)) {
+ continue; // Bogus value
+ }
+
+ if (predicate.match(object))
+ results += previous_result;
+ }
+
+ release_app ();
+ results += null;
+ return results;
+ }
+
+ public async HashTable<string, Variant>[] GetResultMetas (string[] results) {
+ hold_app ();
+ VariantBuilder builder = new VariantBuilder(new VariantType("aa{sv}"));
+
+ foreach (string result in results) {
+ Seahorse.Object object = this.handles.lookup(result);
+ if (object == null || !(object in this.collection))
+ continue; // Bogus value
+
+ builder.open(new VariantType("a{sv}"));
+ builder.add("{sv}", "id", new Variant.string(result));
+ if (object.label != null)
+ builder.add("{sv}", "name", new Variant.string(object.label));
+
+ if (object.icon != null) {
+ Variant? icon_variant = object.icon.serialize();
+ if (icon_variant != null)
+ builder.add("{sv}", "icon", icon_variant);
+ }
+
+ string? description = get_description_if_available(object);
+ if (description != null) {
+ string escaped_description = Markup.escape_text(description);
+ builder.add("{sv}", "description", new Variant.string(description));
+ }
+
+ builder.close();
+ }
+ }
+
+ public void ActivateResult (string search_id, string[] terms, uint32 timestamp) {
+ hold_app ();
+ sscanf (identifier, "%p", &object);
+
+ Seahorse.Object object = this.handles.lookup(identifier);
+ if (object == null || !(object in this.collection) || !(object is Viewable))
+ return; // Bogus value
+
+ KeyManager key_manager = KeyManager.show(timestamp);
+ ((Viewable) object).view((Gtk.Window) key_manager);
+
+ release_app ();
+ }
+
+ public void LaunchSearch (string[] terms, uint32 timestamp) {
+ // TODO
+ }
+
+ /* Search through row for text */
+ private bool object_contains_filtered_text (Seahorse.Object object, string? text) {
+ string? name = object.label;
+ if (name != null && (text in name.down()))
+ return true;
+
+ string? description = get_description_if_available (object);
+ if (description != null && (text in description.down()))
+ return true;
+
+ return false;
+ }
+
+ private bool object_matches_search (Seahorse.Object? object, void* terms) {
+ foreach (string term in ((string[]) terms)) {
+ if (!object_contains_filtered_text (object, term))
+ return false;
+ }
+
+ return true;
+ }
+
+ private void on_object_gone(void* data, GLib.Object? where_the_object_was) {
+ HashTable handles = data;
+ handles.remove("%p".printf((void*)where_the_object_was));
+ }
+
+ // We called before loading, we queue GetInitialResultSet, but
+ // we drop all other calls, because we don't expect to see them
+ // before we reply to GetInitialResultSet
+
+ private void hold_app() {
+ ((Seahorse.Application) Application.get()).hold();
+ }
+
+ private void release_app() {
+ ((Seahorse.Application) Application.get()).release();
+ }
+
+ private bool queue_request_if_not_loaded (DBusMethodInvocation invocation, string[] terms) {
+ if (this.n_loading <= 0)
+ return false;
+
+ QueuedRequest req = QueuedRequest () {
+ invocation = invocation,
+ terms = terms
+ };
+
+ this.queued_requests.prepend (req);
+ return true;
+ }
+
+ private bool error_request_if_not_loaded (DBusMethodInvocation invocation) {
+ if (this.n_loading > 0) {
+ invocation.return_dbus_error("org.gnome.Seahore.Error.NotLoaded",
+ _("The search provider is not loaded yet"));
+ return true;
+ } else {
+ return false;
+ }
+ }
+ private void on_place_added (Gcr.Collection places, GLib.Object object) {
+ Place place = (Place) object;
+ if (!this.union_collection.have(place))
+ this.union_collection.add(place);
+ }
+
+ private void on_place_removed (Gcr.Collection places, GLib.Object object) {
+ Place place = (Place) object;
+ if (this.union_collection.have(place))
+ this.union_collection.remove(place);
+ }
+
+ private void on_backend_loaded (GLib.Object? object, ParamSpec pspec) {
+ this.n_loading--;
+ if (this.n_loading > 0)
+ return;
+
+ foreach (QueuedRequest? req in this.queued_requests) {
+ handle_get_initial_result_set (SEAHORSE_SHELL_SEARCH_PROVIDER2 (self),
+ req.invocation, req.terms);
+
+ /* In the previous get_initial_result_set() we had one unbalanced
+ hold, so we release it now. */
+ release_app ();
+ g_object_unref (req.invocation);
+ g_strfreev (req.terms);
+ g_slice_free (QueuedRequest, req);
+ }
+
+ this.queued_requests = null;
+ }
+
+ private static bool check_object_type (GLib.Object? object, void* custom_target) {
+ if (!(object is Viewable))
+ return false;
+
+ if (object is Secret.Item) {
+ string? schema_name = ((Secret.Item) object).get_schema_name ();
+ if (schema_name != "org.gnome.keyring.Note")
+ return false;
+ }
+
+ return true;
+ }
+
+ public bool seahorse_search_provider_dbus_register (DBusConnection connection, string? object_path)
throws GLib.Error {
+ return export (connection, object_path, error);
+ }
+
+ public void seahorse_search_provider_dbus_unregister (DBusConnection connection, string? object_path) {
+ if (has_connection(connection))
+ unexport_from_connection(connection);
+ }
+
+ private string? get_description_if_available (GLib.Object? obj) {
+ if (obj == null)
+ return null;
+
+ if (obj.get_class().find_property("description") == null)
+ return null;
+
+ string? description = null;
+ obj.get("description", out description);
+ return description;
+ }
}
-
-static gboolean
-object_matches_search (GObject *object,
- gpointer user_data)
-{
- char **terms = user_data;
- int i;
-
- for (i = 0; terms[i]; i++) {
- if (!object_contains_filtered_text (object, terms[i]))
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-init_predicate (SeahorsePredicate *predicate,
- char **terms)
-{
- memset(predicate, 0, sizeof(SeahorsePredicate));
-
- predicate->custom = object_matches_search;
- predicate->custom_target = terms;
-}
-
-static void
-on_object_gone (gpointer data,
- GObject *where_the_object_was)
-{
- GHashTable *handles = data;
- gchar *str = g_strdup_printf ("%p", (gpointer)where_the_object_was);
- g_hash_table_remove (handles, str);
- g_free (str);
-}
-
-/* We called before loading, we queue GetInitialResultSet, but
- we drop all other calls, because we don't expect to see them
- before we reply to GetInitialResultSet
-*/
-
-static void
-hold_app (void)
-{
- SeahorseApplication *app;
-
- app = SEAHORSE_APPLICATION (seahorse_application_get ());
- g_application_hold (G_APPLICATION (app));
-}
-
-static void
-release_app (void)
-{
- SeahorseApplication *app;
-
- app = SEAHORSE_APPLICATION (seahorse_application_get ());
- g_application_release (G_APPLICATION (app));
-}
-
-static gboolean
-queue_request_if_not_loaded (SeahorseSearchProvider *self,
- GDBusMethodInvocation *invocation,
- const char * const *terms)
-{
- QueuedRequest *req;
-
- if (self->n_loading <= 0)
- return FALSE;
-
- req = g_slice_new (QueuedRequest);
- req->invocation = g_object_ref (invocation);
- req->terms = g_strdupv ((char**) terms);
-
- self->queued_requests = g_list_prepend (self->queued_requests, req);
- return TRUE;
-}
-
-static gboolean
-error_request_if_not_loaded (SeahorseSearchProvider *self,
- GDBusMethodInvocation *invocation)
-{
- if (self->n_loading > 0) {
- g_dbus_method_invocation_return_dbus_error (invocation,
- "org.gnome.Seahore.Error.NotLoaded",
- _("The search provider is not loaded yet"));
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static gboolean
-handle_get_initial_result_set (SeahorseShellSearchProvider2 *skeleton,
- GDBusMethodInvocation *invocation,
- const char * const *terms)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (skeleton);
- SeahorsePredicate predicate;
- GPtrArray *array;
- GList *objects, *l;
- char **results;
-
- hold_app ();
-
- if (queue_request_if_not_loaded (self, invocation, terms))
- return TRUE;
-
- init_predicate (&predicate, (char **) terms);
-
- array = g_ptr_array_new ();
- objects = gcr_collection_get_objects (self->collection);
-
- for (l = objects; l; l = l->next) {
- if (seahorse_predicate_match (&predicate, l->data)) {
- char *str = g_strdup_printf("%p", l->data);
-
- if (!g_hash_table_contains (self->handles, str)) {
- g_hash_table_insert (self->handles, g_strdup (str), l->data);
- g_object_weak_ref (l->data, on_object_gone, self->handles);
- }
- g_ptr_array_add (array, str);
- }
- }
-
- g_list_free (objects);
- g_ptr_array_add (array, NULL);
- results = (char **) g_ptr_array_free (array, FALSE);
-
- seahorse_shell_search_provider2_complete_get_initial_result_set (skeleton,
- invocation,
- (const char* const*) results);
-
- g_strfreev (results);
- release_app ();
- return TRUE;
-}
-
-static gboolean
-handle_get_subsearch_result_set (SeahorseShellSearchProvider2 *skeleton,
- GDBusMethodInvocation *invocation,
- const char * const *previous_results,
- const char * const *terms)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (skeleton);
- SeahorsePredicate predicate;
- GPtrArray *array;
- int i;
- char **results;
-
- if (error_request_if_not_loaded (self, invocation))
- return TRUE;
-
- hold_app ();
- init_predicate (&predicate, (char **) terms);
-
- array = g_ptr_array_new ();
-
- for (i = 0; previous_results[i]; i++) {
- GObject *object;
-
- object = g_hash_table_lookup (self->handles, previous_results[i]);
- if (!object || !gcr_collection_contains (self->collection, object)) {
- /* Bogus value */
- continue;
- }
-
- if (seahorse_predicate_match (&predicate, object)) {
- g_ptr_array_add (array, (char*) previous_results[i]);
- }
- }
-
- g_ptr_array_add (array, NULL);
- results = (char **) g_ptr_array_free (array, FALSE);
-
- seahorse_shell_search_provider2_complete_get_subsearch_result_set (skeleton,
- invocation,
- (const char* const*) results);
-
- /* g_free, not g_strfreev, because we don't duplicate result strings */
- g_free (results);
- release_app ();
- return TRUE;
-}
-
-static gboolean
-handle_get_result_metas (SeahorseShellSearchProvider2 *skeleton,
- GDBusMethodInvocation *invocation,
- const char * const *results)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (skeleton);
- int i;
- GVariantBuilder builder;
- char *name, *description, *escaped_description;
- GVariant *icon_variant;
- GIcon *icon;
-
- if (error_request_if_not_loaded (self, invocation))
- return TRUE;
-
- hold_app ();
- g_variant_builder_init (&builder, G_VARIANT_TYPE ("aa{sv}"));
-
- for (i = 0; results[i]; i++) {
- GObject *object;
-
- object = g_hash_table_lookup (self->handles, results[i]);
- if (!object || !gcr_collection_contains (self->collection, object)) {
- /* Bogus value */
- continue;
- }
-
- g_object_get (object,
- "label", &name,
- "icon", &icon,
- "description", &description,
- NULL);
-
- g_variant_builder_open (&builder, G_VARIANT_TYPE ("a{sv}"));
- g_variant_builder_add (&builder, "{sv}",
- "id", g_variant_new_string (results[i]));
- if (name) {
- g_variant_builder_add (&builder, "{sv}",
- "name", g_variant_new_string (name));
- g_free (name);
- }
- if (icon) {
- icon_variant = g_icon_serialize (icon);
- if (icon_variant) {
- g_variant_builder_add (&builder, "{sv}",
- "icon", icon_variant);
- g_variant_unref (icon_variant);
- }
- g_object_unref (icon);
- }
- if (description) {
- escaped_description = description ? g_markup_escape_text (description, -1) : NULL;
- g_variant_builder_add (&builder, "{sv}",
- "description",
- escaped_description ? g_variant_new_string (description) :
NULL);
- g_free (escaped_description);
- g_free (description);
- }
-
- g_variant_builder_close (&builder);
- }
-
- seahorse_shell_search_provider2_complete_get_result_metas (skeleton,
- invocation,
- g_variant_builder_end (&builder));
- release_app ();
- return TRUE;
-}
-
-static gboolean
-handle_activate_result (SeahorseShellSearchProvider2 *skeleton,
- GDBusMethodInvocation *invocation,
- const char *identifier,
- const char * const *results,
- guint timestamp)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (skeleton);
- GObject *object;
- SeahorseKeyManager *key_manager;
-
- if (error_request_if_not_loaded (self, invocation))
- return TRUE;
-
- hold_app ();
- sscanf (identifier, "%p", &object);
-
- object = g_hash_table_lookup (self->handles, identifier);
- if (!object || !gcr_collection_contains (self->collection, object) ||
- !SEAHORSE_IS_VIEWABLE (object)) {
- /* Bogus value */
- return TRUE;
- }
-
- key_manager = seahorse_key_manager_show (timestamp);
- seahorse_viewable_view (object, GTK_WINDOW (key_manager));
-
- seahorse_shell_search_provider2_complete_activate_result (skeleton,
- invocation);
- release_app ();
- return TRUE;
-}
-
-static gboolean
-handle_launch_search (SeahorseShellSearchProvider2 *skeleton,
- GDBusMethodInvocation *invocation,
- const char * const *terms,
- guint timestamp)
-{
- /* TODO */
- return FALSE;
-}
-
-static void
-on_place_added (GcrCollection *places,
- GObject *place,
- gpointer user_data)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (user_data);
-
- if (!gcr_union_collection_have (self->union_collection,
- GCR_COLLECTION (place)))
- gcr_union_collection_add (self->union_collection,
- GCR_COLLECTION (place));
-}
-
-static void
-on_place_removed (GcrCollection *places,
- GObject *place,
- gpointer user_data)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (user_data);
-
- if (gcr_union_collection_have (self->union_collection,
- GCR_COLLECTION (place)))
- gcr_union_collection_remove (self->union_collection,
- GCR_COLLECTION (place));
-}
-
-static void
-on_backend_loaded (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (user_data);
- GList *iter;
-
- self->n_loading--;
- if (self->n_loading > 0)
- return;
-
- for (iter = self->queued_requests; iter; iter = iter->next) {
- QueuedRequest *req = iter->data;
-
- handle_get_initial_result_set (SEAHORSE_SHELL_SEARCH_PROVIDER2 (self),
- req->invocation,
- (const char * const *) req->terms);
-
- /* In the previous get_initial_result_set() we had one unbalanced
- hold, so we release it now. */
- release_app ();
- g_object_unref (req->invocation);
- g_strfreev (req->terms);
- g_slice_free (QueuedRequest, req);
- }
-
- g_list_free (self->queued_requests);
- self->queued_requests = NULL;
-}
-
-void
-seahorse_search_provider_initialize (SeahorseSearchProvider *self)
-{
- GList *backends, *l;
- GList *places, *p;
-
- backends = seahorse_backend_get_registered ();
- for (l = backends; l != NULL; l = g_list_next (l)) {
- self->n_loading ++;
- g_signal_connect_object (l->data, "notify::loaded", G_CALLBACK (on_backend_loaded), self, 0);
-
- g_signal_connect_object (l->data, "added", G_CALLBACK (on_place_added), self, 0);
- g_signal_connect_object (l->data, "removed", G_CALLBACK (on_place_removed), self, 0);
-
- places = gcr_collection_get_objects (l->data);
- for (p = places; p != NULL; p = g_list_next (p))
- on_place_added (l->data, p->data, self);
- g_list_free (places);
- }
- g_list_free (backends);
-}
-
-static gboolean
-check_object_type (GObject *object,
- gpointer user_data)
-{
- if (!SEAHORSE_IS_VIEWABLE (object))
- return FALSE;
-
- if (SECRET_IS_ITEM (object)) {
- const char *schema_name;
-
- schema_name = secret_item_get_schema_name (SECRET_ITEM (object));
- if (g_strcmp0 (schema_name, "org.gnome.keyring.Note") != 0)
- return FALSE;
- }
-
- return TRUE;
-}
-
-static void
-seahorse_shell_search_provider2_iface_init (SeahorseShellSearchProvider2Iface *iface)
-{
- iface->handle_get_initial_result_set = handle_get_initial_result_set;
- iface->handle_get_subsearch_result_set = handle_get_subsearch_result_set;
- iface->handle_get_result_metas = handle_get_result_metas;
- iface->handle_activate_result = handle_activate_result;
- iface->handle_launch_search = handle_launch_search;
-}
-
-static void
-seahorse_search_provider_init (SeahorseSearchProvider *self)
-{
- SeahorseCollection *filtered;
- GcrCollection *base;
-
- base = gcr_union_collection_new ();
- self->union_collection = GCR_UNION_COLLECTION (base);
-
- self->base_predicate.flags = SEAHORSE_FLAG_PERSONAL;
- self->base_predicate.custom = check_object_type;
-
- filtered = seahorse_collection_new_for_predicate (base,
- &self->base_predicate, NULL);
- self->collection = GCR_COLLECTION (filtered);
-
- self->handles = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
-}
-
-gboolean
-seahorse_search_provider_dbus_register (SeahorseSearchProvider *self,
- GDBusConnection *connection,
- const gchar *object_path,
- GError **error)
-{
- GDBusInterfaceSkeleton *skeleton;
-
- skeleton = G_DBUS_INTERFACE_SKELETON (self);
-
- return g_dbus_interface_skeleton_export (skeleton, connection, object_path, error);
-}
-
-void
-seahorse_search_provider_dbus_unregister (SeahorseSearchProvider *self,
- GDBusConnection *connection,
- const gchar *object_path)
-{
- GDBusInterfaceSkeleton *skeleton;
-
- skeleton = G_DBUS_INTERFACE_SKELETON (self);
-
- if (g_dbus_interface_skeleton_has_connection (skeleton, connection))
- g_dbus_interface_skeleton_unexport_from_connection (skeleton, connection);
-}
-
-static void
-seahorse_search_provider_dispose (GObject *object)
-{
- SeahorseSearchProvider *self;
-
- self = SEAHORSE_SEARCH_PROVIDER (object);
-
- g_clear_object (&self->collection);
-
- G_OBJECT_CLASS (seahorse_search_provider_parent_class)->dispose (object);
-}
-
-static void
-seahorse_search_provider_finalize (GObject *object)
-{
- SeahorseSearchProvider *self = SEAHORSE_SEARCH_PROVIDER (object);
- GHashTableIter iter;
- gpointer value;
-
- g_hash_table_iter_init (&iter, self->handles);
- while (g_hash_table_iter_next (&iter, NULL, &value))
- g_object_weak_unref (value, on_object_gone, self->handles);
- g_hash_table_destroy (self->handles);
-
- G_OBJECT_CLASS (seahorse_search_provider_parent_class)->finalize (object);
-}
-
-
-static void
-seahorse_search_provider_class_init (SeahorseSearchProviderClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- object_class->dispose = seahorse_search_provider_dispose;
- object_class->finalize = seahorse_search_provider_finalize;
-}
-
-SeahorseSearchProvider *
-seahorse_search_provider_new (void)
-{
- return g_object_new (SEAHORSE_TYPE_SEARCH_PROVIDER, NULL);
-}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]