1 /* tracker-needle.c generated by valac 0.18.1, the Vala compiler
2 * generated from tracker-needle.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 <gtk/gtk.h>
26 #include <stdlib.h>
27 #include <string.h>
28 #include <glib/gi18n-lib.h>
29 #include <gdk/gdk.h>
30 #include "config.h"
31 #include <gobject/gvaluecollector.h>
32
33
34 #define TRACKER_TYPE_NEEDLE (tracker_needle_get_type ())
35 #define TRACKER_NEEDLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_NEEDLE, TrackerNeedle))
36 #define TRACKER_NEEDLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_NEEDLE, TrackerNeedleClass))
37 #define TRACKER_IS_NEEDLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_NEEDLE))
38 #define TRACKER_IS_NEEDLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_NEEDLE))
39 #define TRACKER_NEEDLE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_NEEDLE, TrackerNeedleClass))
40
41 typedef struct _TrackerNeedle TrackerNeedle;
42 typedef struct _TrackerNeedleClass TrackerNeedleClass;
43 typedef struct _TrackerNeedlePrivate TrackerNeedlePrivate;
44
45 #define TRACKER_TYPE_HISTORY (tracker_history_get_type ())
46 #define TRACKER_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_HISTORY, TrackerHistory))
47 #define TRACKER_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_HISTORY, TrackerHistoryClass))
48 #define TRACKER_IS_HISTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_HISTORY))
49 #define TRACKER_IS_HISTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_HISTORY))
50 #define TRACKER_HISTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_HISTORY, TrackerHistoryClass))
51
52 typedef struct _TrackerHistory TrackerHistory;
53 typedef struct _TrackerHistoryClass TrackerHistoryClass;
54
55 #define TRACKER_TYPE_VIEW (tracker_view_get_type ())
56 #define TRACKER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_VIEW, TrackerView))
57 #define TRACKER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_VIEW, TrackerViewClass))
58 #define TRACKER_IS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_VIEW))
59 #define TRACKER_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_VIEW))
60 #define TRACKER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_VIEW, TrackerViewClass))
61
62 typedef struct _TrackerView TrackerView;
63 typedef struct _TrackerViewClass TrackerViewClass;
64
65 #define TYPE_TRACKER_TAGS_VIEW (tracker_tags_view_get_type ())
66 #define TRACKER_TAGS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_TRACKER_TAGS_VIEW, TrackerTagsView))
67 #define TRACKER_TAGS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_TRACKER_TAGS_VIEW, TrackerTagsViewClass))
68 #define IS_TRACKER_TAGS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_TRACKER_TAGS_VIEW))
69 #define IS_TRACKER_TAGS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_TRACKER_TAGS_VIEW))
70 #define TRACKER_TAGS_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_TRACKER_TAGS_VIEW, TrackerTagsViewClass))
71
72 typedef struct _TrackerTagsView TrackerTagsView;
73 typedef struct _TrackerTagsViewClass TrackerTagsViewClass;
74
75 #define TRACKER_TYPE_RESULT_STORE (tracker_result_store_get_type ())
76 #define TRACKER_RESULT_STORE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_RESULT_STORE, TrackerResultStore))
77 #define TRACKER_RESULT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_RESULT_STORE, TrackerResultStoreClass))
78 #define TRACKER_IS_RESULT_STORE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_RESULT_STORE))
79 #define TRACKER_IS_RESULT_STORE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_RESULT_STORE))
80 #define TRACKER_RESULT_STORE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_RESULT_STORE, TrackerResultStoreClass))
81
82 typedef struct _TrackerResultStore TrackerResultStore;
83 typedef struct _TrackerResultStoreClass TrackerResultStoreClass;
84 #define _tracker_history_unref0(var) ((var == NULL) ? NULL : (var = (tracker_history_unref (var), NULL)))
85 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
86 #define _g_free0(var) (var = (g_free (var), NULL))
87
88 #define TRACKER_QUERY_TYPE_TYPE (tracker_query_type_get_type ())
89
90 #define TRACKER_QUERY_TYPE_MATCH (tracker_query_match_get_type ())
91 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
92
93 #define TRACKER_VIEW_TYPE_DISPLAY (tracker_view_display_get_type ())
94 #define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))
95 #define __g_list_free__gtk_tree_path_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__gtk_tree_path_free0_ (var), NULL)))
96 #define _gtk_tree_path_free0(var) ((var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL)))
97 typedef struct _Block4Data Block4Data;
98 #define _tracker_needle_unref0(var) ((var == NULL) ? NULL : (var = (tracker_needle_unref (var), NULL)))
99
100 #define TRACKER_TYPE_STATS (tracker_stats_get_type ())
101 #define TRACKER_STATS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TRACKER_TYPE_STATS, TrackerStats))
102 #define TRACKER_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TRACKER_TYPE_STATS, TrackerStatsClass))
103 #define TRACKER_IS_STATS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TRACKER_TYPE_STATS))
104 #define TRACKER_IS_STATS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TRACKER_TYPE_STATS))
105 #define TRACKER_STATS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TRACKER_TYPE_STATS, TrackerStatsClass))
106
107 typedef struct _TrackerStats TrackerStats;
108 typedef struct _TrackerStatsClass TrackerStatsClass;
109 typedef struct _TrackerParamSpecNeedle TrackerParamSpecNeedle;
110 #define _g_option_context_free0(var) ((var == NULL) ? NULL : (var = (g_option_context_free (var), NULL)))
111
112 struct _TrackerNeedle {
113 GTypeInstance parent_instance;
114 volatile int ref_count;
115 TrackerNeedlePrivate * priv;
116 };
117
118 struct _TrackerNeedleClass {
119 GTypeClass parent_class;
120 void (*finalize) (TrackerNeedle *self);
121 };
122
123 struct _TrackerNeedlePrivate {
124 TrackerHistory* history;
125 GtkWindow* window;
126 GtkToggleToolButton* view_categories;
127 GtkToggleToolButton* view_filelist;
128 GtkToggleToolButton* view_icons;
129 GtkSeparatorToolItem* separator_secondary;
130 GtkToggleToolButton* find_in_contents;
131 GtkToggleToolButton* find_in_titles;
132 GtkToggleToolButton* find_in_all;
133 GtkToolItem* search_entry;
134 GtkComboBox* search_list;
135 GtkEntry* search;
136 GtkSpinner* spinner;
137 GtkToolItem* spinner_shell;
138 GtkToggleToolButton* show_tags;
139 GtkToolButton* show_stats;
140 GtkHBox* view;
141 TrackerView* sw_noresults;
142 TrackerView* sw_categories;
143 TrackerView* sw_filelist;
144 TrackerView* sw_icons;
145 GtkInfoBar* info_bar;
146 GtkLabel* info_bar_label;
147 TrackerTagsView* tags_view;
148 guint last_search_id;
149 gint size_small;
150 gint size_medium;
151 gint size_big;
152 guint limit;
153 TrackerResultStore* categories_model;
154 TrackerResultStore* files_model;
155 TrackerResultStore* files_in_title_model;
156 TrackerResultStore* images_model;
157 TrackerResultStore* images_in_title_model;
158 };
159
160 typedef enum {
161 TRACKER_QUERY_TYPE_ALL,
162 TRACKER_QUERY_TYPE_CONTACTS,
163 TRACKER_QUERY_TYPE_APPLICATIONS,
164 TRACKER_QUERY_TYPE_MUSIC,
165 TRACKER_QUERY_TYPE_IMAGES,
166 TRACKER_QUERY_TYPE_VIDEOS,
167 TRACKER_QUERY_TYPE_DOCUMENTS,
168 TRACKER_QUERY_TYPE_MAIL,
169 TRACKER_QUERY_TYPE_CALENDAR,
170 TRACKER_QUERY_TYPE_FOLDERS,
171 TRACKER_QUERY_TYPE_BOOKMARKS
172 } TrackerQueryType;
173
174 typedef enum {
175 TRACKER_QUERY_MATCH_NONE,
176 TRACKER_QUERY_MATCH_FTS,
177 TRACKER_QUERY_MATCH_FTS_INDIRECT,
178 TRACKER_QUERY_MATCH_TITLES,
179 TRACKER_QUERY_MATCH_TITLES_INDIRECT,
180 TRACKER_QUERY_MATCH_TAGS_ONLY,
181 TRACKER_QUERY_MATCH_TAGS_ONLY_INDIRECT
182 } TrackerQueryMatch;
183
184 typedef enum {
185 TRACKER_VIEW_DISPLAY_NO_RESULTS,
186 TRACKER_VIEW_DISPLAY_CATEGORIES,
187 TRACKER_VIEW_DISPLAY_FILE_LIST,
188 TRACKER_VIEW_DISPLAY_FILE_ICONS
189 } TrackerViewDisplay;
190
191 struct _Block4Data {
192 int _ref_count_;
193 TrackerNeedle * self;
194 GtkTreeModel* model;
195 GList* uris;
196 };
197
198 struct _TrackerParamSpecNeedle {
199 GParamSpec parent_instance;
200 };
201
202
203 static gpointer tracker_needle_parent_class = NULL;
204 static gboolean tracker_needle_current_find_in_filelist;
205 static gboolean tracker_needle_current_find_in_filelist = TRUE;
206 static gboolean tracker_needle_current_find_in_icons;
207 static gboolean tracker_needle_current_find_in_icons = TRUE;
208 extern gboolean print_version;
209 gboolean print_version = FALSE;
210 extern gchar** search_criteria;
211 gchar** search_criteria = NULL;
212
213 gpointer tracker_needle_ref (gpointer instance);
214 void tracker_needle_unref (gpointer instance);
215 GParamSpec* tracker_param_spec_needle (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
216 void tracker_value_set_needle (GValue* value, gpointer v_object);
217 void tracker_value_take_needle (GValue* value, gpointer v_object);
218 gpointer tracker_value_get_needle (const GValue* value);
219 GType tracker_needle_get_type (void) G_GNUC_CONST;
220 gpointer tracker_history_ref (gpointer instance);
221 void tracker_history_unref (gpointer instance);
222 GParamSpec* tracker_param_spec_history (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
223 void tracker_value_set_history (GValue* value, gpointer v_object);
224 void tracker_value_take_history (GValue* value, gpointer v_object);
225 gpointer tracker_value_get_history (const GValue* value);
226 GType tracker_history_get_type (void) G_GNUC_CONST;
227 GType tracker_view_get_type (void) G_GNUC_CONST;
228 GType tracker_tags_view_get_type (void) G_GNUC_CONST;
229 GType tracker_result_store_get_type (void) G_GNUC_CONST;
230 #define TRACKER_NEEDLE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TRACKER_TYPE_NEEDLE, TrackerNeedlePrivate))
231 enum {
232 TRACKER_NEEDLE_DUMMY_PROPERTY
233 };
234 #define TRACKER_NEEDLE_UI_FILE "tracker-needle.ui"
235 static void tracker_needle_result_overflow (TrackerNeedle* self);
236 void tracker_needle_show_info_message (TrackerNeedle* self, const gchar* message, GtkMessageType type);
237 static void tracker_needle_create_models (TrackerNeedle* self);
238 TrackerResultStore* tracker_result_store_new (gint _n_columns);
239 TrackerResultStore* tracker_result_store_construct (GType object_type, gint _n_columns);
240 void tracker_result_store_set_limit (TrackerResultStore* self, guint value);
241 static void _tracker_needle_result_overflow_tracker_result_store_result_overflow (TrackerResultStore* _sender, gpointer self);
242 GType tracker_query_type_get_type (void) G_GNUC_CONST;
243 GType tracker_query_match_get_type (void) G_GNUC_CONST;
244 void tracker_result_store_add_query (TrackerResultStore* self, TrackerQueryType type, TrackerQueryMatch match, ...);
245 void tracker_result_store_set_icon_size (TrackerResultStore* self, gint value);
246 TrackerNeedle* tracker_needle_new (void);
247 TrackerNeedle* tracker_needle_construct (GType object_type);
248 TrackerHistory* tracker_history_new (void);
249 TrackerHistory* tracker_history_construct (GType object_type);
250 void tracker_needle_show (TrackerNeedle* self);
251 static void tracker_needle_setup_ui (TrackerNeedle* self);
252 void tracker_needle_set_search (TrackerNeedle* self, gchar** args, int args_length1);
253 static void tracker_needle_store_state_changed (TrackerNeedle* self, GObject* object, GParamSpec* p);
254 gboolean tracker_result_store_get_active (TrackerResultStore* self);
255 static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self);
256 static gboolean tracker_needle_window_key_press_event (TrackerNeedle* self, GtkWidget* widget, GdkEventKey* event);
257 static gboolean _tracker_needle_window_key_press_event_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self);
258 static void tracker_needle_info_bar_closed (TrackerNeedle* self, GtkButton* source);
259 static void _tracker_needle_info_bar_closed_gtk_button_clicked (GtkButton* _sender, gpointer self);
260 static void tracker_needle_view_toggled (TrackerNeedle* self);
261 static void _tracker_needle_view_toggled_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self);
262 static void tracker_needle_find_in_toggled (TrackerNeedle* self);
263 static void _tracker_needle_find_in_toggled_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self);
264 static void tracker_needle_search_changed (TrackerNeedle* self, GtkEditable* editable);
265 static void _tracker_needle_search_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self);
266 static void tracker_needle_search_activated (TrackerNeedle* self, GtkEntry* entry);
267 static void _tracker_needle_search_activated_gtk_entry_activate (GtkEntry* _sender, gpointer self);
268 static void tracker_needle_search_history_insert (TrackerNeedle* self, gchar** history, int history_length1);
269 gchar** tracker_history_get (TrackerHistory* self, int* result_length1);
270 static void tracker_needle_show_tags_clicked (TrackerNeedle* self);
271 static void _tracker_needle_show_tags_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
272 static void tracker_needle_show_stats_clicked (TrackerNeedle* self);
273 static void _tracker_needle_show_stats_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self);
274 GType tracker_view_display_get_type (void) G_GNUC_CONST;
275 TrackerView* tracker_view_new (TrackerViewDisplay* _display, TrackerResultStore* store);
276 TrackerView* tracker_view_construct (GType object_type, TrackerViewDisplay* _display, TrackerResultStore* store);
277 TrackerResultStore* tracker_view_get_store (TrackerView* self);
278 static void _tracker_needle_store_state_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self);
279 static void tracker_needle_view_row_activated (TrackerNeedle* self, GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn* column);
280 static void _tracker_needle_view_row_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self);
281 static void tracker_needle_view_row_selected (TrackerNeedle* self, GtkTreeSelection* selection);
282 static void _tracker_needle_view_row_selected_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self);
283 static void tracker_needle_icon_item_activated (TrackerNeedle* self, GtkIconView* view, GtkTreePath* path);
284 static void _tracker_needle_icon_item_activated_gtk_icon_view_item_activated (GtkIconView* _sender, GtkTreePath* path, gpointer self);
285 static void tracker_needle_icon_view_selection_changed (TrackerNeedle* self);
286 static void _tracker_needle_icon_view_selection_changed_gtk_icon_view_selection_changed (GtkIconView* _sender, gpointer self);
287 TrackerTagsView* tracker_tags_view_new (GList* _files);
288 TrackerTagsView* tracker_tags_view_construct (GType object_type, GList* _files);
289 void tracker_tags_view_hide_label (TrackerTagsView* self);
290 static gboolean tracker_needle_search_run (TrackerNeedle* self);
291 static gboolean _tracker_needle_search_run_gsource_func (gpointer self);
292 static void tracker_needle_search_finished (TrackerNeedle* self, TrackerResultStore* store);
293 gboolean tracker_result_store_has_results (TrackerResultStore* self);
294 static GtkTreeIter* tracker_needle_search_history_find_or_insert (TrackerNeedle* self, const gchar* criteria, gboolean* add_to_model);
295 static GtkTreeIter* _gtk_tree_iter_dup (GtkTreeIter* self);
296 void tracker_history_add (TrackerHistory* self, const gchar* criteria);
297 void tracker_view_set_store (TrackerView* self, TrackerResultStore* value);
298 void tracker_result_store_set_search_tags (TrackerResultStore* self, GPtrArray* value);
299 void tracker_result_store_set_search_term (TrackerResultStore* self, const gchar* value);
300 void tracker_model_launch_selected (GtkTreeModel* model, GtkTreePath* path, gint col);
301 static void _g_free0_ (gpointer var);
302 static void _g_list_free__g_free0_ (GList* self);
303 static void _gtk_tree_path_free0_ (gpointer var);
304 static void _g_list_free__gtk_tree_path_free0_ (GList* self);
305 void tracker_tags_view_set_files (TrackerTagsView* self, GList* _files);
306 static Block4Data* block4_data_ref (Block4Data* _data4_);
307 static void block4_data_unref (void * _userdata_);
308 static void __lambda6_ (Block4Data* _data4_, GtkIconView* iconview, GtkTreePath* path);
309 static void ___lambda6__gtk_icon_view_foreach_func (GtkIconView* icon_view, GtkTreePath* path, gpointer self);
310 TrackerStats* tracker_stats_new (void);
311 TrackerStats* tracker_stats_construct (GType object_type);
312 GType tracker_stats_get_type (void) G_GNUC_CONST;
313 static void tracker_needle_finalize (TrackerNeedle* obj);
314 gint _vala_main (gchar** args, int args_length1);
315 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
316 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
317 static gint _vala_array_length (gpointer array);
318
319 const GOptionEntry options[3] = {{"version", 'V', 0, G_OPTION_ARG_NONE, &print_version, "Print version", NULL}, {"", (gchar) 0, 0, G_OPTION_ARG_STRING_ARRAY, &search_criteria, "[SEARCH-CRITERIA]", "[SEARCH-CRITERIA]"}, {NULL}};
320
321 static void tracker_needle_result_overflow (TrackerNeedle* self) {
322 const gchar* _tmp0_ = NULL;
323 const gchar* _tmp1_ = NULL;
324 gchar* _tmp2_ = NULL;
325 gchar* str;
326 g_return_if_fail (self != NULL);
327 _tmp0_ = _ ("Search criteria was too generic");
328 _tmp1_ = _ ("Only the first 500 items will be displayed");
329 _tmp2_ = g_strdup_printf ("%s\n<small>%s</small>", _tmp0_, _tmp1_);
330 str = _tmp2_;
331 tracker_needle_show_info_message (self, str, GTK_MESSAGE_INFO);
332 _g_free0 (str);
333 }
334
335
336 static void _tracker_needle_result_overflow_tracker_result_store_result_overflow (TrackerResultStore* _sender, gpointer self) {
337 tracker_needle_result_overflow (self);
338 }
339
340
341 static void tracker_needle_create_models (TrackerNeedle* self) {
342 TrackerResultStore* _tmp0_;
343 TrackerResultStore* _tmp1_;
344 guint _tmp2_;
345 TrackerResultStore* _tmp3_;
346 TrackerResultStore* _tmp4_;
347 TrackerResultStore* _tmp5_;
348 TrackerResultStore* _tmp6_;
349 TrackerResultStore* _tmp7_;
350 TrackerResultStore* _tmp8_;
351 TrackerResultStore* _tmp9_;
352 TrackerResultStore* _tmp10_;
353 TrackerResultStore* _tmp11_;
354 TrackerResultStore* _tmp12_;
355 TrackerResultStore* _tmp13_;
356 guint _tmp14_;
357 TrackerResultStore* _tmp15_;
358 TrackerResultStore* _tmp16_;
359 TrackerResultStore* _tmp17_;
360 TrackerResultStore* _tmp18_;
361 guint _tmp19_;
362 TrackerResultStore* _tmp20_;
363 TrackerResultStore* _tmp21_;
364 TrackerResultStore* _tmp22_;
365 TrackerResultStore* _tmp23_;
366 guint _tmp24_;
367 TrackerResultStore* _tmp25_;
368 TrackerResultStore* _tmp26_;
369 TrackerResultStore* _tmp27_;
370 TrackerResultStore* _tmp28_;
371 TrackerResultStore* _tmp29_;
372 guint _tmp30_;
373 TrackerResultStore* _tmp31_;
374 TrackerResultStore* _tmp32_;
375 TrackerResultStore* _tmp33_;
376 g_return_if_fail (self != NULL);
377 _tmp0_ = tracker_result_store_new (6);
378 _g_object_unref0 (self->priv->categories_model);
379 self->priv->categories_model = _tmp0_;
380 _tmp1_ = self->priv->categories_model;
381 _tmp2_ = self->priv->limit;
382 tracker_result_store_set_limit (_tmp1_, _tmp2_);
383 _tmp3_ = self->priv->categories_model;
384 g_signal_connect (_tmp3_, "result-overflow", (GCallback) _tracker_needle_result_overflow_tracker_result_store_result_overflow, self);
385 _tmp4_ = self->priv->categories_model;
386 tracker_result_store_add_query (_tmp4_, TRACKER_QUERY_TYPE_APPLICATIONS, TRACKER_QUERY_MATCH_FTS, "?urn", "tracker:coalesce(nfo:softwareCmdLine(?urn), ?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "nie:comment(?urn)", "\"\"", "\"\"", NULL);
387 _tmp5_ = self->priv->categories_model;
388 tracker_result_store_add_query (_tmp5_, TRACKER_QUERY_TYPE_IMAGES, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "fn:string-join((nfo:height(?urn), nfo:width(?urn)), \" x \")", "nfo:fileSize(?urn)", "nie:url(?urn)", NULL);
389 _tmp6_ = self->priv->categories_model;
390 tracker_result_store_add_query (_tmp6_, TRACKER_QUERY_TYPE_MUSIC, TRACKER_QUERY_MATCH_FTS_INDIRECT, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "fn:string-join((?performer, ?album), \" - \")", "nfo:duration(?urn)", "nie:url(?urn)", NULL);
391 _tmp7_ = self->priv->categories_model;
392 tracker_result_store_add_query (_tmp7_, TRACKER_QUERY_TYPE_VIDEOS, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?urn)", "tracker:coalesce(fts:snippet(?urn),nie:title(?urn), nfo:fileName(?urn)" \
393 ")", "\"\"", "nfo:duration(?urn)", "nie:url(?urn)", NULL);
394 _tmp8_ = self->priv->categories_model;
395 tracker_result_store_add_query (_tmp8_, TRACKER_QUERY_TYPE_DOCUMENTS, TRACKER_QUERY_MATCH_FTS_INDIRECT, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "tracker:coalesce(fts:snippet(?urn),nco:fullname(?creator), nco:fullnam" \
396 "e(?publisher))", "nfo:pageCount(?urn)", "nie:url(?urn)", NULL);
397 _tmp9_ = self->priv->categories_model;
398 tracker_result_store_add_query (_tmp9_, TRACKER_QUERY_TYPE_MAIL, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?urn)", "nmo:messageSubject(?urn)", "tracker:coalesce(fts:snippet(?urn),nco:fullname(?sender), nco:nickname" \
399 "(?sender), nco:emailAddress(?sender))", "nmo:receivedDate(?urn)", "fn:concat(\"To: \", tracker:coalesce(nco:fullname(?to), nco:nickname(?" \
400 "to), nco:emailAddress(?to)))", NULL);
401 _tmp10_ = self->priv->categories_model;
402 tracker_result_store_add_query (_tmp10_, TRACKER_QUERY_TYPE_FOLDERS, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?urn)", "tracker:coalesce(fts:snippet(?urn),nie:title(?urn), nfo:fileName(?urn)" \
403 ")", "nie:url(?parent)", "nfo:fileLastModified(?urn)", "?tooltip", NULL);
404 _tmp11_ = self->priv->categories_model;
405 tracker_result_store_add_query (_tmp11_, TRACKER_QUERY_TYPE_BOOKMARKS, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?bookmark)", "nie:title(?urn)", "nie:url(?bookmark)", "nie:contentLastModified(?urn)", "nie:url(?bookmark)", NULL);
406 _tmp12_ = tracker_result_store_new (7);
407 _g_object_unref0 (self->priv->files_model);
408 self->priv->files_model = _tmp12_;
409 _tmp13_ = self->priv->files_model;
410 _tmp14_ = self->priv->limit;
411 tracker_result_store_set_limit (_tmp13_, _tmp14_);
412 _tmp15_ = self->priv->files_model;
413 g_signal_connect (_tmp15_, "result-overflow", (GCallback) _tracker_needle_result_overflow_tracker_result_store_result_overflow, self);
414 _tmp16_ = self->priv->files_model;
415 tracker_result_store_add_query (_tmp16_, TRACKER_QUERY_TYPE_ALL, TRACKER_QUERY_MATCH_FTS, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "nie:url(?urn)", "nfo:fileSize(?urn)", "nfo:fileLastModified(?urn)", "nie:url(?urn)", NULL);
416 _tmp17_ = tracker_result_store_new (7);
417 _g_object_unref0 (self->priv->files_in_title_model);
418 self->priv->files_in_title_model = _tmp17_;
419 _tmp18_ = self->priv->files_in_title_model;
420 _tmp19_ = self->priv->limit;
421 tracker_result_store_set_limit (_tmp18_, _tmp19_);
422 _tmp20_ = self->priv->files_in_title_model;
423 g_signal_connect (_tmp20_, "result-overflow", (GCallback) _tracker_needle_result_overflow_tracker_result_store_result_overflow, self);
424 _tmp21_ = self->priv->files_in_title_model;
425 tracker_result_store_add_query (_tmp21_, TRACKER_QUERY_TYPE_ALL, TRACKER_QUERY_MATCH_TITLES, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "nie:url(?urn)", "nfo:fileSize(?urn)", "nfo:fileLastModified(?urn)", "nie:url(?urn)", NULL);
426 _tmp22_ = tracker_result_store_new (6);
427 _g_object_unref0 (self->priv->images_model);
428 self->priv->images_model = _tmp22_;
429 _tmp23_ = self->priv->images_model;
430 _tmp24_ = self->priv->limit;
431 tracker_result_store_set_limit (_tmp23_, _tmp24_);
432 _tmp25_ = self->priv->images_model;
433 g_signal_connect (_tmp25_, "result-overflow", (GCallback) _tracker_needle_result_overflow_tracker_result_store_result_overflow, self);
434 _tmp26_ = self->priv->images_model;
435 tracker_result_store_set_icon_size (_tmp26_, 128);
436 _tmp27_ = self->priv->images_model;
437 tracker_result_store_add_query (_tmp27_, TRACKER_QUERY_TYPE_IMAGES, TRACKER_QUERY_MATCH_NONE, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "nfo:fileSize(?urn)", "nfo:fileLastModified(?urn)", "nie:url(?urn)", NULL);
438 _tmp28_ = tracker_result_store_new (6);
439 _g_object_unref0 (self->priv->images_in_title_model);
440 self->priv->images_in_title_model = _tmp28_;
441 _tmp29_ = self->priv->images_in_title_model;
442 _tmp30_ = self->priv->limit;
443 tracker_result_store_set_limit (_tmp29_, _tmp30_);
444 _tmp31_ = self->priv->images_in_title_model;
445 g_signal_connect (_tmp31_, "result-overflow", (GCallback) _tracker_needle_result_overflow_tracker_result_store_result_overflow, self);
446 _tmp32_ = self->priv->images_in_title_model;
447 tracker_result_store_set_icon_size (_tmp32_, 128);
448 _tmp33_ = self->priv->images_in_title_model;
449 tracker_result_store_add_query (_tmp33_, TRACKER_QUERY_TYPE_IMAGES, TRACKER_QUERY_MATCH_TITLES, "?urn", "nie:url(?urn)", "tracker:coalesce(nie:title(?urn), nfo:fileName(?urn))", "nfo:fileSize(?urn)", "nfo:fileLastModified(?urn)", "nie:url(?urn)", NULL);
450 }
451
452
453 TrackerNeedle* tracker_needle_construct (GType object_type) {
454 TrackerNeedle* self = NULL;
455 TrackerHistory* _tmp0_;
456 self = (TrackerNeedle*) g_type_create_instance (object_type);
457 tracker_needle_create_models (self);
458 _tmp0_ = tracker_history_new ();
459 _tracker_history_unref0 (self->priv->history);
460 self->priv->history = _tmp0_;
461 return self;
462 }
463
464
465 TrackerNeedle* tracker_needle_new (void) {
466 return tracker_needle_construct (TRACKER_TYPE_NEEDLE);
467 }
468
469
470 void tracker_needle_show (TrackerNeedle* self) {
471 GtkWindow* _tmp0_;
472 g_return_if_fail (self != NULL);
473 tracker_needle_setup_ui (self);
474 _tmp0_ = self->priv->window;
475 gtk_widget_show ((GtkWidget*) _tmp0_);
476 }
477
478
479 void tracker_needle_set_search (TrackerNeedle* self, gchar** args, int args_length1) {
480 gchar** _tmp0_;
481 gint _tmp0__length1;
482 g_return_if_fail (self != NULL);
483 _tmp0_ = args;
484 _tmp0__length1 = args_length1;
485 if (_tmp0_ != NULL) {
486 gchar* _tmp1_;
487 gchar* text;
488 gchar** _tmp2_;
489 gint _tmp2__length1;
490 const gchar* _tmp12_;
491 GtkEntry* _tmp13_;
492 const gchar* _tmp14_;
493 _tmp1_ = g_strdup ("");
494 text = _tmp1_;
495 _tmp2_ = args;
496 _tmp2__length1 = args_length1;
497 {
498 gchar** s_collection = NULL;
499 gint s_collection_length1 = 0;
500 gint _s_collection_size_ = 0;
unused variable '_s_collection_size_'
(emitted by gcc)
501 gint s_it = 0;
502 s_collection = _tmp2_;
503 s_collection_length1 = _tmp2__length1;
504 for (s_it = 0; s_it < _tmp2__length1; s_it = s_it + 1) {
505 gchar* _tmp3_;
506 gchar* s = NULL;
507 _tmp3_ = g_strdup (s_collection[s_it]);
508 s = _tmp3_;
509 {
510 const gchar* _tmp4_;
511 gint _tmp5_;
512 gint _tmp6_;
513 const gchar* _tmp9_;
514 const gchar* _tmp10_;
515 gchar* _tmp11_;
516 _tmp4_ = text;
517 _tmp5_ = strlen (_tmp4_);
518 _tmp6_ = _tmp5_;
519 if (_tmp6_ > 1) {
520 const gchar* _tmp7_;
521 gchar* _tmp8_;
522 _tmp7_ = text;
523 _tmp8_ = g_strconcat (_tmp7_, " ", NULL);
524 _g_free0 (text);
525 text = _tmp8_;
526 }
527 _tmp9_ = text;
528 _tmp10_ = s;
529 _tmp11_ = g_strconcat (_tmp9_, _tmp10_, NULL);
530 _g_free0 (text);
531 text = _tmp11_;
532 _g_free0 (s);
533 }
534 }
535 }
536 _tmp12_ = text;
537 g_debug ("tracker-needle.vala:223: Setting search criteria to: '%s'\n", _tmp12_);
538 _tmp13_ = self->priv->search;
539 _tmp14_ = text;
540 gtk_entry_set_text (_tmp13_, _tmp14_);
541 _g_free0 (text);
542 }
543 }
544
545
546 static gpointer _g_object_ref0 (gpointer self) {
547 return self ? g_object_ref (self) : NULL;
548 }
549
550
551 static void tracker_needle_store_state_changed (TrackerNeedle* self, GObject* object, GParamSpec* p) {
552 GObject* _tmp0_;
553 TrackerResultStore* _tmp1_;
554 TrackerResultStore* store;
555 TrackerResultStore* _tmp2_;
556 gboolean _tmp3_;
557 gboolean _tmp4_;
558 g_return_if_fail (self != NULL);
559 g_return_if_fail (object != NULL);
560 g_return_if_fail (p != NULL);
561 _tmp0_ = object;
562 _tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TRACKER_TYPE_RESULT_STORE, TrackerResultStore));
563 store = _tmp1_;
564 _tmp2_ = store;
565 _tmp3_ = tracker_result_store_get_active (_tmp2_);
566 _tmp4_ = _tmp3_;
567 if (_tmp4_) {
568 GtkToolItem* _tmp5_;
569 GtkSpinner* _tmp6_;
570 _tmp5_ = self->priv->spinner_shell;
571 gtk_widget_show_all ((GtkWidget*) _tmp5_);
572 _tmp6_ = self->priv->spinner;
573 gtk_spinner_start (_tmp6_);
574 } else {
575 GtkToolItem* _tmp7_;
576 GtkSpinner* _tmp8_;
577 _tmp7_ = self->priv->spinner_shell;
578 gtk_widget_hide ((GtkWidget*) _tmp7_);
579 _tmp8_ = self->priv->spinner;
580 gtk_spinner_stop (_tmp8_);
581 }
582 _g_object_unref0 (store);
583 }
584
585
586 static void _gtk_main_quit_gtk_widget_destroy (GtkWidget* _sender, gpointer self) {
587 gtk_main_quit ();
588 }
589
590
591 static gboolean _tracker_needle_window_key_press_event_gtk_widget_key_press_event (GtkWidget* _sender, GdkEventKey* event, gpointer self) {
592 gboolean result;
593 result = tracker_needle_window_key_press_event (self, _sender, event);
594 return result;
595 }
596
597
598 static void _tracker_needle_info_bar_closed_gtk_button_clicked (GtkButton* _sender, gpointer self) {
599 tracker_needle_info_bar_closed (self, _sender);
600 }
601
602
603 static void _tracker_needle_view_toggled_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self) {
604 tracker_needle_view_toggled (self);
605 }
606
607
608 static void _tracker_needle_find_in_toggled_gtk_toggle_tool_button_toggled (GtkToggleToolButton* _sender, gpointer self) {
609 tracker_needle_find_in_toggled (self);
610 }
611
612
613 static void _tracker_needle_search_changed_gtk_editable_changed (GtkEditable* _sender, gpointer self) {
614 tracker_needle_search_changed (self, _sender);
615 }
616
617
618 static void _tracker_needle_search_activated_gtk_entry_activate (GtkEntry* _sender, gpointer self) {
619 tracker_needle_search_activated (self, _sender);
620 }
621
622
623 static void _tracker_needle_show_tags_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
624 tracker_needle_show_tags_clicked (self);
625 }
626
627
628 static void _tracker_needle_show_stats_clicked_gtk_tool_button_clicked (GtkToolButton* _sender, gpointer self) {
629 tracker_needle_show_stats_clicked (self);
630 }
631
632
633 static void _tracker_needle_store_state_changed_g_object_notify (GObject* _sender, GParamSpec* pspec, gpointer self) {
634 tracker_needle_store_state_changed (self, _sender, pspec);
635 }
636
637
638 static void _tracker_needle_view_row_activated_gtk_tree_view_row_activated (GtkTreeView* _sender, GtkTreePath* path, GtkTreeViewColumn* column, gpointer self) {
639 tracker_needle_view_row_activated (self, _sender, path, column);
640 }
641
642
643 static void _tracker_needle_view_row_selected_gtk_tree_selection_changed (GtkTreeSelection* _sender, gpointer self) {
644 tracker_needle_view_row_selected (self, _sender);
645 }
646
647
648 static void _tracker_needle_icon_item_activated_gtk_icon_view_item_activated (GtkIconView* _sender, GtkTreePath* path, gpointer self) {
649 tracker_needle_icon_item_activated (self, _sender, path);
650 }
651
652
653 static void _tracker_needle_icon_view_selection_changed_gtk_icon_view_selection_changed (GtkIconView* _sender, gpointer self) {
654 tracker_needle_icon_view_selection_changed (self);
655 }
656
657
658 static void tracker_needle_setup_ui (TrackerNeedle* self) {
659 GtkBuilder* _tmp0_;
660 GtkBuilder* builder;
661 GtkButton* info_bar_button = NULL;
662 GtkToolbar* toolbar = NULL;
663 GtkPaned* paned = NULL;
664 gint _tmp5_ = 0;
665 gint _tmp6_ = 0;
666 gint _tmp7_ = 0;
667 GObject* _tmp8_ = NULL;
668 GtkWindow* _tmp9_;
669 GtkWindow* _tmp10_;
670 GtkWindow* _tmp11_;
671 GObject* _tmp12_ = NULL;
672 GtkToolbar* _tmp13_;
673 GtkStyleContext* _tmp14_ = NULL;
674 GObject* _tmp15_ = NULL;
675 GtkInfoBar* _tmp16_;
676 GObject* _tmp17_ = NULL;
677 GtkLabel* _tmp18_;
678 GObject* _tmp19_ = NULL;
679 GtkButton* _tmp20_;
680 GObject* _tmp21_ = NULL;
681 GtkToggleToolButton* _tmp22_;
682 GtkToggleToolButton* _tmp23_;
683 GObject* _tmp24_ = NULL;
684 GtkToggleToolButton* _tmp25_;
685 GtkToggleToolButton* _tmp26_;
686 GObject* _tmp27_ = NULL;
687 GtkToggleToolButton* _tmp28_;
688 GtkToggleToolButton* _tmp29_;
689 GObject* _tmp30_ = NULL;
690 GtkSeparatorToolItem* _tmp31_;
691 GObject* _tmp32_ = NULL;
692 GtkToggleToolButton* _tmp33_;
693 GtkToggleToolButton* _tmp34_;
694 GObject* _tmp35_ = NULL;
695 GtkToggleToolButton* _tmp36_;
696 GtkToggleToolButton* _tmp37_;
697 GObject* _tmp38_ = NULL;
698 GtkToggleToolButton* _tmp39_;
699 GtkToggleToolButton* _tmp40_;
700 GObject* _tmp41_ = NULL;
701 GtkToolItem* _tmp42_;
702 GObject* _tmp43_ = NULL;
703 GtkComboBox* _tmp44_;
704 GtkComboBox* _tmp45_;
705 GtkWidget* _tmp46_ = NULL;
706 GtkEntry* _tmp47_;
707 GtkEntry* _tmp48_;
708 GtkEntry* _tmp49_;
709 TrackerHistory* _tmp50_;
710 gint _tmp51_ = 0;
711 gchar** _tmp52_ = NULL;
712 gchar** _tmp53_;
713 gint _tmp53__length1;
714 GtkSpinner* _tmp54_;
715 GObject* _tmp55_ = NULL;
716 GtkToolItem* _tmp56_;
717 GtkToolItem* _tmp57_;
718 GtkSpinner* _tmp58_;
719 GObject* _tmp59_ = NULL;
720 GtkToggleToolButton* _tmp60_;
721 GtkToggleToolButton* _tmp61_;
722 GObject* _tmp62_ = NULL;
723 GtkToolButton* _tmp63_;
724 GtkToolButton* _tmp64_;
725 GObject* _tmp65_ = NULL;
726 GtkHBox* _tmp66_;
727 GtkTreeView* treeview = NULL;
728 GtkIconView* iconview = NULL;
729 GtkTreeSelection* treeselection = NULL;
730 TrackerViewDisplay _tmp67_;
731 TrackerView* _tmp68_;
732 GtkHBox* _tmp69_;
733 TrackerView* _tmp70_;
734 TrackerViewDisplay _tmp71_;
735 TrackerResultStore* _tmp72_;
736 TrackerView* _tmp73_;
737 TrackerView* _tmp74_;
738 TrackerResultStore* _tmp75_;
739 TrackerResultStore* _tmp76_;
740 TrackerView* _tmp77_;
741 GtkWidget* _tmp78_ = NULL;
742 GtkTreeView* _tmp79_;
743 GtkTreeView* _tmp80_;
744 GtkTreeView* _tmp81_;
745 GtkTreeSelection* _tmp82_ = NULL;
746 GtkTreeSelection* _tmp83_;
747 GtkTreeSelection* _tmp84_;
748 GtkHBox* _tmp85_;
749 TrackerView* _tmp86_;
750 TrackerViewDisplay _tmp87_;
751 TrackerView* _tmp88_;
752 TrackerView* _tmp89_;
753 GtkWidget* _tmp90_ = NULL;
754 GtkTreeView* _tmp91_;
755 GtkTreeView* _tmp92_;
756 GtkTreeView* _tmp93_;
757 GtkTreeSelection* _tmp94_ = NULL;
758 GtkTreeSelection* _tmp95_;
759 GtkTreeSelection* _tmp96_;
760 GtkHBox* _tmp97_;
761 TrackerView* _tmp98_;
762 TrackerViewDisplay _tmp99_;
763 TrackerView* _tmp100_;
764 TrackerView* _tmp101_;
765 GtkWidget* _tmp102_ = NULL;
766 GtkIconView* _tmp103_;
767 GtkHBox* _tmp104_;
768 TrackerView* _tmp105_;
769 GObject* _tmp106_ = NULL;
770 GtkPaned* _tmp107_;
771 TrackerTagsView* _tmp108_;
772 TrackerTagsView* _tmp109_;
773 TrackerTagsView* _tmp110_;
774 TrackerTagsView* _tmp111_;
775 GtkToggleToolButton* _tmp112_;
776 GError * _inner_error_ = NULL;
777 g_return_if_fail (self != NULL);
778 _tmp0_ = gtk_builder_new ();
779 builder = _tmp0_;
780 {
781 gtk_builder_add_from_file (builder, SRCDIR TRACKER_NEEDLE_UI_FILE, &_inner_error_);
782 if (_inner_error_ != NULL) {
783 goto __catch28_g_error;
784 }
785 }
786 goto __finally28;
787 __catch28_g_error:
788 {
789 GError* e = NULL;
790 e = _inner_error_;
791 _inner_error_ = NULL;
792 {
793 gtk_builder_add_from_file (builder, TRACKER_UI_DIR TRACKER_NEEDLE_UI_FILE, &_inner_error_);
794 if (_inner_error_ != NULL) {
795 goto __catch29_g_error;
796 }
797 }
798 goto __finally29;
799 __catch29_g_error:
800 {
801 GError* e = NULL;
802 GError* _tmp1_;
803 const gchar* _tmp2_;
804 GtkMessageDialog* _tmp3_;
805 GtkMessageDialog* msg;
806 GtkMessageDialog* _tmp4_;
807 e = _inner_error_;
808 _inner_error_ = NULL;
809 _tmp1_ = e;
810 _tmp2_ = _tmp1_->message;
811 _tmp3_ = (GtkMessageDialog*) gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_ERROR, GTK_BUTTONS_CANCEL, "Failed to load UI file, %s\n", _tmp2_);
812 g_object_ref_sink (_tmp3_);
813 msg = _tmp3_;
814 _tmp4_ = msg;
815 gtk_dialog_run ((GtkDialog*) _tmp4_);
816 gtk_main_quit ();
817 _g_object_unref0 (msg);
818 _g_error_free0 (e);
819 }
820 __finally29:
821 if (_inner_error_ != NULL) {
822 _g_error_free0 (e);
823 _g_error_free0 (e);
824 _g_object_unref0 (paned);
825 _g_object_unref0 (toolbar);
826 _g_object_unref0 (info_bar_button);
827 _g_object_unref0 (builder);
828 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);
829 g_clear_error (&_inner_error_);
830 return;
831 }
832 _g_error_free0 (e);
833 }
834 __finally28:
835 if (_inner_error_ != NULL) {
836 _g_object_unref0 (paned);
837 _g_object_unref0 (toolbar);
838 _g_object_unref0 (info_bar_button);
839 _g_object_unref0 (builder);
840 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);
841 g_clear_error (&_inner_error_);
842 return;
843 }
844 gtk_icon_size_lookup (GTK_ICON_SIZE_MENU, &_tmp5_, NULL);
845 self->priv->size_small = _tmp5_;
846 gtk_icon_size_lookup (GTK_ICON_SIZE_DND, &_tmp6_, NULL);
847 self->priv->size_medium = _tmp6_;
848 gtk_icon_size_lookup (GTK_ICON_SIZE_DIALOG, &_tmp7_, NULL);
849 self->priv->size_big = _tmp7_;
850 _tmp8_ = gtk_builder_get_object (builder, "window_needle");
851 _tmp9_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp8_, GTK_TYPE_WINDOW) ? ((GtkWindow*) _tmp8_) : NULL);
852 _g_object_unref0 (self->priv->window);
853 self->priv->window = _tmp9_;
854 _tmp10_ = self->priv->window;
855 g_signal_connect ((GtkWidget*) _tmp10_, "destroy", (GCallback) _gtk_main_quit_gtk_widget_destroy, NULL);
856 _tmp11_ = self->priv->window;
857 g_signal_connect ((GtkWidget*) _tmp11_, "key-press-event", (GCallback) _tracker_needle_window_key_press_event_gtk_widget_key_press_event, self);
858 _tmp12_ = gtk_builder_get_object (builder, "toolbar_main");
859 _tmp13_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp12_, GTK_TYPE_TOOLBAR) ? ((GtkToolbar*) _tmp12_) : NULL);
860 _g_object_unref0 (toolbar);
861 toolbar = _tmp13_;
862 _tmp14_ = gtk_widget_get_style_context ((GtkWidget*) toolbar);
863 gtk_style_context_add_class (_tmp14_, GTK_STYLE_CLASS_PRIMARY_TOOLBAR);
864 _tmp15_ = gtk_builder_get_object (builder, "info_bar");
865 _tmp16_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp15_, GTK_TYPE_INFO_BAR) ? ((GtkInfoBar*) _tmp15_) : NULL);
866 _g_object_unref0 (self->priv->info_bar);
867 self->priv->info_bar = _tmp16_;
868 _tmp17_ = gtk_builder_get_object (builder, "info_bar_label");
869 _tmp18_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp17_, GTK_TYPE_LABEL) ? ((GtkLabel*) _tmp17_) : NULL);
870 _g_object_unref0 (self->priv->info_bar_label);
871 self->priv->info_bar_label = _tmp18_;
872 _tmp19_ = gtk_builder_get_object (builder, "info_bar_button");
873 _tmp20_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp19_, GTK_TYPE_BUTTON) ? ((GtkButton*) _tmp19_) : NULL);
874 _g_object_unref0 (info_bar_button);
875 info_bar_button = _tmp20_;
876 g_signal_connect (info_bar_button, "clicked", (GCallback) _tracker_needle_info_bar_closed_gtk_button_clicked, self);
877 _tmp21_ = gtk_builder_get_object (builder, "toolbutton_view_filelist");
878 _tmp22_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp21_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp21_) : NULL);
879 _g_object_unref0 (self->priv->view_filelist);
880 self->priv->view_filelist = _tmp22_;
881 _tmp23_ = self->priv->view_filelist;
882 g_signal_connect (_tmp23_, "toggled", (GCallback) _tracker_needle_view_toggled_gtk_toggle_tool_button_toggled, self);
883 _tmp24_ = gtk_builder_get_object (builder, "toolbutton_view_icons");
884 _tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp24_) : NULL);
885 _g_object_unref0 (self->priv->view_icons);
886 self->priv->view_icons = _tmp25_;
887 _tmp26_ = self->priv->view_icons;
888 g_signal_connect (_tmp26_, "toggled", (GCallback) _tracker_needle_view_toggled_gtk_toggle_tool_button_toggled, self);
889 _tmp27_ = gtk_builder_get_object (builder, "toolbutton_view_categories");
890 _tmp28_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp27_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp27_) : NULL);
891 _g_object_unref0 (self->priv->view_categories);
892 self->priv->view_categories = _tmp28_;
893 _tmp29_ = self->priv->view_categories;
894 g_signal_connect (_tmp29_, "toggled", (GCallback) _tracker_needle_view_toggled_gtk_toggle_tool_button_toggled, self);
895 _tmp30_ = gtk_builder_get_object (builder, "separator_secondary");
896 _tmp31_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp30_, GTK_TYPE_SEPARATOR_TOOL_ITEM) ? ((GtkSeparatorToolItem*) _tmp30_) : NULL);
897 _g_object_unref0 (self->priv->separator_secondary);
898 self->priv->separator_secondary = _tmp31_;
899 _tmp32_ = gtk_builder_get_object (builder, "toolbutton_find_in_contents");
900 _tmp33_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp32_) : NULL);
901 _g_object_unref0 (self->priv->find_in_contents);
902 self->priv->find_in_contents = _tmp33_;
903 _tmp34_ = self->priv->find_in_contents;
904 g_signal_connect (_tmp34_, "toggled", (GCallback) _tracker_needle_find_in_toggled_gtk_toggle_tool_button_toggled, self);
905 _tmp35_ = gtk_builder_get_object (builder, "toolbutton_find_in_titles");
906 _tmp36_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp35_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp35_) : NULL);
907 _g_object_unref0 (self->priv->find_in_titles);
908 self->priv->find_in_titles = _tmp36_;
909 _tmp37_ = self->priv->find_in_titles;
910 g_signal_connect (_tmp37_, "toggled", (GCallback) _tracker_needle_find_in_toggled_gtk_toggle_tool_button_toggled, self);
911 _tmp38_ = gtk_builder_get_object (builder, "toolbutton_find_in_all");
912 _tmp39_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp38_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp38_) : NULL);
913 _g_object_unref0 (self->priv->find_in_all);
914 self->priv->find_in_all = _tmp39_;
915 _tmp40_ = self->priv->find_in_all;
916 g_signal_connect (_tmp40_, "toggled", (GCallback) _tracker_needle_find_in_toggled_gtk_toggle_tool_button_toggled, self);
917 _tmp41_ = gtk_builder_get_object (builder, "toolitem_search_entry");
918 _tmp42_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp41_, GTK_TYPE_TOOL_ITEM) ? ((GtkToolItem*) _tmp41_) : NULL);
919 _g_object_unref0 (self->priv->search_entry);
920 self->priv->search_entry = _tmp42_;
921 _tmp43_ = gtk_builder_get_object (builder, "combobox_search");
922 _tmp44_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp43_, GTK_TYPE_COMBO_BOX) ? ((GtkComboBox*) _tmp43_) : NULL);
923 _g_object_unref0 (self->priv->search_list);
924 self->priv->search_list = _tmp44_;
925 _tmp45_ = self->priv->search_list;
926 _tmp46_ = gtk_bin_get_child ((GtkBin*) _tmp45_);
927 _tmp47_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp46_, GTK_TYPE_ENTRY) ? ((GtkEntry*) _tmp46_) : NULL);
928 _g_object_unref0 (self->priv->search);
929 self->priv->search = _tmp47_;
930 _tmp48_ = self->priv->search;
931 g_signal_connect ((GtkEditable*) _tmp48_, "changed", (GCallback) _tracker_needle_search_changed_gtk_editable_changed, self);
932 _tmp49_ = self->priv->search;
933 g_signal_connect (_tmp49_, "activate", (GCallback) _tracker_needle_search_activated_gtk_entry_activate, self);
934 _tmp50_ = self->priv->history;
935 _tmp52_ = tracker_history_get (_tmp50_, &_tmp51_);
936 _tmp53_ = _tmp52_;
937 _tmp53__length1 = _tmp51_;
938 tracker_needle_search_history_insert (self, _tmp53_, _tmp51_);
939 _tmp53_ = (_vala_array_free (_tmp53_, _tmp53__length1, (GDestroyNotify) g_free), NULL);
940 _tmp54_ = (GtkSpinner*) gtk_spinner_new ();
941 g_object_ref_sink (_tmp54_);
942 _g_object_unref0 (self->priv->spinner);
943 self->priv->spinner = _tmp54_;
944 _tmp55_ = gtk_builder_get_object (builder, "toolcustom_spinner");
945 _tmp56_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp55_, GTK_TYPE_TOOL_ITEM) ? ((GtkToolItem*) _tmp55_) : NULL);
946 _g_object_unref0 (self->priv->spinner_shell);
947 self->priv->spinner_shell = _tmp56_;
948 _tmp57_ = self->priv->spinner_shell;
949 _tmp58_ = self->priv->spinner;
950 gtk_container_add ((GtkContainer*) _tmp57_, (GtkWidget*) _tmp58_);
951 _tmp59_ = gtk_builder_get_object (builder, "toolbutton_show_tags");
952 _tmp60_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp59_, GTK_TYPE_TOGGLE_TOOL_BUTTON) ? ((GtkToggleToolButton*) _tmp59_) : NULL);
953 _g_object_unref0 (self->priv->show_tags);
954 self->priv->show_tags = _tmp60_;
955 _tmp61_ = self->priv->show_tags;
956 g_signal_connect ((GtkToolButton*) _tmp61_, "clicked", (GCallback) _tracker_needle_show_tags_clicked_gtk_tool_button_clicked, self);
957 _tmp62_ = gtk_builder_get_object (builder, "toolbutton_show_stats");
958 _tmp63_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp62_, GTK_TYPE_TOOL_BUTTON) ? ((GtkToolButton*) _tmp62_) : NULL);
959 _g_object_unref0 (self->priv->show_stats);
960 self->priv->show_stats = _tmp63_;
961 _tmp64_ = self->priv->show_stats;
962 g_signal_connect (_tmp64_, "clicked", (GCallback) _tracker_needle_show_stats_clicked_gtk_tool_button_clicked, self);
963 _tmp65_ = gtk_builder_get_object (builder, "hbox_view");
964 _tmp66_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp65_, GTK_TYPE_HBOX) ? ((GtkHBox*) _tmp65_) : NULL);
965 _g_object_unref0 (self->priv->view);
966 self->priv->view = _tmp66_;
967 _tmp67_ = TRACKER_VIEW_DISPLAY_NO_RESULTS;
968 _tmp68_ = tracker_view_new (&_tmp67_, NULL);
969 g_object_ref_sink (_tmp68_);
970 _g_object_unref0 (self->priv->sw_noresults);
971 self->priv->sw_noresults = _tmp68_;
972 _tmp69_ = self->priv->view;
973 _tmp70_ = self->priv->sw_noresults;
974 gtk_box_pack_start ((GtkBox*) _tmp69_, (GtkWidget*) _tmp70_, TRUE, TRUE, (guint) 0);
975 _tmp71_ = TRACKER_VIEW_DISPLAY_CATEGORIES;
976 _tmp72_ = self->priv->categories_model;
977 _tmp73_ = tracker_view_new (&_tmp71_, _tmp72_);
978 g_object_ref_sink (_tmp73_);
979 _g_object_unref0 (self->priv->sw_categories);
980 self->priv->sw_categories = _tmp73_;
981 _tmp74_ = self->priv->sw_categories;
982 _tmp75_ = tracker_view_get_store (_tmp74_);
983 _tmp76_ = _tmp75_;
984 g_signal_connect ((GObject*) _tmp76_, "notify::active", (GCallback) _tracker_needle_store_state_changed_g_object_notify, self);
985 _tmp77_ = self->priv->sw_categories;
986 _tmp78_ = gtk_bin_get_child ((GtkBin*) _tmp77_);
987 _tmp79_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp78_, GTK_TYPE_TREE_VIEW, GtkTreeView));
988 _g_object_unref0 (treeview);
989 treeview = _tmp79_;
990 _tmp80_ = treeview;
991 g_signal_connect (_tmp80_, "row-activated", (GCallback) _tracker_needle_view_row_activated_gtk_tree_view_row_activated, self);
992 _tmp81_ = treeview;
993 _tmp82_ = gtk_tree_view_get_selection (_tmp81_);
994 _tmp83_ = _g_object_ref0 (_tmp82_);
995 _g_object_unref0 (treeselection);
996 treeselection = _tmp83_;
997 _tmp84_ = treeselection;
998 g_signal_connect (_tmp84_, "changed", (GCallback) _tracker_needle_view_row_selected_gtk_tree_selection_changed, self);
999 _tmp85_ = self->priv->view;
1000 _tmp86_ = self->priv->sw_categories;
1001 gtk_box_pack_start ((GtkBox*) _tmp85_, (GtkWidget*) _tmp86_, TRUE, TRUE, (guint) 0);
1002 _tmp87_ = TRACKER_VIEW_DISPLAY_FILE_LIST;
1003 _tmp88_ = tracker_view_new (&_tmp87_, NULL);
1004 g_object_ref_sink (_tmp88_);
1005 _g_object_unref0 (self->priv->sw_filelist);
1006 self->priv->sw_filelist = _tmp88_;
1007 _tmp89_ = self->priv->sw_filelist;
1008 _tmp90_ = gtk_bin_get_child ((GtkBin*) _tmp89_);
1009 _tmp91_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp90_, GTK_TYPE_TREE_VIEW, GtkTreeView));
1010 _g_object_unref0 (treeview);
1011 treeview = _tmp91_;
1012 _tmp92_ = treeview;
1013 g_signal_connect (_tmp92_, "row-activated", (GCallback) _tracker_needle_view_row_activated_gtk_tree_view_row_activated, self);
1014 _tmp93_ = treeview;
1015 _tmp94_ = gtk_tree_view_get_selection (_tmp93_);
1016 _tmp95_ = _g_object_ref0 (_tmp94_);
1017 _g_object_unref0 (treeselection);
1018 treeselection = _tmp95_;
1019 _tmp96_ = treeselection;
1020 g_signal_connect (_tmp96_, "changed", (GCallback) _tracker_needle_view_row_selected_gtk_tree_selection_changed, self);
1021 _tmp97_ = self->priv->view;
1022 _tmp98_ = self->priv->sw_filelist;
1023 gtk_box_pack_start ((GtkBox*) _tmp97_, (GtkWidget*) _tmp98_, TRUE, TRUE, (guint) 0);
1024 _tmp99_ = TRACKER_VIEW_DISPLAY_FILE_ICONS;
1025 _tmp100_ = tracker_view_new (&_tmp99_, NULL);
1026 g_object_ref_sink (_tmp100_);
1027 _g_object_unref0 (self->priv->sw_icons);
1028 self->priv->sw_icons = _tmp100_;
1029 _tmp101_ = self->priv->sw_icons;
1030 _tmp102_ = gtk_bin_get_child ((GtkBin*) _tmp101_);
1031 _tmp103_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp102_, GTK_TYPE_ICON_VIEW, GtkIconView));
1032 _g_object_unref0 (iconview);
1033 iconview = _tmp103_;
1034 g_signal_connect (iconview, "item-activated", (GCallback) _tracker_needle_icon_item_activated_gtk_icon_view_item_activated, self);
1035 g_signal_connect (iconview, "selection-changed", (GCallback) _tracker_needle_icon_view_selection_changed_gtk_icon_view_selection_changed, self);
1036 _tmp104_ = self->priv->view;
1037 _tmp105_ = self->priv->sw_icons;
1038 gtk_box_pack_start ((GtkBox*) _tmp104_, (GtkWidget*) _tmp105_, TRUE, TRUE, (guint) 0);
1039 _tmp106_ = gtk_builder_get_object (builder, "hpaned");
1040 _tmp107_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp106_, GTK_TYPE_PANED) ? ((GtkPaned*) _tmp106_) : NULL);
1041 _g_object_unref0 (paned);
1042 paned = _tmp107_;
1043 _tmp108_ = tracker_tags_view_new (NULL);
1044 g_object_ref_sink (_tmp108_);
1045 _g_object_unref0 (self->priv->tags_view);
1046 self->priv->tags_view = _tmp108_;
1047 _tmp109_ = self->priv->tags_view;
1048 gtk_widget_hide ((GtkWidget*) _tmp109_);
1049 _tmp110_ = self->priv->tags_view;
1050 tracker_tags_view_hide_label (_tmp110_);
1051 _tmp111_ = self->priv->tags_view;
1052 gtk_paned_pack2 (paned, (GtkWidget*) _tmp111_, FALSE, FALSE);
1053 _tmp112_ = self->priv->view_categories;
1054 gtk_toggle_tool_button_set_active (_tmp112_, TRUE);
1055 _g_object_unref0 (treeselection);
1056 _g_object_unref0 (iconview);
1057 _g_object_unref0 (treeview);
1058 _g_object_unref0 (paned);
1059 _g_object_unref0 (toolbar);
1060 _g_object_unref0 (info_bar_button);
1061 _g_object_unref0 (builder);
1062 }
1063
1064
1065 static gboolean tracker_needle_window_key_press_event (TrackerNeedle* self, GtkWidget* widget, GdkEventKey* event) {
1066 gboolean result = FALSE;
1067 gboolean _tmp0_ = FALSE;
1068 GdkEventKey _tmp1_;
1069 GdkModifierType _tmp2_;
1070 gboolean _tmp6_;
1071 g_return_val_if_fail (self != NULL, FALSE);
1072 g_return_val_if_fail (widget != NULL, FALSE);
1073 g_return_val_if_fail (event != NULL, FALSE);
1074 _tmp1_ = *event;
1075 _tmp2_ = _tmp1_.state;
1076 if ((_tmp2_ & GDK_CONTROL_MASK) == GDK_CONTROL_MASK) {
1077 GdkEventKey _tmp3_;
1078 guint _tmp4_;
1079 const gchar* _tmp5_ = NULL;
1080 _tmp3_ = *event;
1081 _tmp4_ = _tmp3_.keyval;
1082 _tmp5_ = gdk_keyval_name (_tmp4_);
1083 _tmp0_ = g_strcmp0 (_tmp5_, "w") == 0;
1084 } else {
1085 _tmp0_ = FALSE;
1086 }
1087 _tmp6_ = _tmp0_;
1088 if (_tmp6_) {
1089 GtkWidget* _tmp7_;
1090 _tmp7_ = widget;
1091 gtk_widget_destroy (_tmp7_);
1092 }
1093 result = FALSE;
1094 return result;
1095 }
1096
1097
1098 static gboolean _tracker_needle_search_run_gsource_func (gpointer self) {
1099 gboolean result;
1100 result = tracker_needle_search_run (self);
1101 return result;
1102 }
1103
1104
1105 static void tracker_needle_search_changed (TrackerNeedle* self, GtkEditable* editable) {
1106 guint _tmp0_;
1107 guint _tmp2_ = 0U;
1108 g_return_if_fail (self != NULL);
1109 g_return_if_fail (editable != NULL);
1110 _tmp0_ = self->priv->last_search_id;
1111 if (_tmp0_ != ((guint) 0)) {
1112 guint _tmp1_;
1113 _tmp1_ = self->priv->last_search_id;
1114 g_source_remove (_tmp1_);
1115 }
1116 _tmp2_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 1, _tracker_needle_search_run_gsource_func, tracker_needle_ref (self), tracker_needle_unref);
1117 self->priv->last_search_id = _tmp2_;
1118 }
1119
1120
1121 static void tracker_needle_search_activated (TrackerNeedle* self, GtkEntry* entry) {
1122 guint _tmp0_;
1123 g_return_if_fail (self != NULL);
1124 g_return_if_fail (entry != NULL);
1125 _tmp0_ = self->priv->last_search_id;
1126 if (_tmp0_ != ((guint) 0)) {
1127 guint _tmp1_;
1128 _tmp1_ = self->priv->last_search_id;
1129 g_source_remove (_tmp1_);
1130 self->priv->last_search_id = (guint) 0;
1131 }
1132 tracker_needle_search_run (self);
1133 }
1134
1135
1136 static void tracker_needle_search_finished (TrackerNeedle* self, TrackerResultStore* store) {
1137 gboolean _tmp0_ = FALSE;
1138 TrackerResultStore* _tmp1_;
1139 gboolean _tmp4_;
1140 g_return_if_fail (self != NULL);
1141 _tmp1_ = store;
1142 if (_tmp1_ == NULL) {
1143 _tmp0_ = TRUE;
1144 } else {
1145 TrackerResultStore* _tmp2_;
1146 gboolean _tmp3_ = FALSE;
1147 _tmp2_ = store;
1148 _tmp3_ = tracker_result_store_has_results (_tmp2_);
1149 _tmp0_ = !_tmp3_;
1150 }
1151 _tmp4_ = _tmp0_;
1152 if (_tmp4_) {
1153 TrackerView* _tmp5_;
1154 TrackerView* _tmp6_;
1155 TrackerView* _tmp7_;
1156 TrackerView* _tmp8_;
1157 _tmp5_ = self->priv->sw_noresults;
1158 gtk_widget_show ((GtkWidget*) _tmp5_);
1159 _tmp6_ = self->priv->sw_icons;
1160 gtk_widget_hide ((GtkWidget*) _tmp6_);
1161 _tmp7_ = self->priv->sw_categories;
1162 gtk_widget_hide ((GtkWidget*) _tmp7_);
1163 _tmp8_ = self->priv->sw_filelist;
1164 gtk_widget_hide ((GtkWidget*) _tmp8_);
1165 }
1166 }
1167
1168
1169 static GtkTreeIter* _gtk_tree_iter_dup (GtkTreeIter* self) {
1170 GtkTreeIter* dup;
1171 dup = g_new0 (GtkTreeIter, 1);
1172 memcpy (dup, self, sizeof (GtkTreeIter));
1173 return dup;
1174 }
1175
1176
1177 static gpointer __gtk_tree_iter_dup0 (gpointer self) {
1178 return self ? _gtk_tree_iter_dup (self) : NULL;
1179 }
1180
1181
1182 static GtkTreeIter* tracker_needle_search_history_find_or_insert (TrackerNeedle* self, const gchar* criteria, gboolean* add_to_model) {
1183 GtkTreeIter* result = NULL;
1184 const gchar* _tmp0_;
1185 gint _tmp1_;
1186 gint _tmp2_;
1187 GtkComboBox* _tmp3_;
1188 GtkComboBox* _tmp4_;
1189 GtkComboBox* combo;
1190 GtkComboBox* _tmp5_;
1191 GtkTreeModel* _tmp6_ = NULL;
1192 GtkTreeModel* _tmp7_;
1193 GtkTreeModel* model;
1194 const gchar* _tmp8_;
1195 gchar* _tmp9_ = NULL;
1196 gchar* criteria_folded;
1197 GtkTreeIter iter = {0};
1198 GtkTreeModel* _tmp10_;
1199 GtkTreeIter _tmp11_ = {0};
1200 gboolean _tmp12_ = FALSE;
1201 gboolean valid;
1202 gboolean* _tmp23_;
1203 g_return_val_if_fail (self != NULL, NULL);
1204 g_return_val_if_fail (criteria != NULL, NULL);
1205 _tmp0_ = criteria;
1206 _tmp1_ = strlen (_tmp0_);
1207 _tmp2_ = _tmp1_;
1208 if (_tmp2_ < 1) {
1209 result = NULL;
1210 return result;
1211 }
1212 _tmp3_ = self->priv->search_list;
1213 _tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, GTK_TYPE_COMBO_BOX) ? ((GtkComboBox*) _tmp3_) : NULL);
1214 combo = _tmp4_;
1215 _tmp5_ = combo;
1216 _tmp6_ = gtk_combo_box_get_model (_tmp5_);
1217 _tmp7_ = _g_object_ref0 (_tmp6_);
1218 model = _tmp7_;
1219 _tmp8_ = criteria;
1220 _tmp9_ = g_utf8_casefold (_tmp8_, (gssize) (-1));
1221 criteria_folded = _tmp9_;
1222 _tmp10_ = model;
1223 _tmp12_ = gtk_tree_model_iter_children (_tmp10_, &_tmp11_, NULL);
1224 iter = _tmp11_;
1225 valid = _tmp12_;
1226 while (TRUE) {
1227 gboolean _tmp13_;
1228 gchar* text = NULL;
1229 GtkTreeModel* _tmp14_;
1230 GtkTreeIter _tmp15_;
1231 const gchar* _tmp16_;
1232 gchar* _tmp17_ = NULL;
1233 gchar* text_folded;
1234 const gchar* _tmp18_;
1235 const gchar* _tmp19_;
1236 GtkTreeModel* _tmp21_;
1237 gboolean _tmp22_ = FALSE;
1238 _tmp13_ = valid;
1239 if (!_tmp13_) {
1240 break;
1241 }
1242 _tmp14_ = model;
1243 _tmp15_ = iter;
1244 gtk_tree_model_get (_tmp14_, &_tmp15_, 0, &text, -1, -1);
1245 _tmp16_ = text;
1246 _tmp17_ = g_utf8_casefold (_tmp16_, (gssize) (-1));
1247 text_folded = _tmp17_;
1248 _tmp18_ = text_folded;
1249 _tmp19_ = criteria_folded;
1250 if (g_strcmp0 (_tmp18_, _tmp19_) == 0) {
1251 GtkTreeIter* _tmp20_;
1252 _tmp20_ = __gtk_tree_iter_dup0 (&iter);
1253 result = _tmp20_;
1254 _g_free0 (text_folded);
1255 _g_free0 (text);
1256 _g_free0 (criteria_folded);
1257 _g_object_unref0 (model);
1258 _g_object_unref0 (combo);
1259 return result;
1260 }
1261 _tmp21_ = model;
1262 _tmp22_ = gtk_tree_model_iter_next (_tmp21_, &iter);
1263 valid = _tmp22_;
1264 _g_free0 (text_folded);
1265 _g_free0 (text);
1266 }
1267 _tmp23_ = add_to_model;
1268 if (*_tmp23_) {
1269 GtkTreeIter new_iter = {0};
1270 GtkTreeModel* _tmp24_;
1271 GtkListStore* _tmp25_;
1272 GtkListStore* store;
1273 GtkListStore* _tmp26_;
1274 GtkTreeIter _tmp27_ = {0};
1275 GtkListStore* _tmp28_;
1276 GtkTreeIter _tmp29_;
1277 const gchar* _tmp30_;
1278 TrackerHistory* _tmp31_;
1279 const gchar* _tmp32_;
1280 _tmp24_ = model;
1281 _tmp25_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp24_, GTK_TYPE_LIST_STORE, GtkListStore));
1282 store = _tmp25_;
1283 _tmp26_ = store;
1284 gtk_list_store_prepend (_tmp26_, &_tmp27_);
1285 new_iter = _tmp27_;
1286 _tmp28_ = store;
1287 _tmp29_ = new_iter;
1288 _tmp30_ = criteria;
1289 gtk_list_store_set (_tmp28_, &_tmp29_, 0, _tmp30_, -1, -1);
1290 _tmp31_ = self->priv->history;
1291 _tmp32_ = criteria;
1292 tracker_history_add (_tmp31_, _tmp32_);
1293 _g_object_unref0 (store);
1294 }
1295 result = NULL;
1296 _g_free0 (criteria_folded);
1297 _g_object_unref0 (model);
1298 _g_object_unref0 (combo);
1299 return result;
1300 }
1301
1302
1303 static void tracker_needle_search_history_insert (TrackerNeedle* self, gchar** history, int history_length1) {
1304 gchar** _tmp0_;
1305 gint _tmp0__length1;
1306 g_return_if_fail (self != NULL);
1307 _tmp0_ = history;
1308 _tmp0__length1 = history_length1;
1309 {
1310 gchar** criteria_collection = NULL;
1311 gint criteria_collection_length1 = 0;
1312 gint _criteria_collection_size_ = 0;
unused variable '_criteria_collection_size_'
(emitted by gcc)
1313 gint criteria_it = 0;
1314 criteria_collection = _tmp0_;
1315 criteria_collection_length1 = _tmp0__length1;
1316 for (criteria_it = 0; criteria_it < _tmp0__length1; criteria_it = criteria_it + 1) {
1317 gchar* _tmp1_;
1318 gchar* criteria = NULL;
1319 _tmp1_ = g_strdup (criteria_collection[criteria_it]);
1320 criteria = _tmp1_;
1321 {
1322 const gchar* _tmp2_;
1323 gboolean _tmp3_;
1324 GtkTreeIter* _tmp4_ = NULL;
1325 GtkTreeIter* _tmp5_;
1326 _tmp2_ = criteria;
1327 _tmp3_ = TRUE;
1328 _tmp4_ = tracker_needle_search_history_find_or_insert (self, _tmp2_, &_tmp3_);
1329 _tmp5_ = _tmp4_;
1330 _g_free0 (_tmp5_);
1331 _g_free0 (criteria);
1332 }
1333 }
1334 }
1335 }
1336
1337
1338 static gchar* string_strip (const gchar* self) {
1339 gchar* result = NULL;
1340 gchar* _tmp0_ = NULL;
1341 gchar* _result_;
1342 const gchar* _tmp1_;
1343 g_return_val_if_fail (self != NULL, NULL);
1344 _tmp0_ = g_strdup (self);
1345 _result_ = _tmp0_;
1346 _tmp1_ = _result_;
1347 g_strstrip (_tmp1_);
passing argument 1 of 'g_strchug' discards 'const' qualifier from pointer target type [enabled by default]
(emitted by gcc)
1348 result = _result_;
1349 return result;
1350 }
1351
1352
1353 static gboolean tracker_needle_search_run (TrackerNeedle* self) {
1354 gboolean result = FALSE;
1355 GtkEntry* _tmp0_;
1356 const gchar* _tmp1_ = NULL;
1357 gchar* _tmp2_;
1358 gchar* str;
1359 const gchar* _tmp3_;
1360 gchar* _tmp4_ = NULL;
1361 gchar* criteria;
1362 TrackerResultStore* store;
1363 GtkToggleToolButton* _tmp5_;
1364 gboolean _tmp6_;
1365 gboolean _tmp7_;
1366 TrackerView* _tmp24_;
1367 GtkToggleToolButton* _tmp25_;
1368 gboolean _tmp26_;
1369 gboolean _tmp27_;
1370 GtkToggleToolButton* _tmp39_;
1371 gboolean _tmp40_;
1372 gboolean _tmp41_;
1373 GtkToggleToolButton* _tmp46_;
1374 gboolean _tmp47_;
1375 gboolean _tmp48_;
1376 TrackerResultStore* _tmp60_;
1377 g_return_val_if_fail (self != NULL, FALSE);
1378 self->priv->last_search_id = (guint) 0;
1379 _tmp0_ = self->priv->search;
1380 _tmp1_ = gtk_entry_get_text (_tmp0_);
1381 _tmp2_ = g_strdup (_tmp1_);
1382 str = _tmp2_;
1383 _tmp3_ = str;
1384 _tmp4_ = string_strip (_tmp3_);
1385 criteria = _tmp4_;
1386 store = NULL;
1387 _tmp5_ = self->priv->show_tags;
1388 _tmp6_ = gtk_toggle_tool_button_get_active (_tmp5_);
1389 _tmp7_ = _tmp6_;
1390 if (!_tmp7_) {
1391 const gchar* _tmp8_;
1392 gint _tmp9_;
1393 gint _tmp10_;
1394 const gchar* _tmp20_;
1395 gboolean _tmp21_;
1396 GtkTreeIter* _tmp22_ = NULL;
1397 GtkTreeIter* _tmp23_;
1398 _tmp8_ = criteria;
1399 _tmp9_ = strlen (_tmp8_);
1400 _tmp10_ = _tmp9_;
1401 if (_tmp10_ < 3) {
1402 gboolean _tmp11_ = FALSE;
1403 GtkToggleToolButton* _tmp12_;
1404 gboolean _tmp13_;
1405 gboolean _tmp14_;
1406 gboolean _tmp18_;
1407 _tmp12_ = self->priv->view_icons;
1408 _tmp13_ = gtk_toggle_tool_button_get_active (_tmp12_);
1409 _tmp14_ = _tmp13_;
1410 if (!_tmp14_) {
1411 _tmp11_ = TRUE;
1412 } else {
1413 GtkToggleToolButton* _tmp15_;
1414 gboolean _tmp16_;
1415 gboolean _tmp17_;
1416 _tmp15_ = self->priv->find_in_all;
1417 _tmp16_ = gtk_toggle_tool_button_get_active (_tmp15_);
1418 _tmp17_ = _tmp16_;
1419 _tmp11_ = !_tmp17_;
1420 }
1421 _tmp18_ = _tmp11_;
1422 if (_tmp18_) {
1423 TrackerResultStore* _tmp19_;
1424 _tmp19_ = store;
1425 tracker_needle_search_finished (self, _tmp19_);
1426 result = FALSE;
1427 _g_object_unref0 (store);
1428 _g_free0 (criteria);
1429 _g_free0 (str);
1430 return result;
1431 }
1432 }
1433 _tmp20_ = criteria;
1434 _tmp21_ = TRUE;
1435 _tmp22_ = tracker_needle_search_history_find_or_insert (self, _tmp20_, &_tmp21_);
1436 _tmp23_ = _tmp22_;
1437 _g_free0 (_tmp23_);
1438 }
1439 _tmp24_ = self->priv->sw_noresults;
1440 gtk_widget_hide ((GtkWidget*) _tmp24_);
1441 _tmp25_ = self->priv->view_icons;
1442 _tmp26_ = gtk_toggle_tool_button_get_active (_tmp25_);
1443 _tmp27_ = _tmp26_;
1444 if (_tmp27_) {
1445 TrackerView* _tmp28_;
1446 GtkToggleToolButton* _tmp29_;
1447 gboolean _tmp30_;
1448 gboolean _tmp31_;
1449 TrackerView* _tmp36_;
1450 TrackerResultStore* _tmp37_;
1451 _tmp28_ = self->priv->sw_icons;
1452 gtk_widget_show ((GtkWidget*) _tmp28_);
1453 _tmp29_ = self->priv->find_in_all;
1454 _tmp30_ = gtk_toggle_tool_button_get_active (_tmp29_);
1455 _tmp31_ = _tmp30_;
1456 if (_tmp31_) {
1457 TrackerResultStore* _tmp32_;
1458 TrackerResultStore* _tmp33_;
1459 _tmp32_ = self->priv->images_model;
1460 _tmp33_ = _g_object_ref0 (_tmp32_);
1461 _g_object_unref0 (store);
1462 store = _tmp33_;
1463 } else {
1464 TrackerResultStore* _tmp34_;
1465 TrackerResultStore* _tmp35_;
1466 _tmp34_ = self->priv->images_in_title_model;
1467 _tmp35_ = _g_object_ref0 (_tmp34_);
1468 _g_object_unref0 (store);
1469 store = _tmp35_;
1470 }
1471 _tmp36_ = self->priv->sw_icons;
1472 _tmp37_ = store;
1473 tracker_view_set_store (_tmp36_, _tmp37_);
1474 } else {
1475 TrackerView* _tmp38_;
1476 _tmp38_ = self->priv->sw_icons;
1477 gtk_widget_hide ((GtkWidget*) _tmp38_);
1478 }
1479 _tmp39_ = self->priv->view_categories;
1480 _tmp40_ = gtk_toggle_tool_button_get_active (_tmp39_);
1481 _tmp41_ = _tmp40_;
1482 if (_tmp41_) {
1483 TrackerView* _tmp42_;
1484 TrackerResultStore* _tmp43_;
1485 TrackerResultStore* _tmp44_;
1486 _tmp42_ = self->priv->sw_categories;
1487 gtk_widget_show ((GtkWidget*) _tmp42_);
1488 _tmp43_ = self->priv->categories_model;
1489 _tmp44_ = _g_object_ref0 (_tmp43_);
1490 _g_object_unref0 (store);
1491 store = _tmp44_;
1492 } else {
1493 TrackerView* _tmp45_;
1494 _tmp45_ = self->priv->sw_categories;
1495 gtk_widget_hide ((GtkWidget*) _tmp45_);
1496 }
1497 _tmp46_ = self->priv->view_filelist;
1498 _tmp47_ = gtk_toggle_tool_button_get_active (_tmp46_);
1499 _tmp48_ = _tmp47_;
1500 if (_tmp48_) {
1501 TrackerView* _tmp49_;
1502 GtkToggleToolButton* _tmp50_;
1503 gboolean _tmp51_;
1504 gboolean _tmp52_;
1505 TrackerView* _tmp57_;
1506 TrackerResultStore* _tmp58_;
1507 _tmp49_ = self->priv->sw_filelist;
1508 gtk_widget_show ((GtkWidget*) _tmp49_);
1509 _tmp50_ = self->priv->find_in_contents;
1510 _tmp51_ = gtk_toggle_tool_button_get_active (_tmp50_);
1511 _tmp52_ = _tmp51_;
1512 if (_tmp52_) {
1513 TrackerResultStore* _tmp53_;
1514 TrackerResultStore* _tmp54_;
1515 _tmp53_ = self->priv->files_model;
1516 _tmp54_ = _g_object_ref0 (_tmp53_);
1517 _g_object_unref0 (store);
1518 store = _tmp54_;
1519 } else {
1520 TrackerResultStore* _tmp55_;
1521 TrackerResultStore* _tmp56_;
1522 _tmp55_ = self->priv->files_in_title_model;
1523 _tmp56_ = _g_object_ref0 (_tmp55_);
1524 _g_object_unref0 (store);
1525 store = _tmp56_;
1526 }
1527 _tmp57_ = self->priv->sw_filelist;
1528 _tmp58_ = store;
1529 tracker_view_set_store (_tmp57_, _tmp58_);
1530 } else {
1531 TrackerView* _tmp59_;
1532 _tmp59_ = self->priv->sw_filelist;
1533 gtk_widget_hide ((GtkWidget*) _tmp59_);
1534 }
1535 _tmp60_ = store;
1536 if (_tmp60_ != NULL) {
1537 TrackerResultStore* _tmp61_;
1538 TrackerResultStore* _tmp62_;
1539 GtkEntry* _tmp63_;
1540 const gchar* _tmp64_ = NULL;
1541 _tmp61_ = store;
1542 tracker_result_store_set_search_tags (_tmp61_, NULL);
1543 _tmp62_ = store;
1544 _tmp63_ = self->priv->search;
1545 _tmp64_ = gtk_entry_get_text (_tmp63_);
1546 tracker_result_store_set_search_term (_tmp62_, _tmp64_);
1547 }
1548 result = FALSE;
1549 _g_object_unref0 (store);
1550 _g_free0 (criteria);
1551 _g_free0 (str);
1552 return result;
1553 }
1554
1555
1556 static void tracker_needle_view_toggled (TrackerNeedle* self) {
1557 gboolean _tmp0_ = FALSE;
1558 gboolean _tmp1_ = FALSE;
1559 GtkToggleToolButton* _tmp2_;
1560 gboolean _tmp3_;
1561 gboolean _tmp4_;
1562 gboolean _tmp8_;
1563 gboolean _tmp12_;
1564 gboolean _tmp13_ = FALSE;
1565 GtkToggleToolButton* _tmp14_;
1566 gboolean _tmp15_;
1567 gboolean _tmp16_;
1568 gboolean _tmp20_;
1569 TrackerView* _tmp30_;
1570 TrackerView* _tmp31_;
1571 TrackerView* _tmp32_;
1572 TrackerView* _tmp33_;
1573 gboolean _tmp34_ = FALSE;
1574 GtkToggleToolButton* _tmp35_;
1575 gboolean _tmp36_;
1576 gboolean _tmp37_;
1577 GtkSeparatorToolItem* _tmp41_;
1578 gboolean _tmp42_;
1579 GtkToggleToolButton* _tmp43_;
1580 GtkToggleToolButton* _tmp44_;
1581 gboolean _tmp45_;
1582 gboolean _tmp46_;
1583 gboolean _tmp47_ = FALSE;
1584 GtkToggleToolButton* _tmp48_;
1585 gboolean _tmp49_;
1586 gboolean _tmp50_;
1587 GtkToggleToolButton* _tmp54_;
1588 gboolean _tmp55_;
1589 GtkToggleToolButton* _tmp56_;
1590 GtkToggleToolButton* _tmp57_;
1591 gboolean _tmp58_;
1592 gboolean _tmp59_;
1593 g_return_if_fail (self != NULL);
1594 _tmp2_ = self->priv->view_icons;
1595 _tmp3_ = gtk_toggle_tool_button_get_active (_tmp2_);
1596 _tmp4_ = _tmp3_;
1597 if (!_tmp4_) {
1598 GtkToggleToolButton* _tmp5_;
1599 gboolean _tmp6_;
1600 gboolean _tmp7_;
1601 _tmp5_ = self->priv->view_filelist;
1602 _tmp6_ = gtk_toggle_tool_button_get_active (_tmp5_);
1603 _tmp7_ = _tmp6_;
1604 _tmp1_ = !_tmp7_;
1605 } else {
1606 _tmp1_ = FALSE;
1607 }
1608 _tmp8_ = _tmp1_;
1609 if (_tmp8_) {
1610 GtkToggleToolButton* _tmp9_;
1611 gboolean _tmp10_;
1612 gboolean _tmp11_;
1613 _tmp9_ = self->priv->view_categories;
1614 _tmp10_ = gtk_toggle_tool_button_get_active (_tmp9_);
1615 _tmp11_ = _tmp10_;
1616 _tmp0_ = !_tmp11_;
1617 } else {
1618 _tmp0_ = FALSE;
1619 }
1620 _tmp12_ = _tmp0_;
1621 if (_tmp12_) {
1622 return;
1623 }
1624 _tmp14_ = self->priv->view_categories;
1625 _tmp15_ = gtk_toggle_tool_button_get_active (_tmp14_);
1626 _tmp16_ = _tmp15_;
1627 if (_tmp16_) {
1628 _tmp13_ = TRUE;
1629 } else {
1630 GtkToggleToolButton* _tmp17_;
1631 gboolean _tmp18_;
1632 gboolean _tmp19_;
1633 _tmp17_ = self->priv->view_filelist;
1634 _tmp18_ = gtk_toggle_tool_button_get_active (_tmp17_);
1635 _tmp19_ = _tmp18_;
1636 _tmp13_ = _tmp19_;
1637 }
1638 _tmp20_ = _tmp13_;
1639 if (_tmp20_) {
1640 gboolean _tmp21_;
1641 _tmp21_ = tracker_needle_current_find_in_filelist;
1642 if (_tmp21_) {
1643 GtkToggleToolButton* _tmp22_;
1644 _tmp22_ = self->priv->find_in_contents;
1645 gtk_toggle_tool_button_set_active (_tmp22_, TRUE);
1646 } else {
1647 GtkToggleToolButton* _tmp23_;
1648 _tmp23_ = self->priv->find_in_titles;
1649 gtk_toggle_tool_button_set_active (_tmp23_, TRUE);
1650 }
1651 } else {
1652 GtkToggleToolButton* _tmp24_;
1653 gboolean _tmp25_;
1654 gboolean _tmp26_;
1655 _tmp24_ = self->priv->view_icons;
1656 _tmp25_ = gtk_toggle_tool_button_get_active (_tmp24_);
1657 _tmp26_ = _tmp25_;
1658 if (_tmp26_) {
1659 gboolean _tmp27_;
1660 _tmp27_ = tracker_needle_current_find_in_icons;
1661 if (_tmp27_) {
1662 GtkToggleToolButton* _tmp28_;
1663 _tmp28_ = self->priv->find_in_titles;
1664 gtk_toggle_tool_button_set_active (_tmp28_, TRUE);
1665 } else {
1666 GtkToggleToolButton* _tmp29_;
1667 _tmp29_ = self->priv->find_in_all;
1668 gtk_toggle_tool_button_set_active (_tmp29_, TRUE);
1669 }
1670 }
1671 }
1672 _tmp30_ = self->priv->sw_noresults;
1673 gtk_widget_show ((GtkWidget*) _tmp30_);
1674 _tmp31_ = self->priv->sw_icons;
1675 gtk_widget_hide ((GtkWidget*) _tmp31_);
1676 _tmp32_ = self->priv->sw_filelist;
1677 gtk_widget_hide ((GtkWidget*) _tmp32_);
1678 _tmp33_ = self->priv->sw_categories;
1679 gtk_widget_hide ((GtkWidget*) _tmp33_);
1680 _tmp35_ = self->priv->view_filelist;
1681 _tmp36_ = gtk_toggle_tool_button_get_active (_tmp35_);
1682 _tmp37_ = _tmp36_;
1683 if (_tmp37_) {
1684 _tmp34_ = TRUE;
1685 } else {
1686 GtkToggleToolButton* _tmp38_;
1687 gboolean _tmp39_;
1688 gboolean _tmp40_;
1689 _tmp38_ = self->priv->view_icons;
1690 _tmp39_ = gtk_toggle_tool_button_get_active (_tmp38_);
1691 _tmp40_ = _tmp39_;
1692 _tmp34_ = _tmp40_;
1693 }
1694 _tmp41_ = self->priv->separator_secondary;
1695 _tmp42_ = _tmp34_;
1696 gtk_widget_set_visible ((GtkWidget*) _tmp41_, _tmp42_);
1697 _tmp43_ = self->priv->find_in_contents;
1698 _tmp44_ = self->priv->view_filelist;
1699 _tmp45_ = gtk_toggle_tool_button_get_active (_tmp44_);
1700 _tmp46_ = _tmp45_;
1701 gtk_widget_set_visible ((GtkWidget*) _tmp43_, _tmp46_);
1702 _tmp48_ = self->priv->view_filelist;
1703 _tmp49_ = gtk_toggle_tool_button_get_active (_tmp48_);
1704 _tmp50_ = _tmp49_;
1705 if (_tmp50_) {
1706 _tmp47_ = TRUE;
1707 } else {
1708 GtkToggleToolButton* _tmp51_;
1709 gboolean _tmp52_;
1710 gboolean _tmp53_;
1711 _tmp51_ = self->priv->view_icons;
1712 _tmp52_ = gtk_toggle_tool_button_get_active (_tmp51_);
1713 _tmp53_ = _tmp52_;
1714 _tmp47_ = _tmp53_;
1715 }
1716 _tmp54_ = self->priv->find_in_titles;
1717 _tmp55_ = _tmp47_;
1718 gtk_widget_set_visible ((GtkWidget*) _tmp54_, _tmp55_);
1719 _tmp56_ = self->priv->find_in_all;
1720 _tmp57_ = self->priv->view_icons;
1721 _tmp58_ = gtk_toggle_tool_button_get_active (_tmp57_);
1722 _tmp59_ = _tmp58_;
1723 gtk_widget_set_visible ((GtkWidget*) _tmp56_, _tmp59_);
1724 tracker_needle_search_run (self);
1725 }
1726
1727
1728 static void tracker_needle_find_in_toggled (TrackerNeedle* self) {
1729 gboolean _tmp0_ = FALSE;
1730 gboolean _tmp1_ = FALSE;
1731 GtkToggleToolButton* _tmp2_;
1732 gboolean _tmp3_;
1733 gboolean _tmp4_;
1734 gboolean _tmp8_;
1735 gboolean _tmp12_;
1736 GtkToggleToolButton* _tmp13_;
1737 gboolean _tmp14_;
1738 gboolean _tmp15_;
1739 GtkToggleToolButton* _tmp31_;
1740 gboolean _tmp32_;
1741 gboolean _tmp33_;
1742 g_return_if_fail (self != NULL);
1743 _tmp2_ = self->priv->find_in_contents;
1744 _tmp3_ = gtk_toggle_tool_button_get_active (_tmp2_);
1745 _tmp4_ = _tmp3_;
1746 if (!_tmp4_) {
1747 GtkToggleToolButton* _tmp5_;
1748 gboolean _tmp6_;
1749 gboolean _tmp7_;
1750 _tmp5_ = self->priv->find_in_titles;
1751 _tmp6_ = gtk_toggle_tool_button_get_active (_tmp5_);
1752 _tmp7_ = _tmp6_;
1753 _tmp1_ = !_tmp7_;
1754 } else {
1755 _tmp1_ = FALSE;
1756 }
1757 _tmp8_ = _tmp1_;
1758 if (_tmp8_) {
1759 GtkToggleToolButton* _tmp9_;
1760 gboolean _tmp10_;
1761 gboolean _tmp11_;
1762 _tmp9_ = self->priv->find_in_all;
1763 _tmp10_ = gtk_toggle_tool_button_get_active (_tmp9_);
1764 _tmp11_ = _tmp10_;
1765 _tmp0_ = !_tmp11_;
1766 } else {
1767 _tmp0_ = FALSE;
1768 }
1769 _tmp12_ = _tmp0_;
1770 if (_tmp12_) {
1771 return;
1772 }
1773 _tmp13_ = self->priv->find_in_contents;
1774 _tmp14_ = gtk_toggle_tool_button_get_active (_tmp13_);
1775 _tmp15_ = _tmp14_;
1776 if (_tmp15_) {
1777 GtkToggleToolButton* _tmp16_;
1778 gboolean _tmp17_;
1779 gboolean _tmp18_;
1780 g_debug ("tracker-needle.vala:552: Find in toggled to 'contents'");
1781 _tmp16_ = self->priv->show_tags;
1782 _tmp17_ = gtk_toggle_tool_button_get_active (_tmp16_);
1783 _tmp18_ = _tmp17_;
1784 if (_tmp18_ != TRUE) {
1785 GtkToolItem* _tmp19_;
1786 _tmp19_ = self->priv->search_entry;
1787 gtk_widget_set_sensitive ((GtkWidget*) _tmp19_, TRUE);
1788 }
1789 tracker_needle_search_run (self);
1790 } else {
1791 GtkToggleToolButton* _tmp20_;
1792 gboolean _tmp21_;
1793 gboolean _tmp22_;
1794 _tmp20_ = self->priv->find_in_titles;
1795 _tmp21_ = gtk_toggle_tool_button_get_active (_tmp20_);
1796 _tmp22_ = _tmp21_;
1797 if (_tmp22_) {
1798 GtkToggleToolButton* _tmp23_;
1799 gboolean _tmp24_;
1800 gboolean _tmp25_;
1801 g_debug ("tracker-needle.vala:560: Find in toggled to 'titles'");
1802 _tmp23_ = self->priv->show_tags;
1803 _tmp24_ = gtk_toggle_tool_button_get_active (_tmp23_);
1804 _tmp25_ = _tmp24_;
1805 if (_tmp25_ != TRUE) {
1806 GtkToolItem* _tmp26_;
1807 _tmp26_ = self->priv->search_entry;
1808 gtk_widget_set_sensitive ((GtkWidget*) _tmp26_, TRUE);
1809 }
1810 tracker_needle_search_run (self);
1811 } else {
1812 GtkToggleToolButton* _tmp27_;
1813 gboolean _tmp28_;
1814 gboolean _tmp29_;
1815 _tmp27_ = self->priv->find_in_all;
1816 _tmp28_ = gtk_toggle_tool_button_get_active (_tmp27_);
1817 _tmp29_ = _tmp28_;
1818 if (_tmp29_) {
1819 GtkToolItem* _tmp30_;
1820 g_debug ("tracker-needle.vala:568: Find in toggled to 'all'");
1821 _tmp30_ = self->priv->search_entry;
1822 gtk_widget_set_sensitive ((GtkWidget*) _tmp30_, FALSE);
1823 tracker_needle_search_run (self);
1824 }
1825 }
1826 }
1827 _tmp31_ = self->priv->view_filelist;
1828 _tmp32_ = gtk_toggle_tool_button_get_active (_tmp31_);
1829 _tmp33_ = _tmp32_;
1830 if (_tmp33_) {
1831 GtkToggleToolButton* _tmp34_;
1832 gboolean _tmp35_;
1833 gboolean _tmp36_;
1834 _tmp34_ = self->priv->find_in_contents;
1835 _tmp35_ = gtk_toggle_tool_button_get_active (_tmp34_);
1836 _tmp36_ = _tmp35_;
1837 tracker_needle_current_find_in_filelist = _tmp36_;
1838 } else {
1839 GtkToggleToolButton* _tmp37_;
1840 gboolean _tmp38_;
1841 gboolean _tmp39_;
1842 _tmp37_ = self->priv->view_icons;
1843 _tmp38_ = gtk_toggle_tool_button_get_active (_tmp37_);
1844 _tmp39_ = _tmp38_;
1845 if (_tmp39_) {
1846 GtkToggleToolButton* _tmp40_;
1847 gboolean _tmp41_;
1848 gboolean _tmp42_;
1849 _tmp40_ = self->priv->find_in_titles;
1850 _tmp41_ = gtk_toggle_tool_button_get_active (_tmp40_);
1851 _tmp42_ = _tmp41_;
1852 tracker_needle_current_find_in_icons = _tmp42_;
1853 }
1854 }
1855 }
1856
1857
1858 static void tracker_needle_view_row_activated (TrackerNeedle* self, GtkTreeView* view, GtkTreePath* path, GtkTreeViewColumn* column) {
1859 GtkTreeView* _tmp0_;
1860 GtkTreeModel* _tmp1_ = NULL;
1861 GtkTreeModel* _tmp2_;
1862 GtkTreeModel* model;
1863 GtkTreePath* _tmp3_;
1864 g_return_if_fail (self != NULL);
1865 g_return_if_fail (view != NULL);
1866 g_return_if_fail (path != NULL);
1867 g_return_if_fail (column != NULL);
1868 _tmp0_ = view;
1869 _tmp1_ = gtk_tree_view_get_model (_tmp0_);
1870 _tmp2_ = _g_object_ref0 (_tmp1_);
1871 model = _tmp2_;
1872 _tmp3_ = path;
1873 tracker_model_launch_selected (model, _tmp3_, 1);
1874 _g_object_unref0 (model);
1875 }
1876
1877
1878 static void tracker_needle_icon_item_activated (TrackerNeedle* self, GtkIconView* view, GtkTreePath* path) {
1879 GtkIconView* _tmp0_;
1880 GtkTreeModel* _tmp1_ = NULL;
1881 GtkTreeModel* _tmp2_;
1882 GtkTreeModel* model;
1883 GtkTreePath* _tmp3_;
1884 g_return_if_fail (self != NULL);
1885 g_return_if_fail (view != NULL);
1886 g_return_if_fail (path != NULL);
1887 _tmp0_ = view;
1888 _tmp1_ = gtk_icon_view_get_model (_tmp0_);
1889 _tmp2_ = _g_object_ref0 (_tmp1_);
1890 model = _tmp2_;
1891 _tmp3_ = path;
1892 tracker_model_launch_selected (model, _tmp3_, 1);
1893 _g_object_unref0 (model);
1894 }
1895
1896
1897 static void _g_free0_ (gpointer var) {
1898 var = (g_free (var), NULL);
1899 }
1900
1901
1902 static void _g_list_free__g_free0_ (GList* self) {
1903 g_list_foreach (self, (GFunc) _g_free0_, NULL);
1904 g_list_free (self);
1905 }
1906
1907
1908 static void _gtk_tree_path_free0_ (gpointer var) {
1909 (var == NULL) ? NULL : (var = (gtk_tree_path_free (var), NULL));
1910 }
1911
1912
1913 static void _g_list_free__gtk_tree_path_free0_ (GList* self) {
1914 g_list_foreach (self, (GFunc) _gtk_tree_path_free0_, NULL);
1915 g_list_free (self);
1916 }
1917
1918
1919 static gpointer _gtk_tree_path_copy0 (gpointer self) {
1920 return self ? gtk_tree_path_copy (self) : NULL;
1921 }
1922
1923
1924 static void tracker_needle_view_row_selected (TrackerNeedle* self, GtkTreeSelection* selection) {
1925 GtkTreeIter iter = {0};
1926 GtkTreeModel* model;
1927 GtkTreeSelection* _tmp0_;
1928 GtkTreeModel* _tmp1_ = NULL;
1929 GList* _tmp2_ = NULL;
1930 GtkTreeModel* _tmp3_;
1931 GList* rows;
1932 GList* uris;
1933 GList* _tmp4_;
1934 GList* _tmp5_;
1935 TrackerTagsView* _tmp17_;
1936 GList* _tmp18_;
1937 g_return_if_fail (self != NULL);
1938 g_return_if_fail (selection != NULL);
1939 model = NULL;
1940 g_debug ("tracker-needle.vala:596: Row selection changed");
1941 _tmp0_ = selection;
1942 _tmp2_ = gtk_tree_selection_get_selected_rows (_tmp0_, &_tmp1_);
1943 _g_object_unref0 (model);
1944 _tmp3_ = _g_object_ref0 (_tmp1_);
1945 model = _tmp3_;
1946 rows = _tmp2_;
1947 uris = NULL;
1948 _tmp4_ = rows;
1949 if (_tmp4_ == NULL) {
1950 __g_list_free__g_free0_0 (uris);
1951 __g_list_free__gtk_tree_path_free0_0 (rows);
1952 _g_object_unref0 (model);
1953 return;
1954 }
1955 _tmp5_ = rows;
1956 {
1957 GList* path_collection = NULL;
1958 GList* path_it = NULL;
1959 path_collection = _tmp5_;
1960 for (path_it = path_collection; path_it != NULL; path_it = path_it->next) {
1961 GtkTreePath* _tmp6_;
1962 GtkTreePath* path = NULL;
1963 _tmp6_ = _gtk_tree_path_copy0 ((GtkTreePath*) path_it->data);
1964 path = _tmp6_;
1965 {
1966 GtkTreeModel* _tmp7_;
1967 GtkTreePath* _tmp8_;
1968 GtkTreeIter _tmp9_ = {0};
1969 gboolean _tmp10_ = FALSE;
1970 _tmp7_ = model;
1971 _tmp8_ = path;
1972 _tmp10_ = gtk_tree_model_get_iter (_tmp7_, &_tmp9_, _tmp8_);
1973 iter = _tmp9_;
1974 if (_tmp10_) {
1975 gchar* uri = NULL;
1976 GtkTreeModel* _tmp11_;
1977 GtkTreeIter _tmp12_;
1978 const gchar* _tmp13_;
1979 const gchar* _tmp14_;
1980 _tmp11_ = model;
1981 _tmp12_ = iter;
1982 gtk_tree_model_get (_tmp11_, &_tmp12_, 1, &uri, -1, -1);
1983 _tmp13_ = uri;
1984 g_debug ("tracker-needle.vala:610: --> %s", _tmp13_);
1985 _tmp14_ = uri;
1986 if (_tmp14_ != NULL) {
1987 const gchar* _tmp15_;
1988 gchar* _tmp16_;
1989 _tmp15_ = uri;
1990 _tmp16_ = g_strdup (_tmp15_);
1991 uris = g_list_prepend (uris, _tmp16_);
1992 }
1993 _g_free0 (uri);
1994 }
1995 _gtk_tree_path_free0 (path);
1996 }
1997 }
1998 }
1999 _tmp17_ = self->priv->tags_view;
2000 _tmp18_ = uris;
2001 tracker_tags_view_set_files (_tmp17_, _tmp18_);
2002 __g_list_free__g_free0_0 (uris);
2003 __g_list_free__gtk_tree_path_free0_0 (rows);
2004 _g_object_unref0 (model);
2005 }
2006
2007
2008 static Block4Data* block4_data_ref (Block4Data* _data4_) {
2009 g_atomic_int_inc (&_data4_->_ref_count_);
2010 return _data4_;
2011 }
2012
2013
2014 static void block4_data_unref (void * _userdata_) {
2015 Block4Data* _data4_;
2016 _data4_ = (Block4Data*) _userdata_;
2017 if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
2018 TrackerNeedle * self;
2019 self = _data4_->self;
2020 __g_list_free__g_free0_0 (_data4_->uris);
2021 _g_object_unref0 (_data4_->model);
2022 _tracker_needle_unref0 (self);
2023 g_slice_free (Block4Data, _data4_);
2024 }
2025 }
2026
2027
2028 static void __lambda6_ (Block4Data* _data4_, GtkIconView* iconview, GtkTreePath* path) {
2029 TrackerNeedle * self;
variable 'self' set but not used
(emitted by gcc)
2030 GtkTreeIter iter = {0};
2031 GtkTreeModel* _tmp0_;
2032 GtkTreePath* _tmp1_;
2033 GtkTreeIter _tmp2_ = {0};
2034 gboolean _tmp3_ = FALSE;
2035 self = _data4_->self;
2036 g_return_if_fail (iconview != NULL);
2037 g_return_if_fail (path != NULL);
2038 _tmp0_ = _data4_->model;
2039 _tmp1_ = path;
2040 _tmp3_ = gtk_tree_model_get_iter (_tmp0_, &_tmp2_, _tmp1_);
2041 iter = _tmp2_;
2042 if (_tmp3_) {
2043 gchar* uri = NULL;
2044 GtkTreeModel* _tmp4_;
2045 GtkTreeIter _tmp5_;
2046 const gchar* _tmp6_;
2047 const gchar* _tmp7_;
2048 _tmp4_ = _data4_->model;
2049 _tmp5_ = iter;
2050 gtk_tree_model_get (_tmp4_, &_tmp5_, 1, &uri, -1, -1);
2051 _tmp6_ = uri;
2052 g_debug ("tracker-needle.vala:637: --> %s", _tmp6_);
2053 _tmp7_ = uri;
2054 if (_tmp7_ != NULL) {
2055 const gchar* _tmp8_;
2056 gchar* _tmp9_;
2057 _tmp8_ = uri;
2058 _tmp9_ = g_strdup (_tmp8_);
2059 _data4_->uris = g_list_prepend (_data4_->uris, _tmp9_);
2060 }
2061 _g_free0 (uri);
2062 }
2063 }
2064
2065
2066 static void ___lambda6__gtk_icon_view_foreach_func (GtkIconView* icon_view, GtkTreePath* path, gpointer self) {
2067 __lambda6_ (self, icon_view, path);
2068 }
2069
2070
2071 static void tracker_needle_icon_view_selection_changed (TrackerNeedle* self) {
2072 Block4Data* _data4_;
2073 GtkIconView* iconview = NULL;
2074 TrackerView* _tmp0_;
2075 GtkWidget* _tmp1_ = NULL;
2076 GtkIconView* _tmp2_;
2077 GtkTreeModel* _tmp3_ = NULL;
2078 GtkTreeModel* _tmp4_;
2079 TrackerTagsView* _tmp5_;
2080 g_return_if_fail (self != NULL);
2081 _data4_ = g_slice_new0 (Block4Data);
2082 _data4_->_ref_count_ = 1;
2083 _data4_->self = tracker_needle_ref (self);
2084 _data4_->model = NULL;
2085 g_debug ("tracker-needle.vala:624: Icon selection changed");
2086 _tmp0_ = self->priv->sw_icons;
2087 _tmp1_ = gtk_bin_get_child ((GtkBin*) _tmp0_);
2088 _tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_CAST (_tmp1_, GTK_TYPE_ICON_VIEW, GtkIconView));
2089 _g_object_unref0 (iconview);
2090 iconview = _tmp2_;
2091 _tmp3_ = gtk_icon_view_get_model (iconview);
2092 _tmp4_ = _g_object_ref0 (_tmp3_);
2093 _g_object_unref0 (_data4_->model);
2094 _data4_->model = _tmp4_;
2095 _data4_->uris = NULL;
2096 gtk_icon_view_selected_foreach (iconview, ___lambda6__gtk_icon_view_foreach_func, _data4_);
2097 _tmp5_ = self->priv->tags_view;
2098 tracker_tags_view_set_files (_tmp5_, _data4_->uris);
2099 _g_object_unref0 (iconview);
2100 block4_data_unref (_data4_);
2101 _data4_ = NULL;
2102 }
2103
2104
2105 static void tracker_needle_show_tags_clicked (TrackerNeedle* self) {
2106 GtkToggleToolButton* _tmp0_;
2107 gboolean _tmp1_;
2108 gboolean _tmp2_;
2109 g_return_if_fail (self != NULL);
2110 _tmp0_ = self->priv->show_tags;
2111 _tmp1_ = gtk_toggle_tool_button_get_active (_tmp0_);
2112 _tmp2_ = _tmp1_;
2113 if (_tmp2_) {
2114 TrackerTagsView* _tmp3_;
2115 g_debug ("tracker-needle.vala:650: Showing tags");
2116 _tmp3_ = self->priv->tags_view;
2117 gtk_widget_show ((GtkWidget*) _tmp3_);
2118 } else {
2119 TrackerTagsView* _tmp4_;
2120 g_debug ("tracker-needle.vala:654: Hiding tags");
2121 _tmp4_ = self->priv->tags_view;
2122 gtk_widget_hide ((GtkWidget*) _tmp4_);
2123 }
2124 }
2125
2126
2127 static void tracker_needle_show_stats_clicked (TrackerNeedle* self) {
2128 TrackerStats* _tmp0_;
2129 TrackerStats* s;
2130 g_return_if_fail (self != NULL);
2131 g_debug ("tracker-needle.vala:664: Showing stats dialog");
2132 _tmp0_ = tracker_stats_new ();
2133 g_object_ref_sink (_tmp0_);
2134 s = _tmp0_;
2135 gtk_widget_show ((GtkWidget*) s);
2136 _g_object_unref0 (s);
2137 }
2138
2139
2140 void tracker_needle_show_info_message (TrackerNeedle* self, const gchar* message, GtkMessageType type) {
2141 GtkInfoBar* _tmp0_;
2142 GtkMessageType _tmp1_;
2143 GtkLabel* _tmp2_;
2144 const gchar* _tmp3_;
2145 GtkInfoBar* _tmp4_;
2146 g_return_if_fail (self != NULL);
2147 g_return_if_fail (message != NULL);
2148 _tmp0_ = self->priv->info_bar;
2149 _tmp1_ = type;
2150 gtk_info_bar_set_message_type (_tmp0_, _tmp1_);
2151 _tmp2_ = self->priv->info_bar_label;
2152 _tmp3_ = message;
2153 gtk_label_set_markup (_tmp2_, _tmp3_);
2154 _tmp4_ = self->priv->info_bar;
2155 gtk_widget_show ((GtkWidget*) _tmp4_);
2156 }
2157
2158
2159 static void tracker_needle_info_bar_closed (TrackerNeedle* self, GtkButton* source) {
2160 GtkInfoBar* _tmp0_;
2161 g_return_if_fail (self != NULL);
2162 g_return_if_fail (source != NULL);
2163 _tmp0_ = self->priv->info_bar;
2164 gtk_widget_hide ((GtkWidget*) _tmp0_);
2165 }
2166
2167
2168 static void tracker_value_needle_init (GValue* value) {
2169 value->data[0].v_pointer = NULL;
2170 }
2171
2172
2173 static void tracker_value_needle_free_value (GValue* value) {
2174 if (value->data[0].v_pointer) {
2175 tracker_needle_unref (value->data[0].v_pointer);
2176 }
2177 }
2178
2179
2180 static void tracker_value_needle_copy_value (const GValue* src_value, GValue* dest_value) {
2181 if (src_value->data[0].v_pointer) {
2182 dest_value->data[0].v_pointer = tracker_needle_ref (src_value->data[0].v_pointer);
2183 } else {
2184 dest_value->data[0].v_pointer = NULL;
2185 }
2186 }
2187
2188
2189 static gpointer tracker_value_needle_peek_pointer (const GValue* value) {
2190 return value->data[0].v_pointer;
2191 }
2192
2193
2194 static gchar* tracker_value_needle_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
2195 if (collect_values[0].v_pointer) {
2196 TrackerNeedle* object;
2197 object = collect_values[0].v_pointer;
2198 if (object->parent_instance.g_class == NULL) {
2199 return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
2200 } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
2201 return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
2202 }
2203 value->data[0].v_pointer = tracker_needle_ref (object);
2204 } else {
2205 value->data[0].v_pointer = NULL;
2206 }
2207 return NULL;
2208 }
2209
2210
2211 static gchar* tracker_value_needle_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
2212 TrackerNeedle** object_p;
2213 object_p = collect_values[0].v_pointer;
2214 if (!object_p) {
2215 return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
2216 }
2217 if (!value->data[0].v_pointer) {
2218 *object_p = NULL;
2219 } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
2220 *object_p = value->data[0].v_pointer;
2221 } else {
2222 *object_p = tracker_needle_ref (value->data[0].v_pointer);
2223 }
2224 return NULL;
2225 }
2226
2227
2228 GParamSpec* tracker_param_spec_needle (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
2229 TrackerParamSpecNeedle* spec;
2230 g_return_val_if_fail (g_type_is_a (object_type, TRACKER_TYPE_NEEDLE), NULL);
2231 spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
2232 G_PARAM_SPEC (spec)->value_type = object_type;
2233 return G_PARAM_SPEC (spec);
2234 }
2235
2236
2237 gpointer tracker_value_get_needle (const GValue* value) {
2238 g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_NEEDLE), NULL);
2239 return value->data[0].v_pointer;
2240 }
2241
2242
2243 void tracker_value_set_needle (GValue* value, gpointer v_object) {
2244 TrackerNeedle* old;
2245 g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_NEEDLE));
2246 old = value->data[0].v_pointer;
2247 if (v_object) {
2248 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_NEEDLE));
2249 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
2250 value->data[0].v_pointer = v_object;
2251 tracker_needle_ref (value->data[0].v_pointer);
2252 } else {
2253 value->data[0].v_pointer = NULL;
2254 }
2255 if (old) {
2256 tracker_needle_unref (old);
2257 }
2258 }
2259
2260
2261 void tracker_value_take_needle (GValue* value, gpointer v_object) {
2262 TrackerNeedle* old;
2263 g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TRACKER_TYPE_NEEDLE));
2264 old = value->data[0].v_pointer;
2265 if (v_object) {
2266 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TRACKER_TYPE_NEEDLE));
2267 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
2268 value->data[0].v_pointer = v_object;
2269 } else {
2270 value->data[0].v_pointer = NULL;
2271 }
2272 if (old) {
2273 tracker_needle_unref (old);
2274 }
2275 }
2276
2277
2278 static void tracker_needle_class_init (TrackerNeedleClass * klass) {
2279 tracker_needle_parent_class = g_type_class_peek_parent (klass);
2280 TRACKER_NEEDLE_CLASS (klass)->finalize = tracker_needle_finalize;
2281 g_type_class_add_private (klass, sizeof (TrackerNeedlePrivate));
2282 }
2283
2284
2285 static void tracker_needle_instance_init (TrackerNeedle * self) {
2286 self->priv = TRACKER_NEEDLE_GET_PRIVATE (self);
2287 self->priv->last_search_id = (guint) 0;
2288 self->priv->size_small = 0;
2289 self->priv->size_medium = 0;
2290 self->priv->size_big = 0;
2291 self->priv->limit = (guint) 500;
2292 self->ref_count = 1;
2293 }
2294
2295
2296 static void tracker_needle_finalize (TrackerNeedle* obj) {
2297 TrackerNeedle * self;
2298 self = G_TYPE_CHECK_INSTANCE_CAST (obj, TRACKER_TYPE_NEEDLE, TrackerNeedle);
2299 _tracker_history_unref0 (self->priv->history);
2300 _g_object_unref0 (self->priv->window);
2301 _g_object_unref0 (self->priv->view_categories);
2302 _g_object_unref0 (self->priv->view_filelist);
2303 _g_object_unref0 (self->priv->view_icons);
2304 _g_object_unref0 (self->priv->separator_secondary);
2305 _g_object_unref0 (self->priv->find_in_contents);
2306 _g_object_unref0 (self->priv->find_in_titles);
2307 _g_object_unref0 (self->priv->find_in_all);
2308 _g_object_unref0 (self->priv->search_entry);
2309 _g_object_unref0 (self->priv->search_list);
2310 _g_object_unref0 (self->priv->search);
2311 _g_object_unref0 (self->priv->spinner);
2312 _g_object_unref0 (self->priv->spinner_shell);
2313 _g_object_unref0 (self->priv->show_tags);
2314 _g_object_unref0 (self->priv->show_stats);
2315 _g_object_unref0 (self->priv->view);
2316 _g_object_unref0 (self->priv->sw_noresults);
2317 _g_object_unref0 (self->priv->sw_categories);
2318 _g_object_unref0 (self->priv->sw_filelist);
2319 _g_object_unref0 (self->priv->sw_icons);
2320 _g_object_unref0 (self->priv->info_bar);
2321 _g_object_unref0 (self->priv->info_bar_label);
2322 _g_object_unref0 (self->priv->tags_view);
2323 _g_object_unref0 (self->priv->categories_model);
2324 _g_object_unref0 (self->priv->files_model);
2325 _g_object_unref0 (self->priv->files_in_title_model);
2326 _g_object_unref0 (self->priv->images_model);
2327 _g_object_unref0 (self->priv->images_in_title_model);
2328 }
2329
2330
2331 GType tracker_needle_get_type (void) {
2332 static volatile gsize tracker_needle_type_id__volatile = 0;
2333 if (g_once_init_enter (&tracker_needle_type_id__volatile)) {
2334 static const GTypeValueTable g_define_type_value_table = { tracker_value_needle_init, tracker_value_needle_free_value, tracker_value_needle_copy_value, tracker_value_needle_peek_pointer, "p", tracker_value_needle_collect_value, "p", tracker_value_needle_lcopy_value };
2335 static const GTypeInfo g_define_type_info = { sizeof (TrackerNeedleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tracker_needle_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TrackerNeedle), 0, (GInstanceInitFunc) tracker_needle_instance_init, &g_define_type_value_table };
2336 static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
2337 GType tracker_needle_type_id;
2338 tracker_needle_type_id = g_type_register_fundamental (g_type_fundamental_next (), "TrackerNeedle", &g_define_type_info, &g_define_type_fundamental_info, 0);
2339 g_once_init_leave (&tracker_needle_type_id__volatile, tracker_needle_type_id);
2340 }
2341 return tracker_needle_type_id__volatile;
2342 }
2343
2344
2345 gpointer tracker_needle_ref (gpointer instance) {
2346 TrackerNeedle* self;
2347 self = instance;
2348 g_atomic_int_inc (&self->ref_count);
2349 return instance;
2350 }
2351
2352
2353 void tracker_needle_unref (gpointer instance) {
2354 TrackerNeedle* self;
2355 self = instance;
2356 if (g_atomic_int_dec_and_test (&self->ref_count)) {
2357 TRACKER_NEEDLE_GET_CLASS (self)->finalize (self);
2358 g_type_free_instance ((GTypeInstance *) self);
2359 }
2360 }
2361
2362
2363 gint _vala_main (gchar** args, int args_length1) {
2364 gint result = 0;
2365 const gchar* _tmp0_ = NULL;
2366 GOptionContext* _tmp1_;
2367 GOptionContext* context;
2368 gboolean _tmp14_;
2369 TrackerNeedle* _tmp39_;
2370 TrackerNeedle* n;
2371 TrackerNeedle* _tmp40_;
2372 TrackerNeedle* _tmp41_;
2373 gchar** _tmp42_;
2374 gint _tmp42__length1;
2375 GError * _inner_error_ = NULL;
2376 _tmp0_ = _ ("Desktop Search user interface using Tracker");
2377 _tmp1_ = g_option_context_new (_tmp0_);
2378 context = _tmp1_;
2379 {
2380 GOptionContext* _tmp2_;
2381 GOptionContext* _tmp3_;
2382 GOptionContext* _tmp4_;
2383 GOptionGroup* _tmp5_ = NULL;
2384 GOptionContext* _tmp6_;
2385 _tmp2_ = context;
2386 g_option_context_set_help_enabled (_tmp2_, TRUE);
2387 _tmp3_ = context;
2388 g_option_context_add_main_entries (_tmp3_, options, NULL);
2389 _tmp4_ = context;
2390 _tmp5_ = gtk_get_option_group (TRUE);
2391 g_option_context_add_group (_tmp4_, _tmp5_);
2392 _tmp6_ = context;
2393 g_option_context_parse (_tmp6_, &args_length1, &args, &_inner_error_);
2394 if (_inner_error_ != NULL) {
2395 goto __catch30_g_error;
2396 }
2397 }
2398 goto __finally30;
2399 __catch30_g_error:
2400 {
2401 GError* e = NULL;
2402 GError* _tmp7_;
2403 const gchar* _tmp8_;
2404 gchar* _tmp9_;
2405 gchar* _tmp10_;
2406 GOptionContext* _tmp11_;
2407 gchar* _tmp12_ = NULL;
2408 gchar* _tmp13_;
2409 e = _inner_error_;
2410 _inner_error_ = NULL;
2411 _tmp7_ = e;
2412 _tmp8_ = _tmp7_->message;
2413 _tmp9_ = g_strconcat (_tmp8_, "\n\n", NULL);
2414 _tmp10_ = _tmp9_;
2415 g_printerr ("%s", _tmp10_);
2416 _g_free0 (_tmp10_);
2417 _tmp11_ = context;
2418 _tmp12_ = g_option_context_get_help (_tmp11_, TRUE, NULL);
2419 _tmp13_ = _tmp12_;
2420 g_printerr ("%s", _tmp13_);
2421 _g_free0 (_tmp13_);
2422 result = 1;
2423 _g_error_free0 (e);
2424 _g_option_context_free0 (context);
2425 return result;
2426 }
2427 __finally30:
2428 if (_inner_error_ != NULL) {
2429 _g_option_context_free0 (context);
2430 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);
2431 g_clear_error (&_inner_error_);
2432 return 0;
2433 }
2434 _tmp14_ = print_version;
2435 if (_tmp14_) {
2436 gchar* _tmp15_;
2437 gchar* about;
2438 gchar* _tmp16_;
2439 gchar* license;
2440 const gchar* _tmp17_;
2441 gchar* _tmp18_;
2442 const gchar* _tmp19_;
2443 gchar* _tmp20_;
2444 const gchar* _tmp21_;
2445 gchar* _tmp22_;
2446 const gchar* _tmp23_;
2447 gchar* _tmp24_;
2448 const gchar* _tmp25_;
2449 gchar* _tmp26_;
2450 const gchar* _tmp27_;
2451 gchar* _tmp28_;
2452 const gchar* _tmp29_;
2453 gchar* _tmp30_;
2454 gchar* _tmp31_;
2455 gchar* _tmp32_;
2456 gchar* _tmp33_;
2457 const gchar* _tmp34_;
2458 gchar* _tmp35_;
2459 gchar* _tmp36_;
2460 gchar* _tmp37_;
2461 gchar* _tmp38_;
2462 _tmp15_ = g_strdup ("");
2463 about = _tmp15_;
2464 _tmp16_ = g_strdup ("");
2465 license = _tmp16_;
2466 _tmp17_ = about;
2467 _tmp18_ = g_strconcat (_tmp17_, "Tracker " PACKAGE_VERSION "\n", NULL);
2468 _g_free0 (about);
2469 about = _tmp18_;
2470 _tmp19_ = license;
2471 _tmp20_ = g_strconcat (_tmp19_, "This program is free software and comes without any warranty.\n", NULL);
2472 _g_free0 (license);
2473 license = _tmp20_;
2474 _tmp21_ = license;
2475 _tmp22_ = g_strconcat (_tmp21_, "It is licensed under version 2 or later of the General Public ", NULL);
2476 _g_free0 (license);
2477 license = _tmp22_;
2478 _tmp23_ = license;
2479 _tmp24_ = g_strconcat (_tmp23_, "License which can be viewed at:\n", NULL);
2480 _g_free0 (license);
2481 license = _tmp24_;
2482 _tmp25_ = license;
2483 _tmp26_ = g_strconcat (_tmp25_, "\n", NULL);
2484 _g_free0 (license);
2485 license = _tmp26_;
2486 _tmp27_ = license;
2487 _tmp28_ = g_strconcat (_tmp27_, " http://www.gnu.org/licenses/gpl.txt\n", NULL);
2488 _g_free0 (license);
2489 license = _tmp28_;
2490 _tmp29_ = about;
2491 _tmp30_ = g_strconcat ("\n", _tmp29_, NULL);
2492 _tmp31_ = _tmp30_;
2493 _tmp32_ = g_strconcat (_tmp31_, "\n", NULL);
2494 _tmp33_ = _tmp32_;
2495 _tmp34_ = license;
2496 _tmp35_ = g_strconcat (_tmp33_, _tmp34_, NULL);
2497 _tmp36_ = _tmp35_;
2498 _tmp37_ = g_strconcat (_tmp36_, "\n", NULL);
2499 _tmp38_ = _tmp37_;
2500 g_print ("%s", _tmp38_);
2501 _g_free0 (_tmp38_);
2502 _g_free0 (_tmp36_);
2503 _g_free0 (_tmp33_);
2504 _g_free0 (_tmp31_);
2505 result = 0;
2506 _g_free0 (license);
2507 _g_free0 (about);
2508 _g_option_context_free0 (context);
2509 return result;
2510 }
2511 gtk_init (&args_length1, &args);
2512 bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
2513 bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
2514 textdomain (GETTEXT_PACKAGE);
2515 _tmp39_ = tracker_needle_new ();
2516 n = _tmp39_;
2517 _tmp40_ = n;
2518 tracker_needle_show (_tmp40_);
2519 _tmp41_ = n;
2520 _tmp42_ = search_criteria;
2521 _tmp42__length1 = _vala_array_length (search_criteria);
2522 tracker_needle_set_search (_tmp41_, _tmp42_, _tmp42__length1);
2523 gtk_main ();
2524 result = 0;
2525 _tracker_needle_unref0 (n);
2526 _g_option_context_free0 (context);
2527 return result;
2528 }
2529
2530
2531 int main (int argc, char ** argv) {
2532 g_type_init ();
'g_type_init' is deprecated (declared at /usr/include/glib-2.0/gobject/gtype.h:669)
(emitted by gcc)
2533 return _vala_main (argv, argc);
2534 }
2535
2536
2537 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
2538 if ((array != NULL) && (destroy_func != NULL)) {
2539 int i;
2540 for (i = 0; i < array_length; i = i + 1) {
2541 if (((gpointer*) array)[i] != NULL) {
2542 destroy_func (((gpointer*) array)[i]);
2543 }
2544 }
2545 }
2546 }
2547
2548
2549 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
2550 _vala_array_destroy (array, array_length, destroy_func);
2551 g_free (array);
2552 }
2553
2554
2555 static gint _vala_array_length (gpointer array) {
2556 int length;
2557 length = 0;
2558 if (array) {
2559 while (((gpointer*) array)[length]) {
2560 length++;
2561 }
2562 }
2563 return length;
2564 }