Location | Tool | Test ID | Function | Issue |
---|---|---|---|---|
tracker-stats.c:195:2 | clang-analyzer | Value stored to '_result_length1' is never read | ||
tracker-stats.c:293:11 | gcc | unused-but-set-variable | statistics_dbus_interface_get_property | variable 'object' set but not used |
tracker-stats.c:295:2 | clang-analyzer | Value stored to 'object' is never read | ||
tracker-stats.c:302:11 | gcc | unused-but-set-variable | statistics_dbus_interface_set_property | variable 'object' set but not used |
tracker-stats.c:304:2 | clang-analyzer | Value stored to 'object' is never read | ||
tracker-stats.c:431:9 | gcc | tracker_stats_setup_ui | assignment from incompatible pointer type [enabled by default] | |
tracker-stats.c:550:6 | clang-analyzer | Value stored to '_tmp19_' is never read | ||
tracker-stats.c:552:6 | clang-analyzer | Value stored to '_tmp19__length2' is never read | ||
tracker-stats.c:558:6 | clang-analyzer | Value stored to '_tmp21__length1' is never read | ||
tracker-stats.c:565:6 | clang-analyzer | Value stored to '_tmp25__length1' is never read |
1 /* tracker-stats.c generated by valac 0.18.1, the Vala compiler
2 * generated from tracker-stats.vala, do not modify */
3
4 /**/
5 /* Copyright 2010, Martyn Russell <martyn@lanedo.com>*/
6 /**/
7 /* This program is free software; you can redistribute it and/or*/
8 /* modify it under the terms of the GNU General Public License*/
9 /* as published by the Free Software Foundation; either version 2*/
10 /* of the License, or (at your option) any later version.*/
11 /**/
12 /* This program is distributed in the hope that it will be useful,*/
13 /* but WITHOUT ANY WARRANTY; without even the implied warranty of*/
14 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the*/
15 /* GNU General Public License for more details.*/
16 /**/
17 /* You should have received a copy of the GNU General Public License*/
18 /* along with this program; if not, write to the Free Software*/
19 /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA*/
20 /* 02110-1301, USA.*/
21 /**/
22
23 #include <glib.h>
24 #include <glib-object.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #include "config.h"
28 #include <gio/gio.h>
29 #include <gtk/gtk.h>
30 #include <glib/gi18n-lib.h>
31
32
33 #define TYPE_STATISTICS (statistics_get_type ())
34 #define STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_STATISTICS, Statistics))
35 #define IS_STATISTICS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_STATISTICS))
36 #define STATISTICS_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TYPE_STATISTICS, StatisticsIface))
37
38 typedef struct _Statistics Statistics;
39 typedef struct _StatisticsIface StatisticsIface;
40
41 #define TYPE_STATISTICS_PROXY (statistics_proxy_get_type ())
42 typedef GDBusProxy StatisticsProxy;
43 typedef GDBusProxyClass StatisticsProxyClass;
44
45 #define TRACKER_TYPE_STATS (tracker_stats_get_type ())
46 #define TRACKER_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_STATS, TrackerStats))
47 #define TRACKER_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_STATS, TrackerStatsClass))
48 #define TRACKER_IS_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_STATS))
49 #define TRACKER_IS_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STATS))
50 #define TRACKER_STATS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STATS, TrackerStatsClass))
51
52 typedef struct _TrackerStats TrackerStats;
53 typedef struct _TrackerStatsClass TrackerStatsClass;
54 typedef struct _TrackerStatsPrivate TrackerStatsPrivate;
55 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
56 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
57 #define _g_free0(var) (var = (g_free (var), NULL))
58
59 struct _StatisticsIface {
60 GTypeInterface parent_iface;
61 gchar** (*Get) (Statistics* self, int* result_length1, int* result_length2, GError** error);
62 };
63
64 struct _TrackerStats {
65 GtkDialog parent_instance;
66 TrackerStatsPrivate * priv;
67 };
68
69 struct _TrackerStatsClass {
70 GtkDialogClass parent_class;
71 };
72
73 struct _TrackerStatsPrivate {
74 Statistics* tracker;
75 };
76
77
78 static gpointer tracker_stats_parent_class = NULL;
79
80 #define b PACKAGE_NAME
81 GType statistics_proxy_get_type (void) G_GNUC_CONST;
82 guint statistics_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
83 GType statistics_get_type (void) G_GNUC_CONST;
84 gchar** statistics_Get (Statistics* self, int* result_length1, int* result_length2, GError** error);
85 static void statistics_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters);
86 static gchar** statistics_proxy_Get (Statistics* self, int* result_length1, int* result_length2, GError** error);
87 static void statistics_proxy_statistics_interface_init (StatisticsIface* iface);
88 static void _dbus_statistics_Get (Statistics* self, GVariant* parameters, GDBusMethodInvocation* invocation);
89 static void statistics_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data);
90 static GVariant* statistics_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data);
91 static gboolean statistics_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data);
92 static void _statistics_unregister_object (gpointer user_data);
93 GType tracker_stats_get_type (void) G_GNUC_CONST;
94 #define TRACKER_STATS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_STATS, TrackerStatsPrivate))
95 enum {
96 TRACKER_STATS_DUMMY_PROPERTY
97 };
98 TrackerStats* tracker_stats_new (void);
99 TrackerStats* tracker_stats_construct (GType object_type);
100 static void tracker_stats_setup_dbus (TrackerStats* self);
101 static void tracker_stats_setup_ui (TrackerStats* self);
102 static void tracker_stats_on_response (TrackerStats* self, GtkDialog* source, gint response_id);
103 static void _tracker_stats_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self);
104 static void tracker_stats_finalize (GObject* obj);
105 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
106 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
107
108 static const GDBusArgInfo _statistics_dbus_arg_info_Get_result = {-1, "result", "aas"};
109 static const GDBusArgInfo * const _statistics_dbus_arg_info_Get_in[] = {NULL};
110 static const GDBusArgInfo * const _statistics_dbus_arg_info_Get_out[] = {&_statistics_dbus_arg_info_Get_result, NULL};
111 static const GDBusMethodInfo _statistics_dbus_method_info_Get = {-1, "Get", (GDBusArgInfo **) (&_statistics_dbus_arg_info_Get_in), (GDBusArgInfo **) (&_statistics_dbus_arg_info_Get_out)};
112 static const GDBusMethodInfo * const _statistics_dbus_method_info[] = {&_statistics_dbus_method_info_Get, NULL};
113 static const GDBusSignalInfo * const _statistics_dbus_signal_info[] = {NULL};
114 static const GDBusPropertyInfo * const _statistics_dbus_property_info[] = {NULL};
115 static const GDBusInterfaceInfo _statistics_dbus_interface_info = {-1, "org.freedesktop.Tracker1.Statistics", (GDBusMethodInfo **) (&_statistics_dbus_method_info), (GDBusSignalInfo **) (&_statistics_dbus_signal_info), (GDBusPropertyInfo **) (&_statistics_dbus_property_info)};
116 static const GDBusInterfaceVTable _statistics_dbus_interface_vtable = {statistics_dbus_interface_method_call, statistics_dbus_interface_get_property, statistics_dbus_interface_set_property};
117
118 gchar** statistics_Get (Statistics* self, int* result_length1, int* result_length2, GError** error) {
119 g_return_val_if_fail (self != NULL, NULL);
120 return STATISTICS_GET_INTERFACE (self)->Get (self, result_length1, result_length2, error);
121 }
122
123
124 static void statistics_base_init (StatisticsIface * iface) {
125 static gboolean initialized = FALSE;
126 if (!initialized) {
127 initialized = TRUE;
128 }
129 }
130
131
132 GType statistics_get_type (void) {
133 static volatile gsize statistics_type_id__volatile = 0;
134 if (g_once_init_enter (&statistics_type_id__volatile)) {
135 static const GTypeInfo g_define_type_info = { sizeof (StatisticsIface), (GBaseInitFunc) statistics_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
136 GType statistics_type_id;
137 statistics_type_id = g_type_register_static (G_TYPE_INTERFACE, "Statistics", &g_define_type_info, 0);
138 g_type_interface_add_prerequisite (statistics_type_id, G_TYPE_DBUS_PROXY);
139 g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-proxy-type"), (void*) statistics_proxy_get_type);
140 g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-interface-name"), "org.freedesktop.Tracker1.Statistics");
141 g_type_set_qdata (statistics_type_id, g_quark_from_static_string ("vala-dbus-register-object"), (void*) statistics_register_object);
142 g_once_init_leave (&statistics_type_id__volatile, statistics_type_id);
143 }
144 return statistics_type_id__volatile;
145 }
146
147
148 G_DEFINE_TYPE_EXTENDED (StatisticsProxy, statistics_proxy, G_TYPE_DBUS_PROXY, 0, G_IMPLEMENT_INTERFACE (TYPE_STATISTICS, statistics_proxy_statistics_interface_init) )
149 static void statistics_proxy_class_init (StatisticsProxyClass* klass) {
150 G_DBUS_PROXY_CLASS (klass)->g_signal = statistics_proxy_g_signal;
151 }
152
153
154 static void statistics_proxy_g_signal (GDBusProxy* proxy, const gchar* sender_name, const gchar* signal_name, GVariant* parameters) {
155 }
156
157
158 static void statistics_proxy_init (StatisticsProxy* self) {
159 }
160
161
162 static gchar** statistics_proxy_Get (Statistics* self, int* result_length1, int* result_length2, GError** error) {
163 GDBusMessage *_message;
164 GVariant *_arguments;
165 GVariantBuilder _arguments_builder;
166 GDBusMessage *_reply_message;
167 GVariant *_reply;
168 GVariantIter _reply_iter;
169 gchar** _result;
170 int _result_length1;
171 int _result_length2;
172 GVariant* _tmp0_;
173 gchar** _tmp1_;
174 int _tmp1__length;
175 int _tmp1__size;
176 int _tmp1__length1;
177 GVariantIter _tmp2_;
178 GVariant* _tmp3_;
179 G_DBUS_ERROR;
180 _message = g_dbus_message_new_method_call (g_dbus_proxy_get_name ((GDBusProxy *) self), g_dbus_proxy_get_object_path ((GDBusProxy *) self), "org.freedesktop.Tracker1.Statistics", "Get");
181 g_variant_builder_init (&_arguments_builder, G_VARIANT_TYPE_TUPLE);
182 _arguments = g_variant_builder_end (&_arguments_builder);
183 g_dbus_message_set_body (_message, _arguments);
184 _reply_message = g_dbus_connection_send_message_with_reply_sync (g_dbus_proxy_get_connection ((GDBusProxy *) self), _message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, g_dbus_proxy_get_default_timeout ((GDBusProxy *) self), NULL, NULL, error);
185 g_object_unref (_message);
186 if (!_reply_message) {
187 return NULL;
188 }
189 if (g_dbus_message_to_gerror (_reply_message, error)) {
190 g_object_unref (_reply_message);
191 return NULL;
192 }
193 _reply = g_dbus_message_get_body (_reply_message);
194 g_variant_iter_init (&_reply_iter, _reply);
195 _result_length1 = 0;
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
196 _result_length2 = 0;
197 _tmp0_ = g_variant_iter_next_value (&_reply_iter);
198 _tmp1_ = g_new (gchar*, 5);
199 _tmp1__length = 0;
200 _tmp1__size = 4;
201 _tmp1__length1 = 0;
202 g_variant_iter_init (&_tmp2_, _tmp0_);
203 for (; (_tmp3_ = g_variant_iter_next_value (&_tmp2_)) != NULL; _tmp1__length1++) {
204 int _tmp1__length2;
205 GVariantIter _tmp4_;
206 GVariant* _tmp5_;
207 _tmp1__length2 = 0;
208 g_variant_iter_init (&_tmp4_, _tmp3_);
209 for (; (_tmp5_ = g_variant_iter_next_value (&_tmp4_)) != NULL; _tmp1__length2++) {
210 if (_tmp1__size == _tmp1__length) {
211 _tmp1__size = 2 * _tmp1__size;
212 _tmp1_ = g_renew (gchar*, _tmp1_, _tmp1__size + 1);
213 }
214 _tmp1_[_tmp1__length++] = g_variant_dup_string (_tmp5_, NULL);
215 g_variant_unref (_tmp5_);
216 }
217 _result_length2 = _tmp1__length2;
218 g_variant_unref (_tmp3_);
219 }
220 _result_length1 = _tmp1__length1;
221 _tmp1_[_tmp1__length] = NULL;
222 _result = _tmp1_;
223 g_variant_unref (_tmp0_);
224 *result_length1 = _result_length1;
225 *result_length2 = _result_length2;
226 g_object_unref (_reply_message);
227 return _result;
228 }
229
230
231 static void statistics_proxy_statistics_interface_init (StatisticsIface* iface) {
232 iface->Get = statistics_proxy_Get;
233 }
234
235
236 static void _dbus_statistics_Get (Statistics* self, GVariant* parameters, GDBusMethodInvocation* invocation) {
237 GError* error = NULL;
238 GVariantIter _arguments_iter;
239 GDBusMessage* _reply_message;
240 GVariant* _reply;
241 GVariantBuilder _reply_builder;
242 gchar** result;
243 int result_length1 = 0;
244 int result_length2 = 0;
245 gchar** _tmp6_;
246 GVariantBuilder _tmp7_;
247 int _tmp8_;
248 g_variant_iter_init (&_arguments_iter, parameters);
249 result = statistics_Get (self, &result_length1, &result_length2, &error);
250 if (error) {
251 g_dbus_method_invocation_return_gerror (invocation, error);
252 return;
253 }
254 _reply_message = g_dbus_message_new_method_reply (g_dbus_method_invocation_get_message (invocation));
255 g_variant_builder_init (&_reply_builder, G_VARIANT_TYPE_TUPLE);
256 _tmp6_ = result;
257 g_variant_builder_init (&_tmp7_, G_VARIANT_TYPE ("aas"));
258 for (_tmp8_ = 0; _tmp8_ < result_length1; _tmp8_++) {
259 GVariantBuilder _tmp9_;
260 int _tmp10_;
261 g_variant_builder_init (&_tmp9_, G_VARIANT_TYPE ("aas"));
262 for (_tmp10_ = 0; _tmp10_ < result_length2; _tmp10_++) {
263 g_variant_builder_add_value (&_tmp9_, g_variant_new_string (*_tmp6_));
264 _tmp6_++;
265 }
266 g_variant_builder_add_value (&_tmp7_, g_variant_builder_end (&_tmp9_));
267 }
268 g_variant_builder_add_value (&_reply_builder, g_variant_builder_end (&_tmp7_));
269 result = (_vala_array_free (result, result_length1 * result_length2, (GDestroyNotify) g_free), NULL);
270 _reply = g_variant_builder_end (&_reply_builder);
271 g_dbus_message_set_body (_reply_message, _reply);
272 g_dbus_connection_send_message (g_dbus_method_invocation_get_connection (invocation), _reply_message, G_DBUS_SEND_MESSAGE_FLAGS_NONE, NULL, NULL);
273 g_object_unref (invocation);
274 g_object_unref (_reply_message);
275 }
276
277
278 static void statistics_dbus_interface_method_call (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* method_name, GVariant* parameters, GDBusMethodInvocation* invocation, gpointer user_data) {
279 gpointer* data;
280 gpointer object;
281 data = user_data;
282 object = data[0];
283 if (strcmp (method_name, "Get") == 0) {
284 _dbus_statistics_Get (object, parameters, invocation);
285 } else {
286 g_object_unref (invocation);
287 }
288 }
289
290
291 static GVariant* statistics_dbus_interface_get_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GError** error, gpointer user_data) {
292 gpointer* data;
293 gpointer object;
(emitted by gcc) 294 data = user_data;
295 object = data[0];
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
296 return NULL;
297 }
298
299
300 static gboolean statistics_dbus_interface_set_property (GDBusConnection* connection, const gchar* sender, const gchar* object_path, const gchar* interface_name, const gchar* property_name, GVariant* value, GError** error, gpointer user_data) {
301 gpointer* data;
302 gpointer object;
(emitted by gcc) 303 data = user_data;
304 object = data[0];
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
305 return FALSE;
306 }
307
308
309 guint statistics_register_object (gpointer object, GDBusConnection* connection, const gchar* path, GError** error) {
310 guint result;
311 gpointer *data;
312 data = g_new (gpointer, 3);
313 data[0] = g_object_ref (object);
314 data[1] = g_object_ref (connection);
315 data[2] = g_strdup (path);
316 result = g_dbus_connection_register_object (connection, path, (GDBusInterfaceInfo *) (&_statistics_dbus_interface_info), &_statistics_dbus_interface_vtable, data, _statistics_unregister_object, error);
317 if (!result) {
318 return 0;
319 }
320 return result;
321 }
322
323
324 static void _statistics_unregister_object (gpointer user_data) {
325 gpointer* data;
326 data = user_data;
327 g_object_unref (data[0]);
328 g_object_unref (data[1]);
329 g_free (data[2]);
330 g_free (data);
331 }
332
333
334 TrackerStats* tracker_stats_construct (GType object_type) {
335 TrackerStats * self = NULL;
336 self = (TrackerStats*) g_object_new (object_type, NULL);
337 gtk_window_set_title ((GtkWindow*) self, "Statistics");
338 gtk_container_set_border_width ((GtkContainer*) self, (guint) 12);
339 gtk_window_set_resizable ((GtkWindow*) self, FALSE);
340 tracker_stats_setup_dbus (self);
341 tracker_stats_setup_ui (self);
342 return self;
343 }
344
345
346 TrackerStats* tracker_stats_new (void) {
347 return tracker_stats_construct (TRACKER_TYPE_STATS);
348 }
349
350
351 static void tracker_stats_setup_dbus (TrackerStats* self) {
352 GError * _inner_error_ = NULL;
353 g_return_if_fail (self != NULL);
354 g_debug ("tracker-stats.vala:43: Setting up statistics D-Bus connection");
355 {
356 Statistics* _tmp0_ = NULL;
357 Statistics* _tmp1_;
358 _tmp0_ = g_initable_new (TYPE_STATISTICS_PROXY, NULL, &_inner_error_, "g-flags", G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, "g-name", "org.freedesktop.Tracker1", "g-bus-type", G_BUS_TYPE_SESSION, "g-object-path", "/org/freedesktop/Tracker1/Statistics", "g-interface-name", "org.freedesktop.Tracker1.Statistics", NULL);
359 _tmp1_ = (Statistics*) _tmp0_;
360 if (_inner_error_ != NULL) {
361 if (_inner_error_->domain == G_IO_ERROR) {
362 goto __catch11_g_io_error;
363 }
364 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
365 g_clear_error (&_inner_error_);
366 return;
367 }
368 _g_object_unref0 (self->priv->tracker);
369 self->priv->tracker = _tmp1_;
370 }
371 goto __finally11;
372 __catch11_g_io_error:
373 {
374 GError* e = NULL;
375 GError* _tmp2_;
376 const gchar* _tmp3_;
377 GtkMessageDialog* _tmp4_;
378 GtkMessageDialog* msg;
379 GtkMessageDialog* _tmp5_;
380 e = _inner_error_;
381 _inner_error_ = NULL;
382 _tmp2_ = e;
383 _tmp3_ = _tmp2_->message;
384 _tmp4_ = (GtkMessageDialog*) gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Error connecting to D-Bus session bus, %s", _tmp3_);
385 g_object_ref_sink (_tmp4_);
386 msg = _tmp4_;
387 _tmp5_ = msg;
388 gtk_dialog_run ((GtkDialog*) _tmp5_);
389 gtk_main_quit ();
390 _g_object_unref0 (msg);
391 _g_error_free0 (e);
392 }
393 __finally11:
394 if (_inner_error_ != NULL) {
395 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
396 g_clear_error (&_inner_error_);
397 return;
398 }
399 }
400
401
402 static gpointer _g_object_ref0 (gpointer self) {
403 return self ? g_object_ref (self) : NULL;
404 }
405
406
407 static void _tracker_stats_on_response_gtk_dialog_response (GtkDialog* _sender, gint response_id, gpointer self) {
408 tracker_stats_on_response (self, _sender, response_id);
409 }
410
411
412 static void tracker_stats_setup_ui (TrackerStats* self) {
413 GtkBox* _tmp0_ = NULL;
414 GtkBox* _tmp1_;
415 GtkBox* vbox;
416 GtkBox* _tmp2_;
417 GtkBox* _tmp3_;
418 const gchar* _tmp4_ = NULL;
419 GtkLabel* _tmp5_;
420 GtkLabel* label;
421 GtkLabel* _tmp6_;
422 GtkLabel* _tmp7_;
423 GtkBox* _tmp8_;
424 GtkLabel* _tmp9_;
425 GtkSizeGroup* _tmp10_;
426 GtkSizeGroup* sizegroup;
427 GtkBox* _tmp114_;
428 GError * _inner_error_ = NULL;
429 g_return_if_fail (self != NULL);
430 g_debug ("tracker-stats.vala:63: Setting up statistics UI");
431 _tmp0_ = gtk_dialog_get_content_area ((GtkDialog*) self);
(emitted by gcc) 432 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GTK_TYPE_BOX) ? ((GtkBox*) _tmp0_) : NULL);
433 vbox = _tmp1_;
434 _tmp2_ = vbox;
435 gtk_box_set_spacing (_tmp2_, 18);
436 _tmp3_ = vbox;
437 gtk_container_set_border_width ((GtkContainer*) _tmp3_, (guint) 0);
438 _tmp4_ = _ ("The statistics represented here do not reflect their availability, rat" \
439 "her the total data stored:");
440 _tmp5_ = (GtkLabel*) gtk_label_new (_tmp4_);
441 g_object_ref_sink (_tmp5_);
442 label = _tmp5_;
443 _tmp6_ = label;
444 gtk_label_set_line_wrap (_tmp6_, TRUE);
445 _tmp7_ = label;
446 gtk_misc_set_alignment ((GtkMisc*) _tmp7_, 0.0f, 0.5f);
447 _tmp8_ = vbox;
448 _tmp9_ = label;
449 gtk_box_pack_start (_tmp8_, (GtkWidget*) _tmp9_, TRUE, TRUE, (guint) 0);
450 _tmp10_ = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
451 sizegroup = _tmp10_;
452 {
453 Statistics* _tmp11_;
454 gint _tmp12_ = 0;
455 gint _tmp13_ = 0;
456 gchar** _tmp14_ = NULL;
457 gchar** _result_;
458 gint _result__length1;
459 gint _result__length2;
460 _tmp11_ = self->priv->tracker;
461 _tmp14_ = statistics_Get (_tmp11_, &_tmp12_, &_tmp13_, &_inner_error_);
462 _result_ = _tmp14_;
463 _result__length1 = _tmp12_;
464 _result__length2 = _tmp13_;
465 if (_inner_error_ != NULL) {
466 if (_inner_error_->domain == G_DBUS_ERROR) {
467 goto __catch12_g_dbus_error;
468 }
469 _g_object_unref0 (sizegroup);
470 _g_object_unref0 (label);
471 _g_object_unref0 (vbox);
472 g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
473 g_clear_error (&_inner_error_);
474 return;
475 }
476 {
477 gint i;
478 i = 0;
479 {
480 gboolean _tmp15_;
481 _tmp15_ = TRUE;
482 while (TRUE) {
483 gboolean _tmp16_;
484 gint _tmp18_;
485 gchar** _tmp19_;
486 gint _tmp19__length1;
487 gint _tmp19__length2;
488 gint _tmp20_;
489 gchar** _tmp21_;
490 gint _tmp21__length1;
491 gint _tmp21__length2;
492 gint _tmp22_;
493 const gchar* _tmp23_;
494 gchar* _tmp24_;
495 gchar* key;
496 gchar** _tmp25_;
497 gint _tmp25__length1;
498 gint _tmp25__length2;
499 gint _tmp26_;
500 const gchar* _tmp27_;
501 gchar* _tmp28_;
502 gchar* val;
503 gchar* key_used = NULL;
504 const gchar* _tmp29_;
505 const gchar* _tmp30_;
506 const gchar* _tmp31_;
507 const gchar* _tmp32_;
508 GQuark _tmp34_ = 0U;
509 static GQuark _tmp33_label0 = 0;
510 static GQuark _tmp33_label1 = 0;
511 static GQuark _tmp33_label2 = 0;
512 static GQuark _tmp33_label3 = 0;
513 static GQuark _tmp33_label4 = 0;
514 static GQuark _tmp33_label5 = 0;
515 static GQuark _tmp33_label6 = 0;
516 static GQuark _tmp33_label7 = 0;
517 static GQuark _tmp33_label8 = 0;
518 static GQuark _tmp33_label9 = 0;
519 static GQuark _tmp33_label10 = 0;
520 static GQuark _tmp33_label11 = 0;
521 static GQuark _tmp33_label12 = 0;
522 static GQuark _tmp33_label13 = 0;
523 static GQuark _tmp33_label14 = 0;
524 GtkHBox* _tmp95_;
525 GtkHBox* hbox;
526 const gchar* _tmp96_;
527 GtkLabel* _tmp97_;
528 GtkLabel* label_key;
529 const gchar* _tmp98_;
530 GtkLabel* _tmp99_;
531 GtkLabel* label_val;
532 GtkLabel* _tmp100_;
533 GtkLabel* _tmp101_;
534 GtkHBox* _tmp102_;
535 GtkLabel* _tmp103_;
536 GtkHBox* _tmp104_;
537 GtkLabel* _tmp105_;
538 GtkSizeGroup* _tmp106_;
539 GtkLabel* _tmp107_;
540 GtkBox* _tmp108_;
541 GtkHBox* _tmp109_;
542 _tmp16_ = _tmp15_;
543 if (!_tmp16_) {
544 gint _tmp17_;
545 _tmp17_ = i;
546 i = _tmp17_ + 1;
547 }
548 _tmp15_ = FALSE;
549 _tmp18_ = i;
550 _tmp19_ = _result_;
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
551 _tmp19__length1 = _result__length1;
552 _tmp19__length2 = _result__length2;
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
553 _tmp20_ = _tmp19__length1;
554 if (!(_tmp18_ < _tmp20_)) {
555 break;
556 }
557 _tmp21_ = _result_;
558 _tmp21__length1 = _result__length1;
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
559 _tmp21__length2 = _result__length2;
560 _tmp22_ = i;
561 _tmp23_ = _tmp21_[(_tmp22_ * _tmp21__length2) + 0];
562 _tmp24_ = g_strdup (_tmp23_);
563 key = _tmp24_;
564 _tmp25_ = _result_;
565 _tmp25__length1 = _result__length1;
(emitted by clang-analyzer)TODO: a detailed trace is available in the data model (not yet rendered in this report)
566 _tmp25__length2 = _result__length2;
567 _tmp26_ = i;
568 _tmp27_ = _tmp25_[(_tmp26_ * _tmp25__length2) + 1];
569 _tmp28_ = g_strdup (_tmp27_);
570 val = _tmp28_;
571 _tmp29_ = key;
572 _tmp30_ = val;
573 g_debug ("tracker-stats.vala:87: --> %s = %s", _tmp29_, _tmp30_);
574 _tmp31_ = key;
575 _tmp32_ = _tmp31_;
576 _tmp34_ = (NULL == _tmp32_) ? 0 : g_quark_from_string (_tmp32_);
577 if (_tmp34_ == ((0 != _tmp33_label0) ? _tmp33_label0 : (_tmp33_label0 = g_quark_from_static_string ("nao:Tag")))) {
578 switch (0) {
579 default:
580 {
581 const gchar* _tmp35_;
582 gint _tmp36_ = 0;
583 const gchar* _tmp37_ = NULL;
584 gchar* _tmp38_;
585 _tmp35_ = val;
586 _tmp36_ = atoi (_tmp35_);
587 _tmp37_ = ngettext ("Tag", "Tags", (gulong) _tmp36_);
588 _tmp38_ = g_strdup (_tmp37_);
589 _g_free0 (key_used);
590 key_used = _tmp38_;
591 break;
592 }
593 }
594 } else if (_tmp34_ == ((0 != _tmp33_label1) ? _tmp33_label1 : (_tmp33_label1 = g_quark_from_static_string ("nco:Contact")))) {
595 switch (0) {
596 default:
597 {
598 const gchar* _tmp39_;
599 gint _tmp40_ = 0;
600 const gchar* _tmp41_ = NULL;
601 gchar* _tmp42_;
602 _tmp39_ = val;
603 _tmp40_ = atoi (_tmp39_);
604 _tmp41_ = ngettext ("Contact", "Contacts", (gulong) _tmp40_);
605 _tmp42_ = g_strdup (_tmp41_);
606 _g_free0 (key_used);
607 key_used = _tmp42_;
608 break;
609 }
610 }
611 } else if (_tmp34_ == ((0 != _tmp33_label2) ? _tmp33_label2 : (_tmp33_label2 = g_quark_from_static_string ("nfo:Audio")))) {
612 switch (0) {
613 default:
614 {
615 const gchar* _tmp43_;
616 gint _tmp44_ = 0;
617 const gchar* _tmp45_ = NULL;
618 gchar* _tmp46_;
619 _tmp43_ = val;
620 _tmp44_ = atoi (_tmp43_);
621 _tmp45_ = ngettext ("Audio", "Audios", (gulong) _tmp44_);
622 _tmp46_ = g_strdup (_tmp45_);
623 _g_free0 (key_used);
624 key_used = _tmp46_;
625 break;
626 }
627 }
628 } else if (_tmp34_ == ((0 != _tmp33_label3) ? _tmp33_label3 : (_tmp33_label3 = g_quark_from_static_string ("nfo:Document")))) {
629 switch (0) {
630 default:
631 {
632 const gchar* _tmp47_;
633 gint _tmp48_ = 0;
634 const gchar* _tmp49_ = NULL;
635 gchar* _tmp50_;
636 _tmp47_ = val;
637 _tmp48_ = atoi (_tmp47_);
638 _tmp49_ = ngettext ("Document", "Documents", (gulong) _tmp48_);
639 _tmp50_ = g_strdup (_tmp49_);
640 _g_free0 (key_used);
641 key_used = _tmp50_;
642 break;
643 }
644 }
645 } else if (_tmp34_ == ((0 != _tmp33_label4) ? _tmp33_label4 : (_tmp33_label4 = g_quark_from_static_string ("nfo:FileDataObject")))) {
646 switch (0) {
647 default:
648 {
649 const gchar* _tmp51_;
650 gint _tmp52_ = 0;
651 const gchar* _tmp53_ = NULL;
652 gchar* _tmp54_;
653 _tmp51_ = val;
654 _tmp52_ = atoi (_tmp51_);
655 _tmp53_ = ngettext ("File", "Files", (gulong) _tmp52_);
656 _tmp54_ = g_strdup (_tmp53_);
657 _g_free0 (key_used);
658 key_used = _tmp54_;
659 break;
660 }
661 }
662 } else if (_tmp34_ == ((0 != _tmp33_label5) ? _tmp33_label5 : (_tmp33_label5 = g_quark_from_static_string ("nfo:Folder")))) {
663 switch (0) {
664 default:
665 {
666 const gchar* _tmp55_;
667 gint _tmp56_ = 0;
668 const gchar* _tmp57_ = NULL;
669 gchar* _tmp58_;
670 _tmp55_ = val;
671 _tmp56_ = atoi (_tmp55_);
672 _tmp57_ = ngettext ("Folder", "Folders", (gulong) _tmp56_);
673 _tmp58_ = g_strdup (_tmp57_);
674 _g_free0 (key_used);
675 key_used = _tmp58_;
676 break;
677 }
678 }
679 } else if (_tmp34_ == ((0 != _tmp33_label6) ? _tmp33_label6 : (_tmp33_label6 = g_quark_from_static_string ("nfo:Image")))) {
680 switch (0) {
681 default:
682 {
683 const gchar* _tmp59_;
684 gint _tmp60_ = 0;
685 const gchar* _tmp61_ = NULL;
686 gchar* _tmp62_;
687 _tmp59_ = val;
688 _tmp60_ = atoi (_tmp59_);
689 _tmp61_ = ngettext ("Image", "Images", (gulong) _tmp60_);
690 _tmp62_ = g_strdup (_tmp61_);
691 _g_free0 (key_used);
692 key_used = _tmp62_;
693 break;
694 }
695 }
696 } else if (_tmp34_ == ((0 != _tmp33_label7) ? _tmp33_label7 : (_tmp33_label7 = g_quark_from_static_string ("nfo:SoftwareApplication")))) {
697 switch (0) {
698 default:
699 {
700 const gchar* _tmp63_;
701 gint _tmp64_ = 0;
702 const gchar* _tmp65_ = NULL;
703 gchar* _tmp66_;
704 _tmp63_ = val;
705 _tmp64_ = atoi (_tmp63_);
706 _tmp65_ = ngettext ("Application", "Applications", (gulong) _tmp64_);
707 _tmp66_ = g_strdup (_tmp65_);
708 _g_free0 (key_used);
709 key_used = _tmp66_;
710 break;
711 }
712 }
713 } else if (_tmp34_ == ((0 != _tmp33_label8) ? _tmp33_label8 : (_tmp33_label8 = g_quark_from_static_string ("nfo:Video")))) {
714 switch (0) {
715 default:
716 {
717 const gchar* _tmp67_;
718 gint _tmp68_ = 0;
719 const gchar* _tmp69_ = NULL;
720 gchar* _tmp70_;
721 _tmp67_ = val;
722 _tmp68_ = atoi (_tmp67_);
723 _tmp69_ = ngettext ("Video", "Videos", (gulong) _tmp68_);
724 _tmp70_ = g_strdup (_tmp69_);
725 _g_free0 (key_used);
726 key_used = _tmp70_;
727 break;
728 }
729 }
730 } else if (_tmp34_ == ((0 != _tmp33_label9) ? _tmp33_label9 : (_tmp33_label9 = g_quark_from_static_string ("nmm:MusicAlbum")))) {
731 switch (0) {
732 default:
733 {
734 const gchar* _tmp71_;
735 gint _tmp72_ = 0;
736 const gchar* _tmp73_ = NULL;
737 gchar* _tmp74_;
738 _tmp71_ = val;
739 _tmp72_ = atoi (_tmp71_);
740 _tmp73_ = ngettext ("Album", "Albums", (gulong) _tmp72_);
741 _tmp74_ = g_strdup (_tmp73_);
742 _g_free0 (key_used);
743 key_used = _tmp74_;
744 break;
745 }
746 }
747 } else if (_tmp34_ == ((0 != _tmp33_label10) ? _tmp33_label10 : (_tmp33_label10 = g_quark_from_static_string ("nmm:MusicPiece")))) {
748 switch (0) {
749 default:
750 {
751 const gchar* _tmp75_;
752 gint _tmp76_ = 0;
753 const gchar* _tmp77_ = NULL;
754 gchar* _tmp78_;
755 _tmp75_ = val;
756 _tmp76_ = atoi (_tmp75_);
757 _tmp77_ = ngettext ("Music Track", "Music Tracks", (gulong) _tmp76_);
758 _tmp78_ = g_strdup (_tmp77_);
759 _g_free0 (key_used);
760 key_used = _tmp78_;
761 break;
762 }
763 }
764 } else if (_tmp34_ == ((0 != _tmp33_label11) ? _tmp33_label11 : (_tmp33_label11 = g_quark_from_static_string ("nmm:Photo")))) {
765 switch (0) {
766 default:
767 {
768 const gchar* _tmp79_;
769 gint _tmp80_ = 0;
770 const gchar* _tmp81_ = NULL;
771 gchar* _tmp82_;
772 _tmp79_ = val;
773 _tmp80_ = atoi (_tmp79_);
774 _tmp81_ = ngettext ("Photo", "Photos", (gulong) _tmp80_);
775 _tmp82_ = g_strdup (_tmp81_);
776 _g_free0 (key_used);
777 key_used = _tmp82_;
778 break;
779 }
780 }
781 } else if (_tmp34_ == ((0 != _tmp33_label12) ? _tmp33_label12 : (_tmp33_label12 = g_quark_from_static_string ("nmm:Playlist")))) {
782 switch (0) {
783 default:
784 {
785 const gchar* _tmp83_;
786 gint _tmp84_ = 0;
787 const gchar* _tmp85_ = NULL;
788 gchar* _tmp86_;
789 _tmp83_ = val;
790 _tmp84_ = atoi (_tmp83_);
791 _tmp85_ = ngettext ("Playlist", "Playlists", (gulong) _tmp84_);
792 _tmp86_ = g_strdup (_tmp85_);
793 _g_free0 (key_used);
794 key_used = _tmp86_;
795 break;
796 }
797 }
798 } else if (_tmp34_ == ((0 != _tmp33_label13) ? _tmp33_label13 : (_tmp33_label13 = g_quark_from_static_string ("nmo:Email")))) {
799 switch (0) {
800 default:
801 {
802 const gchar* _tmp87_;
803 gint _tmp88_ = 0;
804 const gchar* _tmp89_ = NULL;
805 gchar* _tmp90_;
806 _tmp87_ = val;
807 _tmp88_ = atoi (_tmp87_);
808 _tmp89_ = ngettext ("Email", "Emails", (gulong) _tmp88_);
809 _tmp90_ = g_strdup (_tmp89_);
810 _g_free0 (key_used);
811 key_used = _tmp90_;
812 break;
813 }
814 }
815 } else if (_tmp34_ == ((0 != _tmp33_label14) ? _tmp33_label14 : (_tmp33_label14 = g_quark_from_static_string ("nfo:Bookmark")))) {
816 switch (0) {
817 default:
818 {
819 const gchar* _tmp91_;
820 gint _tmp92_ = 0;
821 const gchar* _tmp93_ = NULL;
822 gchar* _tmp94_;
823 _tmp91_ = val;
824 _tmp92_ = atoi (_tmp91_);
825 _tmp93_ = ngettext ("Bookmark", "Bookmarks", (gulong) _tmp92_);
826 _tmp94_ = g_strdup (_tmp93_);
827 _g_free0 (key_used);
828 key_used = _tmp94_;
829 break;
830 }
831 }
832 } else {
833 switch (0) {
834 default:
835 {
836 continue;
837 }
838 }
839 }
840 _tmp95_ = (GtkHBox*) gtk_hbox_new (FALSE, 12);
841 g_object_ref_sink (_tmp95_);
842 hbox = _tmp95_;
843 _tmp96_ = key_used;
844 _tmp97_ = (GtkLabel*) gtk_label_new (_tmp96_);
845 g_object_ref_sink (_tmp97_);
846 label_key = _tmp97_;
847 _tmp98_ = val;
848 _tmp99_ = (GtkLabel*) gtk_label_new (_tmp98_);
849 g_object_ref_sink (_tmp99_);
850 label_val = _tmp99_;
851 _tmp100_ = label_key;
852 gtk_misc_set_alignment ((GtkMisc*) _tmp100_, 0.0f, 0.5f);
853 _tmp101_ = label_val;
854 gtk_misc_set_alignment ((GtkMisc*) _tmp101_, 0.0f, 0.5f);
855 _tmp102_ = hbox;
856 _tmp103_ = label_key;
857 gtk_box_pack_start ((GtkBox*) _tmp102_, (GtkWidget*) _tmp103_, TRUE, TRUE, (guint) 0);
858 _tmp104_ = hbox;
859 _tmp105_ = label_val;
860 gtk_box_pack_start ((GtkBox*) _tmp104_, (GtkWidget*) _tmp105_, FALSE, TRUE, (guint) 0);
861 _tmp106_ = sizegroup;
862 _tmp107_ = label_key;
863 gtk_size_group_add_widget (_tmp106_, (GtkWidget*) _tmp107_);
864 _tmp108_ = vbox;
865 _tmp109_ = hbox;
866 gtk_box_pack_start (_tmp108_, (GtkWidget*) _tmp109_, TRUE, TRUE, (guint) 0);
867 _g_object_unref0 (label_val);
868 _g_object_unref0 (label_key);
869 _g_object_unref0 (hbox);
870 _g_free0 (key_used);
871 _g_free0 (val);
872 _g_free0 (key);
873 }
874 }
875 }
876 _result_ = (_vala_array_free (_result_, _result__length1 * _result__length2, (GDestroyNotify) g_free), NULL);
877 }
878 goto __finally12;
879 __catch12_g_dbus_error:
880 {
881 GError* e = NULL;
882 GError* _tmp110_;
883 const gchar* _tmp111_;
884 gchar* _tmp112_;
885 gchar* _tmp113_;
886 e = _inner_error_;
887 _inner_error_ = NULL;
888 _tmp110_ = e;
889 _tmp111_ = _tmp110_->message;
890 _tmp112_ = g_strconcat ("Could not get Tracker statistics: ", _tmp111_, NULL);
891 _tmp113_ = _tmp112_;
892 g_warning ("tracker-stats.vala:155: %s", _tmp113_);
893 _g_free0 (_tmp113_);
894 _g_error_free0 (e);
895 }
896 __finally12:
897 if (_inner_error_ != NULL) {
898 _g_object_unref0 (sizegroup);
899 _g_object_unref0 (label);
900 _g_object_unref0 (vbox);
901 g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
902 g_clear_error (&_inner_error_);
903 return;
904 }
905 _tmp114_ = vbox;
906 gtk_box_set_spacing (_tmp114_, 10);
907 gtk_dialog_add_button ((GtkDialog*) self, GTK_STOCK_CLOSE, (gint) GTK_RESPONSE_CLOSE);
908 g_signal_connect_object ((GtkDialog*) self, "response", (GCallback) _tracker_stats_on_response_gtk_dialog_response, self, 0);
909 gtk_widget_show_all ((GtkWidget*) self);
910 _g_object_unref0 (sizegroup);
911 _g_object_unref0 (label);
912 _g_object_unref0 (vbox);
913 }
914
915
916 static void tracker_stats_on_response (TrackerStats* self, GtkDialog* source, gint response_id) {
917 gint _tmp0_;
918 g_return_if_fail (self != NULL);
919 g_return_if_fail (source != NULL);
920 _tmp0_ = response_id;
921 switch (_tmp0_) {
922 case GTK_RESPONSE_CLOSE:
923 {
924 gtk_widget_destroy ((GtkWidget*) self);
925 break;
926 }
927 default:
928 break;
929 }
930 }
931
932
933 static void tracker_stats_class_init (TrackerStatsClass * klass) {
934 tracker_stats_parent_class = g_type_class_peek_parent (klass);
935 g_type_class_add_private (klass, sizeof (TrackerStatsPrivate));
936 G_OBJECT_CLASS (klass)->finalize = tracker_stats_finalize;
937 }
938
939
940 static void tracker_stats_instance_init (TrackerStats * self) {
941 self->priv = TRACKER_STATS_GET_PRIVATE (self);
942 }
943
944
945 static void tracker_stats_finalize (GObject* obj) {
946 TrackerStats * self;
947 self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRACKER_TYPE_STATS, TrackerStats);
948 _g_object_unref0 (self->priv->tracker);
949 G_OBJECT_CLASS (tracker_stats_parent_class)->finalize (obj);
950 }
951
952
953 GType tracker_stats_get_type (void) {
954 static volatile gsize tracker_stats_type_id__volatile = 0;
955 if (g_once_init_enter (&tracker_stats_type_id__volatile)) {
956 static const GTypeInfo g_define_type_info = { sizeof (TrackerStatsClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_stats_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerStats), 0, (GInstanceInitFunc) tracker_stats_instance_init, NULL };
957 GType tracker_stats_type_id;
958 tracker_stats_type_id = g_type_register_static (GTK_TYPE_DIALOG, "TrackerStats", &g_define_type_info, 0);
959 g_once_init_leave (&tracker_stats_type_id__volatile, tracker_stats_type_id);
960 }
961 return tracker_stats_type_id__volatile;
962 }
963
964
965 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
966 if ((array != NULL) && (destroy_func != NULL)) {
967 int i;
968 for (i = 0; i < array_length; i = i + 1) {
969 if (((gpointer*) array)[i] != NULL) {
970 destroy_func (((gpointer*) array)[i]);
971 }
972 }
973 }
974 }
975
976
977 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
978 _vala_array_destroy (array, array_length, destroy_func);
979 g_free (array);
980 }