1 | /* |
2 | * Copyright (c) 2016 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 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 | |
18 | #include "config.h" |
19 | #include <glib/gi18n-lib.h> |
20 | |
21 | #include "recording.h" |
22 | |
23 | enum |
24 | { |
25 | PROP_0, |
26 | PROP_TIMESTAMP, |
27 | LAST_PROP |
28 | }; |
29 | |
30 | static GParamSpec *props[LAST_PROP] = { NULL, }; |
31 | |
32 | |
33 | G_DEFINE_TYPE (GtkInspectorRecording, gtk_inspector_recording, G_TYPE_OBJECT) |
34 | |
35 | static void |
36 | gtk_inspector_recording_get_property (GObject *object, |
37 | guint param_id, |
38 | GValue *value, |
39 | GParamSpec *pspec) |
40 | { |
41 | GtkInspectorRecording *recording = GTK_INSPECTOR_RECORDING (object); |
42 | |
43 | switch (param_id) |
44 | { |
45 | case PROP_TIMESTAMP: |
46 | g_value_set_int64 (value, v_int64: recording->timestamp); |
47 | break; |
48 | |
49 | default: |
50 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); |
51 | break; |
52 | } |
53 | } |
54 | |
55 | static void |
56 | gtk_inspector_recording_set_property (GObject *object, |
57 | guint param_id, |
58 | const GValue *value, |
59 | GParamSpec *pspec) |
60 | { |
61 | GtkInspectorRecording *recording = GTK_INSPECTOR_RECORDING (object); |
62 | |
63 | switch (param_id) |
64 | { |
65 | case PROP_TIMESTAMP: |
66 | recording->timestamp = g_value_get_int64 (value); |
67 | break; |
68 | |
69 | default: |
70 | G_OBJECT_WARN_INVALID_PROPERTY_ID (object, param_id, pspec); |
71 | break; |
72 | } |
73 | } |
74 | |
75 | static void |
76 | gtk_inspector_recording_class_init (GtkInspectorRecordingClass *klass) |
77 | { |
78 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
79 | |
80 | object_class->get_property = gtk_inspector_recording_get_property; |
81 | object_class->set_property = gtk_inspector_recording_set_property; |
82 | |
83 | props[PROP_TIMESTAMP] = |
84 | g_param_spec_int64 (name: "timestamp" , |
85 | nick: "Timestamp" , |
86 | blurb: "Timestamp when this event was recorded" , |
87 | G_MININT64, G_MAXINT64, default_value: 0, |
88 | flags: G_PARAM_READWRITE | G_PARAM_CONSTRUCT); |
89 | |
90 | g_object_class_install_properties (oclass: object_class, n_pspecs: LAST_PROP, pspecs: props); |
91 | } |
92 | |
93 | static void |
94 | gtk_inspector_recording_init (GtkInspectorRecording *vis) |
95 | { |
96 | } |
97 | |
98 | gint64 |
99 | gtk_inspector_recording_get_timestamp (GtkInspectorRecording *recording) |
100 | { |
101 | return recording->timestamp; |
102 | } |
103 | |
104 | // vim: set et sw=2 ts=2: |
105 | |