]> Pileus Git - ~andy/gtk/blob - gtk/gtkappchooseronline.c
Fix abi check after recent merges
[~andy/gtk] / gtk / gtkappchooseronline.c
1 /*
2  * gtkappchooseronline.h: an extension point for online integration
3  *
4  * Copyright (C) 2010 Red Hat, Inc.
5  *
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.
10  *
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.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with the Gnome Library; see the file COPYING.LIB.  If not,
18  * write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  *
21  * Authors: Cosimo Cecchi <ccecchi@redhat.com>
22  */
23
24 #include "config.h"
25
26 #include "gtkappchooseronline.h"
27
28 #include "gtkappchoosermodule.h"
29 #include "gtkintl.h"
30
31 #include <gio/gio.h>
32
33 static void gtk_app_chooser_online_default_init (GtkAppChooserOnlineInterface *iface);
34 G_DEFINE_INTERFACE_WITH_CODE (GtkAppChooserOnline, _gtk_app_chooser_online, G_TYPE_OBJECT,
35                               g_type_interface_add_prerequisite (g_define_type_id, G_TYPE_ASYNC_INITABLE);)
36
37 static void
38 _gtk_app_chooser_online_default_init (GtkAppChooserOnlineInterface *iface)
39 {
40   /* do nothing */
41 }
42
43 GtkAppChooserOnline *
44 _gtk_app_chooser_online_get_default_finish (GObject      *source,
45                                             GAsyncResult *result)
46 {
47   GtkAppChooserOnline *retval;
48
49   retval = GTK_APP_CHOOSER_ONLINE (g_async_initable_new_finish (G_ASYNC_INITABLE (source),
50                                                                 result, NULL));
51
52   return retval;
53 }
54
55 void
56 _gtk_app_chooser_online_get_default_async (GAsyncReadyCallback callback,
57                                            gpointer            user_data)
58 {
59   GIOExtensionPoint *ep;
60   GIOExtension *extension;
61   GList *extensions;
62
63   _gtk_app_chooser_module_ensure ();
64
65   ep = g_io_extension_point_lookup ("gtkappchooser-online");
66   extensions = g_io_extension_point_get_extensions (ep);
67
68   if (extensions != NULL)
69     {
70       /* pick the first */
71       extension = extensions->data;
72       g_async_initable_new_async (g_io_extension_get_type (extension), G_PRIORITY_DEFAULT,
73                                   NULL, callback, user_data, NULL);
74     }
75 }
76
77 void
78 _gtk_app_chooser_online_search_for_mimetype_async (GtkAppChooserOnline *self,
79                                                    const gchar         *content_type,
80                                                    GtkWindow           *parent,
81                                                    GAsyncReadyCallback  callback,
82                                                    gpointer             user_data)
83 {
84   GtkAppChooserOnlineInterface *iface;
85
86   g_return_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self));
87
88   iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
89
90   (* iface->search_for_mimetype_async) (self, content_type, parent, callback, user_data);
91 }
92
93 gboolean
94 _gtk_app_chooser_online_search_for_mimetype_finish (GtkAppChooserOnline  *self,
95                                                     GAsyncResult         *res,
96                                                     GError              **error)
97 {
98   GtkAppChooserOnlineInterface *iface;
99
100   g_return_val_if_fail (GTK_IS_APP_CHOOSER_ONLINE (self), FALSE);
101
102   iface = GTK_APP_CHOOSER_ONLINE_GET_IFACE (self);
103
104   return ((* iface->search_for_mimetype_finish) (self, res, error));
105 }