2 * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU 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.
9 * This program 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 General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "gis-world.h"
32 static guint signals[NUM_SIGNALS];
34 /* Class/Object init */
35 G_DEFINE_TYPE(GisWorld, gis_world, G_TYPE_OBJECT);
36 static void gis_world_init(GisWorld *self)
38 g_debug("GisWorld: init");
40 self->offline = FALSE;
42 static void gis_world_dispose(GObject *gobject)
44 g_debug("GisWorld: dispose");
45 /* Drop references to other GObjects */
46 G_OBJECT_CLASS(gis_world_parent_class)->dispose(gobject);
48 static void gis_world_finalize(GObject *gobject)
50 g_debug("GisWorld: finalize");
51 GisWorld *self = GIS_WORLD(gobject);
52 G_OBJECT_CLASS(gis_world_parent_class)->finalize(gobject);
54 static void gis_world_class_init(GisWorldClass *klass)
56 g_debug("GisWorld: class_init");
57 GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
58 gobject_class->dispose = gis_world_dispose;
59 gobject_class->finalize = gis_world_finalize;
60 signals[SIG_REFRESH] = g_signal_new(
62 G_TYPE_FROM_CLASS(gobject_class),
67 g_cclosure_marshal_VOID__VOID,
70 signals[SIG_OFFLINE] = g_signal_new(
72 G_TYPE_FROM_CLASS(gobject_class),
77 g_cclosure_marshal_VOID__BOOLEAN,
84 static void _gis_world_emit_refresh(GisWorld *world)
86 g_signal_emit(world, signals[SIG_REFRESH], 0);
88 static void _gis_world_emit_offline(GisWorld *world)
90 g_signal_emit(world, signals[SIG_OFFLINE], 0,
98 GisWorld *gis_world_new()
100 g_debug("GisWorld: new");
101 return g_object_new(GIS_TYPE_WORLD, NULL);
104 void gis_world_refresh(GisWorld *world)
106 g_debug("GisWorld: refresh");
107 _gis_world_emit_refresh(world);
110 void gis_world_set_offline(GisWorld *world, gboolean offline)
112 g_assert(GIS_IS_WORLD(world));
113 g_debug("GisWorld: set_offline - %d", offline);
114 world->offline = offline;
115 _gis_world_emit_offline(world);
118 gboolean gis_world_get_offline(GisWorld *world)
120 g_assert(GIS_IS_WORLD(world));
121 g_debug("GisWorld: get_offline - %d", world->offline);
122 return world->offline;