Debian Codegraph @

src/byzanzlayer.c

raw symbols SCIP
1 /* desktop session recorder
2 * Copyright (C) 2009 Benjamin Otte <[email protected]>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 3 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 * Library General Public License for more details.
13 *
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
16 */
17
18 #ifdef HAVE_CONFIG_H
19 #include "config.h"
20 #endif
21
22 #include "byzanzlayer.h"
23
24 #include <gdk/gdkx.h>
25
26 enum {
27 PROP_0,
28 PROP_RECORDER,
29 };
30
31 G_DEFINE_ABSTRACT_TYPE (ByzanzLayer, byzanz_layer, G_TYPE_OBJECT)
32
33 static void
34 byzanz_layer_set_property (GObject *object, guint param_id, const GValue *value,
35 GParamSpec * pspec)
36 {
37 ByzanzLayer *layer = BYZANZ_LAYER (object);
38
39 switch (param_id) {
40 case PROP_RECORDER:
41 layer->recorder = g_value_get_object (value);
42 g_assert (layer->recorder != NULL);
43 break;
44 default:
45 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
46 break;
47 }
48 }
49
50 static void
51 byzanz_layer_get_property (GObject *object, guint param_id, GValue *value,
52 GParamSpec * pspec)
53 {
54 ByzanzLayer *layer = BYZANZ_LAYER (object);
55
56 switch (param_id) {
57 case PROP_RECORDER:
58 g_value_set_object (value, layer->recorder);
59 break;
60 default:
61 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec);
62 break;
63 }
64 }
65
66 static void
67 byzanz_layer_constructed (GObject *object)
68 {
69 ByzanzLayer *layer = BYZANZ_LAYER (object);
70
71 byzanz_layer_invalidate (layer);
72
73 if (G_OBJECT_CLASS (byzanz_layer_parent_class)->constructed)
74 G_OBJECT_CLASS (byzanz_layer_parent_class)->constructed (object);
75 }
76
77 static void
78 byzanz_layer_finalize (GObject *object)
79 {
80 //ByzanzLayer *layer = BYZANZ_LAYER (object);
81
82 G_OBJECT_CLASS (byzanz_layer_parent_class)->finalize (object);
83 }
84
85 static void
86 byzanz_layer_class_init (ByzanzLayerClass *klass)
87 {
88 GObjectClass *object_class = G_OBJECT_CLASS (klass);
89
90 object_class->get_property = byzanz_layer_get_property;
91 object_class->set_property = byzanz_layer_set_property;
92 object_class->finalize = byzanz_layer_finalize;
93 object_class->constructed = byzanz_layer_constructed;
94
95 g_object_class_install_property (object_class, PROP_RECORDER,
96 g_param_spec_object ("recorder", "recorder", "recorder that manages us",
97 BYZANZ_TYPE_RECORDER, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
98 }
99
100 static void
101 byzanz_layer_init (ByzanzLayer *layer)
102 {
103 }
104
105 void
106 byzanz_layer_invalidate (ByzanzLayer *layer)
107 {
108 g_return_if_fail (BYZANZ_IS_LAYER (layer));
109
110 byzanz_recorder_queue_snapshot (layer->recorder);
111 }
112