summaryrefslogtreecommitdiff
blob: 96f897228eeae7228a21bface308f286b0fe9e7e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
From 0008d41d0b3d75ba01ffa2ebfc2cfb9055f60f78 Mon Sep 17 00:00:00 2001
From: Gilles Dartiguelongue <eva@gentoo.org>
Date: Sun, 27 May 2018 13:54:38 +0200
Subject: [PATCH] Make tracker support optional

---
 config.h.meson                      |  1 +
 meson.build                         |  9 ++++++---
 meson_options.txt                   |  4 ++++
 src/meson.build                     | 19 ++++++++++++-------
 src/nautilus-file-undo-operations.c |  4 ++++
 src/nautilus-file.c                 |  2 ++
 src/nautilus-files-view.c           |  4 ++++
 src/nautilus-search-engine.c        | 14 ++++++++++++++
 8 files changed, 47 insertions(+), 10 deletions(-)

diff --git a/config.h.meson b/config.h.meson
index 4f5cb5848..58d71e96f 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -4,6 +4,7 @@
 #mesondefine HAVE_EXEMPI
 #mesondefine HAVE_EXIF
 #mesondefine HAVE_SELINUX
+#mesondefine HAVE_TRACKER
 #mesondefine ENABLE_DESKTOP
 #mesondefine ENABLE_PACKAGEKIT
 #mesondefine LOCALEDIR
diff --git a/meson.build b/meson.build
index 6256193cc..d6418d770 100644
--- a/meson.build
+++ b/meson.build
@@ -81,9 +81,12 @@ if get_option ('enable-selinux')
     conf.set10 ('HAVE_SELINUX', true)
 endif
 
-tracker_sparql = dependency ('tracker-sparql-2.0', required: false)
-if not tracker_sparql.found()
-    tracker_sparql = dependency ('tracker-sparql-1.0')
+if get_option ('tracker')
+    tracker_sparql = dependency ('tracker-sparql-2.0', required: false)
+    if not tracker_sparql.found()
+        tracker_sparql = dependency ('tracker-sparql-1.0')
+    endif
+    conf.set10 ('HAVE_TRACKER', true)
 endif
 
 if get_option ('enable-xmp')
diff --git a/meson_options.txt b/meson_options.txt
index c934dd8b1..0c23c7921 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -8,6 +8,10 @@ option ('enable-exif',
         type: 'boolean',
         value: false,
         description: 'enable EXIF support')
