source: appstream-generator/build/girepo/gio/LoadableIconT.d @ 4841

Last change on this file since 4841 was 4841, checked in by Juanma, 2 years ago

Initial release

File size: 3.7 KB
Line 
1/*
2 * Licensed under the GNU Lesser General Public License Version 3
3 *
4 * This library is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation, either version 3 of the license, or
7 * (at your option) any later version.
8 *
9 * This software is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 * GNU Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library.  If not, see <http://www.gnu.org/licenses/>.
16 */
17
18// generated automatically - do not change
19
20
21module gio.LoadableIconT;
22
23public  import gi.gio;
24public  import gi.giotypes;
25public  import gio.AsyncResultIF;
26public  import gio.Cancellable;
27public  import gio.InputStream;
28public  import glib.ErrorG;
29public  import glib.GException;
30public  import glib.Str;
31public  import gobject.ObjectG;
32
33
34/**
35 * Extends the #GIcon interface and adds the ability to
36 * load icons from streams.
37 */
38public template LoadableIconT(TStruct)
39{
40        /** Get the main Gtk struct */
41        public GLoadableIcon* getLoadableIconStruct()
42        {
43                return cast(GLoadableIcon*)getStruct();
44        }
45
46
47        /**
48         * Loads a loadable icon. For the asynchronous version of this function,
49         * see g_loadable_icon_load_async().
50         *
51         * Params:
52         *     size = an integer.
53         *     type = a location to store the type of the loaded
54         *         icon, %NULL to ignore.
55         *     cancellable = optional #GCancellable object, %NULL to
56         *         ignore.
57         *
58         * Returns: a #GInputStream to read the icon from.
59         *
60         * Throws: GException on failure.
61         */
62        public InputStream load(int size, out string type, Cancellable cancellable)
63        {
64                char* outtype = null;
65                GError* err = null;
66               
67                auto p = g_loadable_icon_load(getLoadableIconStruct(), size, &outtype, (cancellable is null) ? null : cancellable.getCancellableStruct(), &err);
68               
69                if (err !is null)
70                {
71                        throw new GException( new ErrorG(err) );
72                }
73               
74                type = Str.toString(outtype);
75               
76                if(p is null)
77                {
78                        return null;
79                }
80               
81                return ObjectG.getDObject!(InputStream)(cast(GInputStream*) p, true);
82        }
83
84        /**
85         * Loads an icon asynchronously. To finish this function, see
86         * g_loadable_icon_load_finish(). For the synchronous, blocking
87         * version of this function, see g_loadable_icon_load().
88         *
89         * Params:
90         *     size = an integer.
91         *     cancellable = optional #GCancellable object, %NULL to ignore.
92         *     callback = a #GAsyncReadyCallback to call when the
93         *         request is satisfied
94         *     userData = the data to pass to callback function
95         */
96        public void loadAsync(int size, Cancellable cancellable, GAsyncReadyCallback callback, void* userData)
97        {
98                g_loadable_icon_load_async(getLoadableIconStruct(), size, (cancellable is null) ? null : cancellable.getCancellableStruct(), callback, userData);
99        }
100
101        /**
102         * Finishes an asynchronous icon load started in g_loadable_icon_load_async().
103         *
104         * Params:
105         *     res = a #GAsyncResult.
106         *     type = a location to store the type of the loaded
107         *         icon, %NULL to ignore.
108         *
109         * Returns: a #GInputStream to read the icon from.
110         *
111         * Throws: GException on failure.
112         */
113        public InputStream loadFinish(AsyncResultIF res, out string type)
114        {
115                char* outtype = null;
116                GError* err = null;
117               
118                auto p = g_loadable_icon_load_finish(getLoadableIconStruct(), (res is null) ? null : res.getAsyncResultStruct(), &outtype, &err);
119               
120                if (err !is null)
121                {
122                        throw new GException( new ErrorG(err) );
123                }
124               
125                type = Str.toString(outtype);
126               
127                if(p is null)
128                {
129                        return null;
130                }
131               
132                return ObjectG.getDObject!(InputStream)(cast(GInputStream*) p, true);
133        }
134}
Note: See TracBrowser for help on using the repository browser.