1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.BookmarkList;
26 
27 private import gio.ListModelIF;
28 private import gio.ListModelT;
29 private import glib.ConstructionException;
30 private import glib.Str;
31 private import glib.c.functions;
32 private import gobject.ObjectG;
33 private import gtk.c.functions;
34 public  import gtk.c.types;
35 
36 
37 /**
38  * `GtkBookmarkList` is a list model that wraps `GBookmarkFile`.
39  * 
40  * It presents a `GListModel` and fills it asynchronously with the
41  * `GFileInfo`s returned from that function.
42  * 
43  * The `GFileInfo`s in the list have some attributes in the recent
44  * namespace added: `recent::private` (boolean) and `recent:applications`
45  * (stringv).
46  */
47 public class BookmarkList : ObjectG, ListModelIF
48 {
49 	/** the main Gtk struct */
50 	protected GtkBookmarkList* gtkBookmarkList;
51 
52 	/** Get the main Gtk struct */
53 	public GtkBookmarkList* getBookmarkListStruct(bool transferOwnership = false)
54 	{
55 		if (transferOwnership)
56 			ownedRef = false;
57 		return gtkBookmarkList;
58 	}
59 
60 	/** the main Gtk struct as a void* */
61 	protected override void* getStruct()
62 	{
63 		return cast(void*)gtkBookmarkList;
64 	}
65 
66 	/**
67 	 * Sets our main struct and passes it to the parent class.
68 	 */
69 	public this (GtkBookmarkList* gtkBookmarkList, bool ownedRef = false)
70 	{
71 		this.gtkBookmarkList = gtkBookmarkList;
72 		super(cast(GObject*)gtkBookmarkList, ownedRef);
73 	}
74 
75 	// add the ListModel capabilities
76 	mixin ListModelT!(GtkBookmarkList);
77 
78 
79 	/** */
80 	public static GType getType()
81 	{
82 		return gtk_bookmark_list_get_type();
83 	}
84 
85 	/**
86 	 * Creates a new `GtkBookmarkList` with the given @attributes.
87 	 *
88 	 * Params:
89 	 *     filename = The bookmark file to load
90 	 *     attributes = The attributes to query
91 	 *
92 	 * Returns: a new `GtkBookmarkList`
93 	 *
94 	 * Throws: ConstructionException GTK+ fails to create the object.
95 	 */
96 	public this(string filename, string attributes)
97 	{
98 		auto __p = gtk_bookmark_list_new(Str.toStringz(filename), Str.toStringz(attributes));
99 
100 		if(__p is null)
101 		{
102 			throw new ConstructionException("null returned by new");
103 		}
104 
105 		this(cast(GtkBookmarkList*) __p, true);
106 	}
107 
108 	/**
109 	 * Gets the attributes queried on the children.
110 	 *
111 	 * Returns: The queried attributes
112 	 */
113 	public string getAttributes()
114 	{
115 		return Str.toString(gtk_bookmark_list_get_attributes(gtkBookmarkList));
116 	}
117 
118 	/**
119 	 * Returns the filename of the bookmark file that
120 	 * this list is loading.
121 	 *
122 	 * Returns: the filename of the .xbel file
123 	 */
124 	public string getFilename()
125 	{
126 		return Str.toString(gtk_bookmark_list_get_filename(gtkBookmarkList));
127 	}
128 
129 	/**
130 	 * Gets the IO priority to use while loading file.
131 	 *
132 	 * Returns: The IO priority.
133 	 */
134 	public int getIoPriority()
135 	{
136 		return gtk_bookmark_list_get_io_priority(gtkBookmarkList);
137 	}
138 
139 	/**
140 	 * Returns %TRUE if the files are currently being loaded.
141 	 *
142 	 * Files will be added to @self from time to time while loading is
143 	 * going on. The order in which are added is undefined and may change
144 	 * in between runs.
145 	 *
146 	 * Returns: %TRUE if @self is loading
147 	 */
148 	public bool isLoading()
149 	{
150 		return gtk_bookmark_list_is_loading(gtkBookmarkList) != 0;
151 	}
152 
153 	/**
154 	 * Sets the @attributes to be enumerated and starts the enumeration.
155 	 *
156 	 * If @attributes is %NULL, no attributes will be queried, but a list
157 	 * of #GFileInfos will still be created.
158 	 *
159 	 * Params:
160 	 *     attributes = the attributes to enumerate
161 	 */
162 	public void setAttributes(string attributes)
163 	{
164 		gtk_bookmark_list_set_attributes(gtkBookmarkList, Str.toStringz(attributes));
165 	}
166 
167 	/**
168 	 * Sets the IO priority to use while loading files.
169 	 *
170 	 * The default IO priority is %G_PRIORITY_DEFAULT.
171 	 *
172 	 * Params:
173 	 *     ioPriority = IO priority to use
174 	 */
175 	public void setIoPriority(int ioPriority)
176 	{
177 		gtk_bookmark_list_set_io_priority(gtkBookmarkList, ioPriority);
178 	}
179 }