1 /* gtkam-camera.c
2 *
3 * Copyright 2002 Lutz Mueller <lutz@users.sourceforge.net>
4 *
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.
9 *
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 General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 #include "config.h"
20 #include "gtkam-camera.h"
21 #include "i18n.h"
22
23 #include <string.h>
24
25 #define PARENT_TYPE G_TYPE_OBJECT
26 static GObjectClass *parent_class;
27
28 static void
gtkam_camera_finalize(GObject * object)29 gtkam_camera_finalize (GObject *object)
30 {
31 GtkamCamera *c = GTKAM_CAMERA (object);
32
33 if (c->camera) {
34 gp_camera_unref (c->camera);
35 c->camera = NULL;
36 }
37
38 G_OBJECT_CLASS (parent_class)->finalize (object);
39 }
40
41 static void
gtkam_camera_class_init(gpointer g_class,gpointer class_data)42 gtkam_camera_class_init (gpointer g_class, gpointer class_data)
43 {
44 GObjectClass *gobject_class;
45
46 gobject_class = G_OBJECT_CLASS (g_class);
47 gobject_class->finalize = gtkam_camera_finalize;
48
49 parent_class = g_type_class_peek_parent (g_class);
50 }
51
52 static void
gtkam_camera_init(GTypeInstance * instance,gpointer g_class)53 gtkam_camera_init (GTypeInstance *instance, gpointer g_class)
54 {
55 GtkamCamera *c = GTKAM_CAMERA (instance);
56
57 c = NULL;
58 }
59
60 GType
gtkam_camera_get_type(void)61 gtkam_camera_get_type (void)
62 {
63 static GType type = 0;
64
65 if (!type) {
66 GTypeInfo ti;
67
68 memset (&ti, 0, sizeof (GTypeInfo));
69 ti.class_size = sizeof (GtkamCameraClass);
70 ti.class_init = gtkam_camera_class_init;
71 ti.instance_size = sizeof (GtkamCamera);
72 ti.instance_init = gtkam_camera_init;
73
74 type = g_type_register_static (PARENT_TYPE, "GtkamCamera",
75 &ti, 0);
76 }
77
78 return (type);
79 }
80
81 GtkamCamera *
gtkam_camera_new(Camera * camera,gboolean multi)82 gtkam_camera_new (Camera *camera, gboolean multi)
83 {
84 GtkamCamera *c;
85
86 c = g_object_new (GTKAM_TYPE_CAMERA, NULL);
87
88 c->camera = camera;
89 gp_camera_ref (camera);
90 c->multi = multi;
91
92 return (c);
93 }
94