1 | /* |
2 | * Copyright (c) 2021 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 "eventrecording.h" |
22 | |
23 | G_DEFINE_TYPE (GtkInspectorEventRecording, gtk_inspector_event_recording, GTK_TYPE_INSPECTOR_RECORDING) |
24 | |
25 | static void |
26 | gtk_inspector_event_recording_finalize (GObject *object) |
27 | { |
28 | GtkInspectorEventRecording *recording = GTK_INSPECTOR_EVENT_RECORDING (object); |
29 | |
30 | g_clear_pointer (&recording->event, gdk_event_unref); |
31 | |
32 | G_OBJECT_CLASS (gtk_inspector_event_recording_parent_class)->finalize (object); |
33 | } |
34 | |
35 | static void |
36 | gtk_inspector_event_recording_class_init (GtkInspectorEventRecordingClass *klass) |
37 | { |
38 | GObjectClass *object_class = G_OBJECT_CLASS (klass); |
39 | |
40 | object_class->finalize = gtk_inspector_event_recording_finalize; |
41 | } |
42 | |
43 | static void |
44 | gtk_inspector_event_recording_init (GtkInspectorEventRecording *vis) |
45 | { |
46 | } |
47 | |
48 | GtkInspectorRecording * |
49 | gtk_inspector_event_recording_new (gint64 timestamp, |
50 | GdkEvent *event) |
51 | { |
52 | GtkInspectorEventRecording *recording; |
53 | |
54 | recording = g_object_new (GTK_TYPE_INSPECTOR_EVENT_RECORDING, |
55 | first_property_name: "timestamp" , timestamp, |
56 | NULL); |
57 | |
58 | recording->event = gdk_event_ref (event); |
59 | |
60 | return GTK_INSPECTOR_RECORDING (recording); |
61 | } |
62 | |
63 | GdkEvent * |
64 | gtk_inspector_event_recording_get_event (GtkInspectorEventRecording *recording) |
65 | { |
66 | return recording->event; |
67 | } |
68 | |
69 | // vim: set et sw=2 ts=2: |
70 | |