Debian Codegraph @

gtk/gtkbookmarklist.c

raw symbols SCIP
1 /*
2 * Copyright © 2020 Red Hat, Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library 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 GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Authors: Matthias Clasen <[email protected]>
18 */
19
20 #include "config.h"cxx . . $ `<file>/build/config.h`/
21
22 #include "gtkbookmarklist.h"cxx . . $ `<file>/gtk/gtkbookmarklist.h`/
23
24 #include "gtksettings.h"cxx . . $ `<file>/gtk/gtksettings.h`/
25 #include "gtkprivate.h"cxx . . $ `<file>/gtk/gtkprivate.h`/
26
27 /**
28 * GtkBookmarkList:
29 *
30 * A list model that wraps `GBookmarkFile`.
31 *
32 * It presents a `GListModel` and fills it asynchronously with the
33 * `GFileInfo`s returned from that function.
34 *
35 * The `GFileInfo`s in the list have some attributes in the recent
36 * namespace added: `recent::private` (boolean) and `recent:applications`
37 * (stringv).
38 */
39
40 enumcxx . . $ $anonymous_type_41bbdb536ec7e433_0# {
41 PROP_0cxx . . $ PROP_0.,
42 PROP_FILENAMEcxx . . $ PROP_FILENAME.,
43 PROP_ATTRIBUTEScxx . . $ PROP_ATTRIBUTES.,
44 PROP_IO_PRIORITYcxx . . $ PROP_IO_PRIORITY.,
45 PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE.,
46 PROP_LOADINGcxx . . $ PROP_LOADING.,
47 PROP_N_ITEMScxx . . $ PROP_N_ITEMS.,
48
49 NUM_PROPERTIEScxx . . $ NUM_PROPERTIES.
50 };
51
52 struct _GtkBookmarkListcxx . . $ _GtkBookmarkList#
53 {
54 GObjectcxx . . $ GObject# parent_instancecxx . . $ _GtkBookmarkList#parent_instance.;
55
56 char *attributescxx . . $ _GtkBookmarkList#attributes.;
57 char *filenamecxx . . $ _GtkBookmarkList#filename.;
58 int io_prioritycxx . . $ _GtkBookmarkList#io_priority.;
59 int loadingcxx . . $ _GtkBookmarkList#loading.;
60
61 GCancellablecxx . . $ GCancellable# *cancellablecxx . . $ _GtkBookmarkList#cancellable.;
62 GFileMonitorcxx . . $ GFileMonitor# *monitorcxx . . $ _GtkBookmarkList#monitor.;
63 GBookmarkFilecxx . . $ GBookmarkFile# *filecxx . . $ _GtkBookmarkList#file.;
64
65 GSequencecxx . . $ GSequence# *itemscxx . . $ _GtkBookmarkList#items.;
66 };
67
68 struct _GtkBookmarkListClasscxx . . $ _GtkBookmarkListClass#
69 {
70 GObjectClasscxx . . $ GObjectClass# parent_classcxx . . $ _GtkBookmarkListClass#parent_class.;
71 };
72
73 static GParamSpeccxx . . $ GParamSpec# *propertiescxx . . $ properties.[NUM_PROPERTIEScxx . . $ NUM_PROPERTIES.] = { NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, };
74
75 static GTypecxx . . $ GType#
76 gtk_bookmark_list_get_item_typecxx . . $ gtk_bookmark_list_get_item_type(94bfa31565da8ed5). (GListModelcxx . . $ GListModel# *list)
77 {
78 return G_TYPE_FILE_INFOcxx . . $ `<external>/10155032491143044340/gfileinfo.h:34:9`!;
79 }
80
81 static guintcxx . . $ guint#
82 gtk_bookmark_list_get_n_itemscxx . . $ gtk_bookmark_list_get_n_items(43b97f6a983b4be8). (GListModelcxx . . $ GListModel# *list)
83 {
84 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = GTK_BOOKMARK_LISTcxx . . $ GTK_BOOKMARK_LIST(59c51a4bfbe9b9a2). (list);
85
86 return g_sequence_get_lengthcxx . . $ g_sequence_get_length(1b238430be024b3e). (self->itemscxx . . $ _GtkBookmarkList#items.);
87 }
88
89 static gpointercxx . . $ gpointer#
90 gtk_bookmark_list_get_itemcxx . . $ gtk_bookmark_list_get_item(9715a6516b430a30). (GListModelcxx . . $ GListModel# *list,
91 guintcxx . . $ guint# position)
92 {
93 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = GTK_BOOKMARK_LISTcxx . . $ GTK_BOOKMARK_LIST(59c51a4bfbe9b9a2). (list);
94 GSequenceItercxx . . $ GSequenceIter# *iter;
95
96 iter = g_sequence_get_iter_at_poscxx . . $ g_sequence_get_iter_at_pos(d574b5fce5b65bd). (self->itemscxx . . $ _GtkBookmarkList#items., position);
97
98 if (g_sequence_iter_is_endcxx . . $ g_sequence_iter_is_end(5b8ca6ef87da3483). (iter))
99 return NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
100 else
101 return g_object_refcxx . . $ `<external>/1341695927569185362/gobject.h:533:9`! (g_sequence_get (iter));
102 }
103
104 static void
105 gtk_bookmark_list_model_initcxx . . $ gtk_bookmark_list_model_init(41b235b28ecdc2f9). (GListModelInterfacecxx . . $ GListModelInterface# *iface)
106 {
107 iface->get_item_typecxx . . $ _GListModelInterface#get_item_type. = gtk_bookmark_list_get_item_typecxx . . $ gtk_bookmark_list_get_item_type(94bfa31565da8ed5).;
108 iface->get_n_itemscxx . . $ _GListModelInterface#get_n_items. = gtk_bookmark_list_get_n_itemscxx . . $ gtk_bookmark_list_get_n_items(43b97f6a983b4be8).;
109 iface->get_itemcxx . . $ _GListModelInterface#get_item. = gtk_bookmark_list_get_itemcxx . . $ gtk_bookmark_list_get_item(9715a6516b430a30).;
110 }
111
112 static void gtk_bookmark_list_start_loadingcxx . . $ gtk_bookmark_list_start_loading(2dd34c12bd428e88). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self);
113 static gbooleancxx . . $ gboolean# gtk_bookmark_list_stop_loadingcxx . . $ gtk_bookmark_list_stop_loading(2a5b89c73981d172). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self);
114 static void bookmark_file_changedcxx . . $ bookmark_file_changed(ddc4a7f2b85a4aef). (GFileMonitorcxx . . $ GFileMonitor# *monitor,
115 GFilecxx . . $ GFile# *file,
116 GFilecxx . . $ GFile# *other_file,
117 GFileMonitorEventcxx . . $ GFileMonitorEvent# event,
118 gpointercxx . . $ gpointer# data);
119 static void gtk_bookmark_list_set_filenamecxx . . $ gtk_bookmark_list_set_filename(24bed2c383dfa43a). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self,
120 const char *filename);
121
122 G_DEFINE_TYPE_WITH_CODEcxx . . $ `<external>/9567554376676449156/gtype.h:1850:9`! (GtkBookmarkList, gtk_bookmark_list, G_TYPE_OBJECTcxx . . $ `<external>/9567554376676449156/gtype.h:189:9`!,
123 G_IMPLEMENT_INTERFACEcxx . . $ `<external>/9567554376676449156/gtype.h:2115:9`! (G_TYPE_LIST_MODELcxx . . $ `<external>/10117917155607792737/glistmodel.h:36:9`!, gtk_bookmark_list_model_init))
124
125 static void
126 gtk_bookmark_list_set_propertycxx . . $ gtk_bookmark_list_set_property(d7c4bb29f36c0dc4). (GObjectcxx . . $ GObject# *object,
127 guintcxx . . $ guint# prop_id,
128 const GValuecxx . . $ GValue# *value,
129 GParamSpeccxx . . $ GParamSpec# *pspec)
130 {
131 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = GTK_BOOKMARK_LISTcxx . . $ GTK_BOOKMARK_LIST(59c51a4bfbe9b9a2). (object);
132
133 switch (prop_id)
134 {
135 case PROP_ATTRIBUTEScxx . . $ PROP_ATTRIBUTES.:
136 gtk_bookmark_list_set_attributescxx . . $ gtk_bookmark_list_set_attributes(24bed2c383dfa43a). (self, g_value_get_stringcxx . . $ g_value_get_string(cc0a2be2b8f7bdc8). (value));
137 break;
138
139 case PROP_IO_PRIORITYcxx . . $ PROP_IO_PRIORITY.:
140 gtk_bookmark_list_set_io_prioritycxx . . $ gtk_bookmark_list_set_io_priority(4a006ddd31e7727c). (self, g_value_get_intcxx . . $ g_value_get_int(f890c5c75ead5b21). (value));
141 break;
142
143 case PROP_FILENAMEcxx . . $ PROP_FILENAME.:
144 gtk_bookmark_list_set_filenamecxx . . $ gtk_bookmark_list_set_filename(24bed2c383dfa43a). (self, g_value_get_stringcxx . . $ g_value_get_string(cc0a2be2b8f7bdc8). (value));
145 break;
146
147 default:
148 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec);
149 break;
150 }
151 }
152
153 static void
154 gtk_bookmark_list_get_propertycxx . . $ gtk_bookmark_list_get_property(cee2c52f22407c66). (GObjectcxx . . $ GObject# *object,
155 guintcxx . . $ guint# prop_id,
156 GValuecxx . . $ GValue# *value,
157 GParamSpeccxx . . $ GParamSpec# *pspec)
158 {
159 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = GTK_BOOKMARK_LISTcxx . . $ GTK_BOOKMARK_LIST(59c51a4bfbe9b9a2). (object);
160
161 switch (prop_id)
162 {
163 case PROP_ATTRIBUTEScxx . . $ PROP_ATTRIBUTES.:
164 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, self->attributescxx . . $ _GtkBookmarkList#attributes.);
165 break;
166
167 case PROP_FILENAMEcxx . . $ PROP_FILENAME.:
168 g_value_set_stringcxx . . $ g_value_set_string(65b9ea7708b82b9b). (value, self->filenamecxx . . $ _GtkBookmarkList#filename.);
169 break;
170
171 case PROP_IO_PRIORITYcxx . . $ PROP_IO_PRIORITY.:
172 g_value_set_intcxx . . $ g_value_set_int(b698c61e8e30c4ea). (value, self->io_prioritycxx . . $ _GtkBookmarkList#io_priority.);
173 break;
174
175 case PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE.:
176 g_value_set_gtypecxx . . $ g_value_set_gtype(235192cae6c1f0e4). (value, G_TYPE_FILE_INFOcxx . . $ `<external>/10155032491143044340/gfileinfo.h:34:9`!);
177 break;
178
179 case PROP_LOADINGcxx . . $ PROP_LOADING.:
180 g_value_set_booleancxx . . $ g_value_set_boolean(b698c61e8e30c4ea). (value, gtk_bookmark_list_is_loadingcxx . . $ gtk_bookmark_list_is_loading(2a5b89c73981d172). (self));
181 break;
182
183 case PROP_N_ITEMScxx . . $ PROP_N_ITEMS.:
184 g_value_set_uintcxx . . $ g_value_set_uint(f81c5c84daf56975). (value, g_sequence_get_lengthcxx . . $ g_sequence_get_length(1b238430be024b3e). (self->itemscxx . . $ _GtkBookmarkList#items.));
185 break;
186
187 default:
188 G_OBJECT_WARN_INVALID_PROPERTY_IDcxx . . $ `<external>/1341695927569185362/gobject.h:690:9`! (object, prop_id, pspec);
189 break;
190 }
191 }
192
193 static void
194 gtk_bookmark_list_disposecxx . . $ gtk_bookmark_list_dispose(6087475fa43034d3). (GObjectcxx . . $ GObject# *object)
195 {
196 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = GTK_BOOKMARK_LISTcxx . . $ GTK_BOOKMARK_LIST(59c51a4bfbe9b9a2). (object);
197
198 gtk_bookmark_list_stop_loadingcxx . . $ gtk_bookmark_list_stop_loading(2a5b89c73981d172). (self);
199
200 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->attributes, g_free);
201 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->filename, g_free);
202 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->items, g_sequence_free);
203 g_clear_pointercxx . . $ `<external>/1123956534522462559/gmem.h:135:9`! (&self->file, g_bookmark_file_free);
204
205 g_signal_handlers_disconnect_by_funccxx . . $ `<external>/15952772511652638895/gsignal.h:629:9`! (self->monitor, G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (bookmark_file_changed), self);
206 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->monitor);
207
208 G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (gtk_bookmark_list_parent_class)->disposecxx . . $ _GObjectClass#dispose. (object);
209 }
210
211 static void
212 gtk_bookmark_list_class_initcxx . . $ gtk_bookmark_list_class_init(6f1ac6fa9e674e). (GtkBookmarkListClasscxx . . $ GtkBookmarkListClass# *class)
213 {
214 GObjectClasscxx . . $ GObjectClass# *gobject_class = G_OBJECT_CLASScxx . . $ `<external>/1341695927569185362/gobject.h:61:9`! (class);
215
216 gobject_class->set_propertycxx . . $ _GObjectClass#set_property. = gtk_bookmark_list_set_propertycxx . . $ gtk_bookmark_list_set_property(d7c4bb29f36c0dc4).;
217 gobject_class->get_propertycxx . . $ _GObjectClass#get_property. = gtk_bookmark_list_get_propertycxx . . $ gtk_bookmark_list_get_property(cee2c52f22407c66).;
218 gobject_class->disposecxx . . $ _GObjectClass#dispose. = gtk_bookmark_list_disposecxx . . $ gtk_bookmark_list_dispose(6087475fa43034d3).;
219
220 /**
221 * GtkBookmarkList:filename:
222 *
223 * The bookmark file to load.
224 */
225 propertiescxx . . $ properties.[PROP_FILENAMEcxx . . $ PROP_FILENAME.] =
226 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("filename", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
227 NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
228 GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`! | G_PARAM_CONSTRUCT_ONLYcxx . . $ G_PARAM_CONSTRUCT_ONLY. | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.);
229 /**
230 * GtkBookmarkList:attributes:
231 *
232 * The attributes to query.
233 */
234 propertiescxx . . $ properties.[PROP_ATTRIBUTEScxx . . $ PROP_ATTRIBUTES.] =
235 g_param_spec_stringcxx . . $ g_param_spec_string(378e8746be5cd899). ("attributes", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
236 NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
237 GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.);
238
239 /**
240 * GtkBookmarkList:io-priority:
241 *
242 * Priority used when loading.
243 */
244 propertiescxx . . $ properties.[PROP_IO_PRIORITYcxx . . $ PROP_IO_PRIORITY.] =
245 g_param_spec_intcxx . . $ g_param_spec_int(eedf0a930522f60e). ("io-priority", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
246 -G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!, G_MAXINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:39:9`!, G_PRIORITY_DEFAULTcxx . . $ `<external>/1856471541377536744/gmain.h:434:9`!,
247 GTK_PARAM_READWRITEcxx . . $ `gtk/gtkprivate.h:44:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.);
248
249 /**
250 * GtkBookmarkList:item-type:
251 *
252 * The type of items. See [[email protected]_item_type].
253 *
254 * Since: 4.8
255 **/
256 propertiescxx . . $ properties.[PROP_ITEM_TYPEcxx . . $ PROP_ITEM_TYPE.] =
257 g_param_spec_gtypecxx . . $ g_param_spec_gtype(faf99966f027a127). ("item-type", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
258 G_TYPE_FILE_INFOcxx . . $ `<external>/10155032491143044340/gfileinfo.h:34:9`!,
259 G_PARAM_READABLEcxx . . $ G_PARAM_READABLE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
260
261 /**
262 * GtkBookmarkList:loading: (getter is_loading)
263 *
264 * %TRUE if files are being loaded.
265 */
266 propertiescxx . . $ properties.[PROP_LOADINGcxx . . $ PROP_LOADING.] =
267 g_param_spec_booleancxx . . $ g_param_spec_boolean(315d86b79c0116e0). ("loading", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
268 FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!,
269 GTK_PARAM_READABLEcxx . . $ `gtk/gtkprivate.h:42:9`! | G_PARAM_EXPLICIT_NOTIFYcxx . . $ G_PARAM_EXPLICIT_NOTIFY.);
270
271 /**
272 * GtkBookmarkList:n-items:
273 *
274 * The number of items. See [[email protected]_n_items].
275 *
276 * Since: 4.8
277 **/
278 propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.] =
279 g_param_spec_uintcxx . . $ g_param_spec_uint(503a1013c8de17d5). ("n-items", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!,
280 0, G_MAXUINTcxx . . $ `<external>/10505296616216143549/glibconfig.h:40:9`!, 0,
281 G_PARAM_READABLEcxx . . $ G_PARAM_READABLE. | G_PARAM_STATIC_STRINGScxx . . $ `<external>/7453068347527694854/gparam.h:187:9`!);
282
283 g_object_class_install_propertiescxx . . $ g_object_class_install_properties(569d03e6a4088541). (gobject_class, NUM_PROPERTIEScxx . . $ NUM_PROPERTIES., propertiescxx . . $ properties.);
284 }
285
286 static void
287 gtk_bookmark_list_initcxx . . $ gtk_bookmark_list_init(2dd34c12bd428e88). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
288 {
289 self->itemscxx . . $ _GtkBookmarkList#items. = g_sequence_newcxx . . $ g_sequence_new(10e7cce8a0a0b6c3). (g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8).);
290 self->io_prioritycxx . . $ _GtkBookmarkList#io_priority. = G_PRIORITY_DEFAULTcxx . . $ `<external>/1856471541377536744/gmain.h:434:9`!;
291 self->filecxx . . $ _GtkBookmarkList#file. = g_bookmark_file_newcxx . . $ g_bookmark_file_new(48addc0fbbb1c274). ();
292 }
293
294 static gbooleancxx . . $ gboolean#
295 gtk_bookmark_list_stop_loadingcxx . . $ gtk_bookmark_list_stop_loading(2a5b89c73981d172). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
296 {
297 if (self->cancellablecxx . . $ _GtkBookmarkList#cancellable. == NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!)
298 return FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!;
299
300 g_cancellable_cancelcxx . . $ g_cancellable_cancel(ff72ec99b913803a). (self->cancellablecxx . . $ _GtkBookmarkList#cancellable.);
301 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->cancellable);
302
303 self->loadingcxx . . $ _GtkBookmarkList#loading. = 0;
304
305 return TRUEcxx . . $ `<external>/12741050725406041920/gmacros.h:971:9`!;
306 }
307
308 static void
309 got_file_infocxx . . $ got_file_info(aa1d200d824d915d). (GObjectcxx . . $ GObject# *source,
310 GAsyncResultcxx . . $ GAsyncResult# *res,
311 gpointercxx . . $ gpointer# user_data)
312 {
313 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = user_data;
314 GFilecxx . . $ GFile# *file = G_FILEcxx . . $ `<external>/13962853800498659056/gfile.h:35:9`! (source);
315 GFileInfocxx . . $ GFileInfo# *info;
316 GErrorcxx . . $ GError# *error = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
317
318 info = g_file_query_info_finishcxx . . $ g_file_query_info_finish(283254bc22830d4b). (file, res, &error);
319 if (g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (error, G_IO_ERRORcxx . . $ `<external>/13894955190784973534/gioerror.h:42:9`!, G_IO_ERROR_CANCELLEDcxx . . $ G_IO_ERROR_CANCELLED.))
320 {
321 g_error_freecxx . . $ g_error_free(2ff7d11a2ecc01bd). (error);
322 return;
323 }
324
325 if (info)
326 {
327 char *uri;
328 gbooleancxx . . $ gboolean# is_private;
329 char **apps;
330
331 uri = g_file_get_uricxx . . $ g_file_get_uri(bd69fa69840f32a9). (file);
332 is_private = g_bookmark_file_get_is_privatecxx . . $ g_bookmark_file_get_is_private(df2cf11d2f75cb41). (self->filecxx . . $ _GtkBookmarkList#file., uri, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
333 apps = g_bookmark_file_get_applicationscxx . . $ g_bookmark_file_get_applications(e618ee60d42cbadc). (self->filecxx . . $ _GtkBookmarkList#file., uri, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
334
335 g_file_info_set_attribute_objectcxx . . $ g_file_info_set_attribute_object(894c8d0b59322c35). (info, "standard::file", G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (file));
336 g_file_info_set_attribute_booleancxx . . $ g_file_info_set_attribute_boolean(8cc4c58ed3b906bf). (info, "recent::private", is_private);
337 g_file_info_set_attribute_stringvcxx . . $ g_file_info_set_attribute_stringv(a8d2d89d09cefde2). (info, "recent::applications", apps);
338
339 g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (apps);
340
341 g_sequence_appendcxx . . $ g_sequence_append(a2ec852d5817d205). (self->itemscxx . . $ _GtkBookmarkList#items., info);
342 g_list_model_items_changedcxx . . $ g_list_model_items_changed(2896dae0034144d8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self), g_sequence_get_lengthcxx . . $ g_sequence_get_length(1b238430be024b3e). (self->itemscxx . . $ _GtkBookmarkList#items.) - 1, 0, 1);
343 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.]);
344
345 g_freecxx . . $ g_free(5d22bdacc48458e8). (uri);
346 }
347
348 self->loadingcxx . . $ _GtkBookmarkList#loading.--;
349
350 if (self->loadingcxx . . $ _GtkBookmarkList#loading. == 0)
351 {
352 g_clear_objectcxx . . $ `<external>/1341695927569185362/gobject.h:695:9`! (&self->cancellable);
353 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_LOADINGcxx . . $ PROP_LOADING.]);
354 }
355 }
356
357 static void
358 gtk_bookmark_list_clear_itemscxx . . $ gtk_bookmark_list_clear_items(2dd34c12bd428e88). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
359 {
360 guintcxx . . $ guint# n_items;
361
362 n_items = g_sequence_get_lengthcxx . . $ g_sequence_get_length(1b238430be024b3e). (self->itemscxx . . $ _GtkBookmarkList#items.);
363 if (n_items > 0)
364 {
365 g_sequence_remove_rangecxx . . $ g_sequence_remove_range(d20620c625baf280). (g_sequence_get_begin_itercxx . . $ g_sequence_get_begin_iter(c65380f4a12a3407). (self->itemscxx . . $ _GtkBookmarkList#items.),
366 g_sequence_get_end_itercxx . . $ g_sequence_get_end_iter(c65380f4a12a3407). (self->itemscxx . . $ _GtkBookmarkList#items.));
367
368 g_list_model_items_changedcxx . . $ g_list_model_items_changed(2896dae0034144d8). (G_LIST_MODELcxx . . $ G_LIST_MODEL(26f73d2a39e7201f). (self), 0, n_items, 0);
369 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_N_ITEMScxx . . $ PROP_N_ITEMS.]);
370 }
371 }
372
373 static void
374 gtk_bookmark_list_start_loadingcxx . . $ gtk_bookmark_list_start_loading(2dd34c12bd428e88). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
375 {
376 gbooleancxx . . $ gboolean# was_loading;
377 GErrorcxx . . $ GError# *error = NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
378
379 was_loading = gtk_bookmark_list_stop_loadingcxx . . $ gtk_bookmark_list_stop_loading(2a5b89c73981d172). (self);
380 gtk_bookmark_list_clear_itemscxx . . $ gtk_bookmark_list_clear_items(2dd34c12bd428e88). (self);
381
382 if (g_bookmark_file_load_from_filecxx . . $ g_bookmark_file_load_from_file(df2cf11d2f75cb41). (self->filecxx . . $ _GtkBookmarkList#file., self->filenamecxx . . $ _GtkBookmarkList#filename., &error))
383 {
384 char **uris;
385 gsizecxx . . $ gsize# len;
386 int i;
387
388 uris = g_bookmark_file_get_uriscxx . . $ g_bookmark_file_get_uris(60ecdfcadc04a579). (self->filecxx . . $ _GtkBookmarkList#file., &len);
389 if (len > 0)
390 {
391 self->cancellablecxx . . $ _GtkBookmarkList#cancellable. = g_cancellable_newcxx . . $ g_cancellable_new(decaddcb7afe0309). ();
392 self->loadingcxx . . $ _GtkBookmarkList#loading. = len;
393 }
394
395 for (i = 0; i < len; i++)
396 {
397 const char *uri = uris[i];
398 GFilecxx . . $ GFile# *file;
399
400 /* add this item */
401 file = g_file_new_for_uricxx . . $ g_file_new_for_uri(ba1fd5950b7d7bd5). (uri);
402 g_file_query_info_asynccxx . . $ g_file_query_info_async(af983d0ac17f9c97). (file,
403 self->attributescxx . . $ _GtkBookmarkList#attributes.,
404 0,
405 self->io_prioritycxx . . $ _GtkBookmarkList#io_priority.,
406 self->cancellablecxx . . $ _GtkBookmarkList#cancellable.,
407 got_file_infocxx . . $ got_file_info(aa1d200d824d915d).,
408 self);
409 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (file);
410 }
411
412 g_strfreevcxx . . $ g_strfreev(3ed91490e421178f). (uris);
413 }
414 else
415 {
416 if (!g_error_matchescxx . . $ g_error_matches(604444fafc3e7b63). (error, G_FILE_ERRORcxx . . $ `<external>/11396166785534468775/gfileutils.h:33:9`!, G_FILE_ERROR_NOENTcxx . . $ G_FILE_ERROR_NOENT.))
417 g_warningcxx . . $ `<external>/5169755362661750954/gmessages.h:340:9`! ("Failed to load %s: %s", self->filename, error->message);
418 g_clear_errorcxx . . $ g_clear_error(19f343512d040fc2). (&error);
419 }
420
421 if (was_loading != (self->cancellablecxx . . $ _GtkBookmarkList#cancellable. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!))
422 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_LOADINGcxx . . $ PROP_LOADING.]);
423 }
424
425 static void
426 bookmark_file_changedcxx . . $ bookmark_file_changed(ddc4a7f2b85a4aef). (GFileMonitorcxx . . $ GFileMonitor# *monitor,
427 GFilecxx . . $ GFile# *file,
428 GFilecxx . . $ GFile# *other_file,
429 GFileMonitorEventcxx . . $ GFileMonitorEvent# event_type,
430 gpointercxx . . $ gpointer# data)
431 {
432 GtkBookmarkListcxx . . $ GtkBookmarkList# *self = data;
433
434 switch (event_type)
435 {
436 case G_FILE_MONITOR_EVENT_CHANGEDcxx . . $ G_FILE_MONITOR_EVENT_CHANGED.:
437 case G_FILE_MONITOR_EVENT_CREATEDcxx . . $ G_FILE_MONITOR_EVENT_CREATED.:
438 case G_FILE_MONITOR_EVENT_DELETEDcxx . . $ G_FILE_MONITOR_EVENT_DELETED.:
439 gtk_bookmark_list_start_loadingcxx . . $ gtk_bookmark_list_start_loading(2dd34c12bd428e88). (self);
440 break;
441
442 case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINTcxx . . $ G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT.:
443 case G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGEDcxx . . $ G_FILE_MONITOR_EVENT_ATTRIBUTE_CHANGED.:
444 case G_FILE_MONITOR_EVENT_PRE_UNMOUNTcxx . . $ G_FILE_MONITOR_EVENT_PRE_UNMOUNT.:
445 case G_FILE_MONITOR_EVENT_UNMOUNTEDcxx . . $ G_FILE_MONITOR_EVENT_UNMOUNTED.:
446 case G_FILE_MONITOR_EVENT_MOVEDcxx . . $ G_FILE_MONITOR_EVENT_MOVED.:
447 case G_FILE_MONITOR_EVENT_RENAMEDcxx . . $ G_FILE_MONITOR_EVENT_RENAMED.:
448 case G_FILE_MONITOR_EVENT_MOVED_INcxx . . $ G_FILE_MONITOR_EVENT_MOVED_IN.:
449 case G_FILE_MONITOR_EVENT_MOVED_OUTcxx . . $ G_FILE_MONITOR_EVENT_MOVED_OUT.:
450
451 default:
452 break;
453 }
454 }
455
456 static void
457 gtk_bookmark_list_set_filenamecxx . . $ gtk_bookmark_list_set_filename(24bed2c383dfa43a). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self,
458 const char *filename)
459 {
460 GFilecxx . . $ GFile# *file;
461
462 if (filename)
463 self->filenamecxx . . $ _GtkBookmarkList#filename. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (filename);
464 else
465 self->filenamecxx . . $ _GtkBookmarkList#filename. = g_build_filenamecxx . . $ g_build_filename(a849077ff1b8d812). (g_get_user_data_dircxx . . $ g_get_user_data_dir(33a1f659e94feb42). (), "recently-used.xbel", NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
466
467 file = g_file_new_for_pathcxx . . $ g_file_new_for_path(ba1fd5950b7d7bd5). (self->filenamecxx . . $ _GtkBookmarkList#filename.);
468 self->monitorcxx . . $ _GtkBookmarkList#monitor. = g_file_monitor_filecxx . . $ g_file_monitor_file(8c82d0cc758993c8). (file, G_FILE_MONITOR_NONEcxx . . $ G_FILE_MONITOR_NONE., NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!, NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
469 g_signal_connectcxx . . $ `<external>/15952772511652638895/gsignal.h:548:9`! (self->monitor, "changed",
470 G_CALLBACKcxx . . $ `<external>/16473872192229286895/gclosure.h:73:9`! (bookmark_file_changed), self);
471 g_object_unrefcxx . . $ g_object_unref(5d22bdacc48458e8). (file);
472
473 gtk_bookmark_list_start_loadingcxx . . $ gtk_bookmark_list_start_loading(2dd34c12bd428e88). (self);
474 }
475
476 /**
477 * gtk_bookmark_list_get_filename:
478 * @self: a `GtkBookmarkList`
479 *
480 * Returns the filename of the bookmark file that
481 * this list is loading.
482 *
483 * Returns: (type filename): the filename of the .xbel file
484 */
485 const char *
486 gtk_bookmark_list_get_filenamecxx . . $ gtk_bookmark_list_get_filename(e226dc12adad3f1b). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
487 {
488 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_BOOKMARK_LIST (self), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
489
490 return self->filenamecxx . . $ _GtkBookmarkList#filename.;
491 }
492
493 /**
494 * gtk_bookmark_list_new:
495 * @filename: (type filename) (nullable): The bookmark file to load
496 * @attributes: (nullable): The attributes to query
497 *
498 * Creates a new `GtkBookmarkList` with the given @attributes.
499 *
500 * Returns: a new `GtkBookmarkList`
501 */
502 GtkBookmarkListcxx . . $ GtkBookmarkList# *
503 gtk_bookmark_list_newcxx . . $ gtk_bookmark_list_new(42f0b76c423549d3). (const char *filename,
504 const char *attributes)
505 {
506 return g_object_newcxx . . $ g_object_new(8485fe61b4be4c78). (GTK_TYPE_BOOKMARK_LISTcxx . . $ `gtk/gtkbookmarklist.h:34:9`!,
507 "filename", filename,
508 "attributes", attributes,
509 NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
510 }
511
512 /**
513 * gtk_bookmark_list_set_attributes:
514 * @self: a `GtkBookmarkList`
515 * @attributes: (nullable): the attributes to enumerate
516 *
517 * Sets the @attributes to be enumerated and starts the enumeration.
518 *
519 * If @attributes is %NULL, no attributes will be queried, but a list
520 * of `GFileInfo`s will still be created.
521 */
522 void
523 gtk_bookmark_list_set_attributescxx . . $ gtk_bookmark_list_set_attributes(24bed2c383dfa43a). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self,
524 const char *attributes)
525 {
526 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_BOOKMARK_LIST (self));
527
528 if (g_strcmp0cxx . . $ g_strcmp0(5ae29d726ae57f88). (self->attributescxx . . $ _GtkBookmarkList#attributes., attributes) == 0)
529 return;
530
531 g_object_freeze_notifycxx . . $ g_object_freeze_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self));
532
533 g_freecxx . . $ g_free(5d22bdacc48458e8). (self->attributescxx . . $ _GtkBookmarkList#attributes.);
534 self->attributescxx . . $ _GtkBookmarkList#attributes. = g_strdupcxx . . $ `<external>/7822753393113922331/gstrfuncs.h:324:9`! (attributes);
535
536 gtk_bookmark_list_start_loadingcxx . . $ gtk_bookmark_list_start_loading(2dd34c12bd428e88). (self);
537
538 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_ATTRIBUTEScxx . . $ PROP_ATTRIBUTES.]);
539
540 g_object_thaw_notifycxx . . $ g_object_thaw_notify(6087475fa43034d3). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self));
541 }
542
543 /**
544 * gtk_bookmark_list_get_attributes:
545 * @self: a `GtkBookmarkList`
546 *
547 * Gets the attributes queried on the children.
548 *
549 * Returns: (nullable) (transfer none): The queried attributes
550 */
551 const char *
552 gtk_bookmark_list_get_attributescxx . . $ gtk_bookmark_list_get_attributes(e226dc12adad3f1b). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
553 {
554 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_BOOKMARK_LIST (self), NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!);
555
556 return self->attributescxx . . $ _GtkBookmarkList#attributes.;
557 }
558
559 /**
560 * gtk_bookmark_list_set_io_priority:
561 * @self: a `GtkBookmarkList`
562 * @io_priority: IO priority to use
563 *
564 * Sets the IO priority to use while loading files.
565 *
566 * The default IO priority is %G_PRIORITY_DEFAULT.
567 */
568 void
569 gtk_bookmark_list_set_io_prioritycxx . . $ gtk_bookmark_list_set_io_priority(4a006ddd31e7727c). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self,
570 int io_priority)
571 {
572 g_return_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:652:9`! (GTK_IS_BOOKMARK_LIST (self));
573
574 if (self->io_prioritycxx . . $ _GtkBookmarkList#io_priority. == io_priority)
575 return;
576
577 self->io_prioritycxx . . $ _GtkBookmarkList#io_priority. = io_priority;
578
579 g_object_notify_by_pspeccxx . . $ g_object_notify_by_pspec(89706f8943b9e738). (G_OBJECTcxx . . $ `<external>/1341695927569185362/gobject.h:54:9`! (self), propertiescxx . . $ properties.[PROP_IO_PRIORITYcxx . . $ PROP_IO_PRIORITY.]);
580 }
581
582 /**
583 * gtk_bookmark_list_get_io_priority:
584 * @self: a `GtkBookmarkList`
585 *
586 * Gets the IO priority to use while loading file.
587 *
588 * Returns: The IO priority.
589 */
590 int
591 gtk_bookmark_list_get_io_prioritycxx . . $ gtk_bookmark_list_get_io_priority(2a5b89c73981d172). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
592 {
593 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_BOOKMARK_LIST (self), G_PRIORITY_DEFAULTcxx . . $ `<external>/1856471541377536744/gmain.h:434:9`!);
594
595 return self->io_prioritycxx . . $ _GtkBookmarkList#io_priority.;
596 }
597
598 /**
599 * gtk_bookmark_list_is_loading: (get-property loading)
600 * @self: a `GtkBookmarkList`
601 *
602 * Returns %TRUE if the files are currently being loaded.
603 *
604 * Files will be added to @self from time to time while loading is
605 * going on. The order in which are added is undefined and may change
606 * in between runs.
607 *
608 * Returns: %TRUE if @self is loading
609 */
610 gbooleancxx . . $ gboolean#
611 gtk_bookmark_list_is_loadingcxx . . $ gtk_bookmark_list_is_loading(2a5b89c73981d172). (GtkBookmarkListcxx . . $ GtkBookmarkList# *self)
612 {
613 g_return_val_if_failcxx . . $ `<external>/5169755362661750954/gmessages.h:665:9`! (GTK_IS_BOOKMARK_LIST (self), FALSEcxx . . $ `<external>/12741050725406041920/gmacros.h:967:9`!);
614
615 return self->cancellablecxx . . $ _GtkBookmarkList#cancellable. != NULLcxx . . $ `<external>/15298297234472979974/stddef.h:419:9`!;
616 }