2 * gtkappchooseronline.h: an extension point for online integration
4 * Copyright (C) 2010 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public License as
8 * published by the Free Software Foundation; either version 2 of the
9 * License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 * Authors: Cosimo Cecchi <ccecchi@redhat.com>
24 #include "gtkappchooseronline.h"
26 #include "gtkappchoosermodule.h"
31 G_DEFINE_INTERFACE_WITH_CODE (GtkAppChooserOnline, _gtk_app_chooser_online, G_TYPE_OBJECT,
32 g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_ASYNC_INITABLE);)
35 _gtk_app_chooser_online_default_init (GtkAppChooserOnlineInterface *iface)
41 _gtk_app_chooser_online_get_default_finish (GObject *source,
44 GtkAppChooserOnline *retval;
46 retval = GTK_APP_CHOOSER_ONLINE (g_async_initable_new_finish (G_ASYNC_INITABLE (source),
53 _gtk_app_chooser_online_get_default_async (GAsyncReadyCallback callback,
56 GIOExtensionPoint *ep;
57 GIOExtension *extension;
60 _gtk_app_chooser_module_ensure ();
62 ep = g_io_extension_point_lookup ("gtkappchooser-online");
63 extensions = g_io_extension_point_get_extensions (ep);
65 if (extensions != NULL)
68 extension = extensions->data;
69 g_async_initable_new_async (g_io_extension_get_type (extension), G_PRIORITY_DEFAULT,
70 NULL, callback, user_data, NULL);
75 _gtk_app_chooser_online_search_for_mimetype_async (GtkAppChooserOnline *self,
76 const gchar *content_type,
78 GCancellable *cancellable,
79 GAsyncReadyCallback callback,
82 GtkAppChooserOnlineInterface *iface;
84 g_return_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self));
86 iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
88 (* iface->search_for_mimetype_async) (self, content_type, parent, cancellable, callback, user_data);
92 _gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline *self,
96 GtkAppChooserOnlineInterface *iface;
98 g_return_val_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self), FALSE);
100 iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
102 return ((* iface->search_for_mimetype_finish) (self, res, error));