3
* Copyright (c) 2007 Diego Ongaro <ongardie@gmail.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program 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 Library General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
#include "model_system.h"
26
#include "model_volumes.h"
27
#include "model_user.h"
29
#include <libxfce4util/libxfce4util.h>
33
BookmarksSystem *system;
34
BookmarksVolumes *volumes;
39
places_bookmarks_init()
41
DBG("initializing model");
43
Bookmarks *b = g_new0(Bookmarks, 1);
45
b->system = places_bookmarks_system_init();
46
b->volumes = places_bookmarks_volumes_init();
47
b->user = places_bookmarks_user_init(b->system); // user depends on system for
48
// places_bookmarks_system_bi_system_mod().
49
// It's a sucky aspect of this design...
55
places_bookmarks_visit(Bookmarks *b,
56
BookmarksVisitor *visitor)
58
places_bookmarks_system_visit (b->system, visitor);
59
places_bookmarks_volumes_visit (b->volumes, visitor);
60
visitor->separator (visitor->pass_thru);
61
places_bookmarks_user_visit (b->user, visitor);
65
places_bookmarks_changed(Bookmarks *b)
67
// try to avoid short-circuit of || since changed() has side-effects
68
gboolean changed = FALSE;
69
changed = places_bookmarks_system_changed(b->system) || changed;
70
changed = places_bookmarks_volumes_changed(b->volumes) || changed;
71
changed = places_bookmarks_user_changed(b->user) || changed;
76
places_bookmarks_finalize(Bookmarks *b)
78
places_bookmarks_system_finalize(b->system);
81
places_bookmarks_volumes_finalize(b->volumes);
84
places_bookmarks_user_finalize(b->user);
90
// vim: ai et tabstop=4