Location | Tool | Test ID | Function | Issue |
---|---|---|---|---|
gal-view.c:92:16 | clang-analyzer | Value stored to 'object_class' during its initialization is never read | ||
gal-view.c:92:16 | clang-analyzer | Value stored to 'object_class' during its initialization is never read |
1 /*
2 *
3 * This program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2 of the License, or (at your option) version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with the program; if not, see <http://www.gnu.org/licenses/>
15 *
16 *
17 * Authors:
18 * Chris Lahey <clahey@ximian.com>
19 *
20 * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
21 *
22 */
23
24 #ifdef HAVE_CONFIG_H
25 #include <config.h>
26 #endif
27
28 #include "gal-view.h"
29
30 #include <e-util/e-util.h>
31
32 #define d(x)
33
34 enum {
35 PROP_0,
36 PROP_TITLE,
37 PROP_TYPE_CODE
38 };
39
40 enum {
41 CHANGED,
42 LAST_SIGNAL
43 };
44
45 static guint signals[LAST_SIGNAL];
46
47 G_DEFINE_ABSTRACT_TYPE (GalView, gal_view, G_TYPE_OBJECT)
48
49 static void
50 view_set_property (GObject *object,
51 guint property_id,
52 const GValue *value,
53 GParamSpec *pspec)
54 {
55 switch (property_id) {
56 case PROP_TITLE:
57 gal_view_set_title (
58 GAL_VIEW (object),
59 g_value_get_string (value));
60 return;
61 }
62
63 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
64 }
65
66 static void
67 view_get_property (GObject *object,
68 guint property_id,
69 GValue *value,
70 GParamSpec *pspec)
71 {
72 switch (property_id) {
73 case PROP_TITLE:
74 g_value_set_string (
75 value, gal_view_get_title (
76 GAL_VIEW (object)));
77 return;
78
79 case PROP_TYPE_CODE:
80 g_value_set_string (
81 value, gal_view_get_type_code (
82 GAL_VIEW (object)));
83 return;
84 }
85
86 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
87 }
88
89 static void
90 gal_view_class_init (GalViewClass *class)
91 {
92 GObjectClass *object_class = G_OBJECT_CLASS (class);
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
93
94 object_class = G_OBJECT_CLASS (class);
95 object_class->set_property = view_set_property;
96 object_class->get_property = view_get_property;
97
98 g_object_class_install_property (
99 object_class,
100 PROP_TITLE,
101 g_param_spec_string (
102 "title",
103 NULL,
104 NULL,
105 NULL,
106 G_PARAM_READWRITE));
107
108 g_object_class_install_property (
109 object_class,
110 PROP_TYPE_CODE,
111 g_param_spec_string (
112 "type-code",
113 NULL,
114 NULL,
115 NULL,
116 G_PARAM_READABLE));
117
118 signals[CHANGED] = g_signal_new (
119 "changed",
120 G_OBJECT_CLASS_TYPE (object_class),
121 G_SIGNAL_RUN_LAST,
122 G_STRUCT_OFFSET (GalViewClass, changed),
123 NULL, NULL,
124 g_cclosure_marshal_VOID__VOID,
125 G_TYPE_NONE, 0);
126 }
127
128 static void
129 gal_view_init (GalView *view)
130 {
131 }
132
133 /**
134 * gal_view_edit
135 * @view: The view to edit
136 * @parent: the parent window.
137 */
138 void
139 gal_view_edit (GalView *view,
140 GtkWindow *parent)
141 {
142 GalViewClass *class;
143
144 g_return_if_fail (GAL_IS_VIEW (view));
145 g_return_if_fail (GTK_IS_WINDOW (parent));
146
147 class = GAL_VIEW_GET_CLASS (view);
148 g_return_if_fail (class->edit != NULL);
149
150 class->edit (view, parent);
151 }
152
153 /**
154 * gal_view_load
155 * @view: The view to load to
156 * @filename: The file to load from
157 */
158 void
159 gal_view_load (GalView *view,
160 const gchar *filename)
161 {
162 GalViewClass *class;
163
164 g_return_if_fail (GAL_IS_VIEW (view));
165 g_return_if_fail (filename != NULL);
166
167 class = GAL_VIEW_GET_CLASS (view);
168 g_return_if_fail (class->load != NULL);
169
170 class->load (view, filename);
171 }
172
173 /**
174 * gal_view_save
175 * @view: The view to save
176 * @filename: The file to save to
177 */
178 void
179 gal_view_save (GalView *view,
180 const gchar *filename)
181 {
182 GalViewClass *class;
183
184 g_return_if_fail (GAL_IS_VIEW (view));
185 g_return_if_fail (filename != NULL);
186
187 class = GAL_VIEW_GET_CLASS (view);
188 g_return_if_fail (class->save != NULL);
189
190 class->save (view, filename);
191 }
192
193 /**
194 * gal_view_get_title
195 * @view: The view to query.
196 *
197 * Returns: The title of the view.
198 */
199 const gchar *
200 gal_view_get_title (GalView *view)
201 {
202 GalViewClass *class;
203
204 g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
205
206 class = GAL_VIEW_GET_CLASS (view);
207 g_return_val_if_fail (class->get_title != NULL, NULL);
208
209 return class->get_title (view);
210 }
211
212 /**
213 * gal_view_set_title
214 * @view: The view to set.
215 * @title: The new title value.
216 */
217 void
218 gal_view_set_title (GalView *view,
219 const gchar *title)
220 {
221 GalViewClass *class;
222
223 g_return_if_fail (GAL_IS_VIEW (view));
224
225 class = GAL_VIEW_GET_CLASS (view);
226 g_return_if_fail (class->set_title != NULL);
227
228 class->set_title (view, title);
229
230 g_object_notify (G_OBJECT (view), "title");
231 }
232
233 /**
234 * gal_view_get_type_code
235 * @view: The view to get.
236 *
237 * Returns: The type of the view.
238 */
239 const gchar *
240 gal_view_get_type_code (GalView *view)
241 {
242 GalViewClass *class;
243
244 g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
245
246 class = GAL_VIEW_GET_CLASS (view);
247 g_return_val_if_fail (class->get_type_code != NULL, NULL);
248
249 return class->get_type_code (view);
250 }
251
252 /**
253 * gal_view_clone
254 * @view: The view to clone.
255 *
256 * Returns: The clone.
257 */
258 GalView *
259 gal_view_clone (GalView *view)
260 {
261 GalViewClass *class;
262
263 g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
264
265 class = GAL_VIEW_GET_CLASS (view);
266 g_return_val_if_fail (class->clone != NULL, NULL);
267
268 return class->clone (view);
269 }
270
271 /**
272 * gal_view_changed
273 * @view: The view that changed.
274 */
275 void
276 gal_view_changed (GalView *view)
277 {
278 g_return_if_fail (GAL_IS_VIEW (view));
279
280 g_signal_emit (view, signals[CHANGED], 0);
281 }