+option ('tracker',
+        type: 'boolean',
+        value: true,
+        description: 'enable bulk renames and search using Tracker')
 option ('enable-xmp',
         type: 'boolean',
         value: false,
diff --git a/src/meson.build b/src/meson.build
index cc08345d8..8ea10b16b 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -254,12 +254,6 @@ libnautilus_sources = [
     'nautilus-file-undo-operations.h',
     'nautilus-file-undo-manager.c',
     'nautilus-file-undo-manager.h',
-    'nautilus-batch-rename-dialog.c',
-    'nautilus-batch-rename-dialog.h',
-    'nautilus-batch-rename-utilities.c',
-    'nautilus-batch-rename-utilities.h',
-    'nautilus-search-engine-tracker.c',
-    'nautilus-search-engine-tracker.h'
 ]
 
 nautilus_deps = [glib,
@@ -274,7 +268,6 @@ nautilus_deps = [glib,
                  nautilus_extension,
                  x11,
                  gmodule_no_export,
-                 tracker_sparql,
                  gio_unix]
 
 if get_option ('enable-exif')
@@ -289,6 +282,18 @@ if get_option ('enable-xmp')
     nautilus_deps += exempi
 endif
 
+if get_option ('tracker')
+    libnautilus_sources += [
+        'nautilus-batch-rename-dialog.c',
+        'nautilus-batch-rename-dialog.h',
+        'nautilus-batch-rename-utilities.c',
+        'nautilus-batch-rename-utilities.h',
+        'nautilus-search-engine-tracker.c',
+        'nautilus-search-engine-tracker.h'
+    ]
+    nautilus_deps += tracker_sparql
+endif
+
 libnautilus = static_library ('nautilus',
                               libnautilus_sources,
                               dependencies: nautilus_deps,
diff --git a/src/nautilus-file-undo-operations.c b/src/nautilus-file-undo-operations.c
index e833d0578..d6e407ca5 100644
--- a/src/nautilus-file-undo-operations.c
+++ b/src/nautilus-file-undo-operations.c
@@ -31,8 +31,10 @@
 #include "nautilus-file-operations.h"
 #include "nautilus-file.h"
 #include "nautilus-file-undo-manager.h"
+#ifdef HAVE_TRACKER
 #include "nautilus-batch-rename-dialog.h"
 #include "nautilus-batch-rename-utilities.h"
+#endif
 
 
 /* Since we use g_get_current_time for setting "orig_trash_time" in the undo
@@ -1087,6 +1089,7 @@ nautilus_file_undo_info_rename_set_data_post (NautilusFileUndoInfoRename *self,
 }
 
 /* batch rename */
+#ifdef HAVE_TRACKER
 G_DEFINE_TYPE (NautilusFileUndoInfoBatchRename, nautilus_file_undo_info_batch_rename, NAUTILUS_TYPE_FILE_UNDO_INFO);
 
 struct _NautilusFileUndoInfoBatchRenameDetails
@@ -1303,6 +1306,7 @@ nautilus_file_undo_info_batch_rename_set_data_post (NautilusFileUndoInfoBatchRen
 
     self->priv->new_display_names = g_list_reverse (self->priv->new_display_names);
 }
+#endif
 
 /* trash */
 G_DEFINE_TYPE (NautilusFileUndoInfoTrash, nautilus_file_undo_info_trash, NAUTILUS_TYPE_FILE_UNDO_INFO)
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index d6ac35a44..752adc295 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -2392,6 +2392,7 @@ real_batch_rename (GList                         *files,
         }
     }
 
+#ifdef HAVE_TRACKER
     /* Tell the undo manager a batch rename is taking place if at least
      * a file has been renamed*/
     if (!nautilus_file_undo_manager_is_operating () && op->skipped_files != g_list_length (files))
@@ -2406,6 +2407,7 @@ real_batch_rename (GList                         *files,
 
         nautilus_file_undo_manager_set_action (op->undo_info);
     }
+#endif
 
     if (op->skipped_files == g_list_length (files))
     {
diff --git a/src/nautilus-files-view.c b/src/nautilus-files-view.c
index 8784f63f8..af5605d68 100644
--- a/src/nautilus-files-view.c
+++ b/src/nautilus-files-view.c
@@ -28,8 +28,10 @@
 #include "nautilus-files-view.h"
 
 #include "nautilus-application.h"
+#ifdef HAVE_TRACKER
 #include "nautilus-batch-rename-dialog.h"
 #include "nautilus-batch-rename-utilities.h"
+#endif
 #include "nautilus-error-reporting.h"
 #include "nautilus-file-undo-manager.h"
 #include "nautilus-floating-bar.h"
@@ -6266,6 +6268,7 @@ real_action_rename (NautilusFilesView *view)
             {
                 invoke_external_bulk_rename_utility (view, selection);
             }
+#ifdef HAVE_TRACKER
             else
             {
                 GdkCursor *cursor;
@@ -6283,6 +6286,7 @@ real_action_rename (NautilusFilesView *view)
 
                 gtk_widget_show (GTK_WIDGET (dialog));
             }
+#endif
         }
         else
         {
diff --git a/src/nautilus-search-engine.c b/src/nautilus-search-engine.c
index 209bd4f80..436cd7471 100644
--- a/src/nautilus-search-engine.c
+++ b/src/nautilus-search-engine.c
@@ -28,11 +28,15 @@
 #include "nautilus-search-engine-model.h"
 #define DEBUG_FLAG NAUTILUS_DEBUG_SEARCH
 #include "nautilus-debug.h"
+#ifdef HAVE_TRACKER
 #include "nautilus-search-engine-tracker.h"
+#endif
 
 typedef struct
 {
+#ifdef HAVE_TRACKER
     NautilusSearchEngineTracker *tracker;
+#endif
     NautilusSearchEngineSimple *simple;
     NautilusSearchEngineModel *model;
 
@@ -73,7 +77,9 @@ nautilus_search_engine_set_query (NautilusSearchProvider *provider,
     engine = NAUTILUS_SEARCH_ENGINE (provider);
     priv = nautilus_search_engine_get_instance_private (engine);
 
+#ifdef HAVE_TRACKER
     nautilus_search_provider_set_query (NAUTILUS_SEARCH_PROVIDER (priv->tracker), query);
+#endif
     nautilus_search_provider_set_query (NAUTILUS_SEARCH_PROVIDER (priv->model), query);
     nautilus_search_provider_set_query (NAUTILUS_SEARCH_PROVIDER (priv->simple), query);
 }
@@ -95,8 +101,10 @@ search_engine_start_real (NautilusSearchEngine *engine)
 
     g_object_ref (engine);
 
+#ifdef HAVE_TRACKER
     nautilus_search_provider_start (NAUTILUS_SEARCH_PROVIDER (priv->tracker));
     priv->providers_running++;
+#endif
 
     if (nautilus_search_engine_model_get_model (priv->model))
     {
@@ -158,7 +166,9 @@ nautilus_search_engine_stop (NautilusSearchProvider *provider)
 
     DEBUG ("Search engine stop");
 
+#ifdef HAVE_TRACKER
     nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (priv->tracker));
+#endif
     nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (priv->model));
     nautilus_search_provider_stop (NAUTILUS_SEARCH_PROVIDER (priv->simple));
 
@@ -333,7 +343,9 @@ nautilus_search_engine_finalize (GObject *object)
 
     g_hash_table_destroy (priv->uris);
 
+#ifdef HAVE_TRACKER
     g_clear_object (&priv->tracker);
+#endif
     g_clear_object (&priv->model);
     g_clear_object (&priv->simple);
 
@@ -387,8 +399,10 @@ nautilus_search_engine_init (NautilusSearchEngine *engine)
     priv = nautilus_search_engine_get_instance_private (engine);
     priv->uris = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
 
+#ifdef HAVE_TRACKER
     priv->tracker = nautilus_search_engine_tracker_new ();
     connect_provider_signals (engine, NAUTILUS_SEARCH_PROVIDER (priv->tracker));
+#endif
 
     priv->model = nautilus_search_engine_model_new ();
     connect_provider_signals (engine, NAUTILUS_SEARCH_PROVIDER (priv->model));
-- 
2.19.2