Merge lp:~kalikiana/midori/fix-1179200-4 into lp:midori
- fix-1179200-4
- Merge into trunk
Proposed by
Cris Dywan
Status: | Merged |
---|---|
Approved by: | Paweł Forysiuk |
Approved revision: | 6326 |
Merged at revision: | 6388 |
Proposed branch: | lp:~kalikiana/midori/fix-1179200-4 |
Merge into: | lp:midori |
Diff against target: |
1143 lines (+461/-469) 9 files modified
midori/midori-array.c (+0/-248) midori/midori-array.h (+5/-20) midori/midori-bookmarks-db.c (+410/-4) midori/midori-bookmarks-db.h (+29/-16) midori/midori-browser.c (+6/-17) midori/midori-frontend.c (+1/-1) midori/midori.h (+1/-1) panels/midori-bookmarks.c (+8/-161) po/POTFILES.in (+1/-1) |
To merge this branch: | bzr merge lp:~kalikiana/midori/fix-1179200-4 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Paweł Forysiuk | Approve | ||
Review via email:
|
Commit message
Move bookmarks db handling to midori-bookmarks-db
Description of the change
Fourth step for merge of fix-1179200
Things are moved around to colocalize bookmarks db operations into midor/midori-
This step does not actually add feature or fix but is exposed to trace the code moves.
Based upon lp:~aauzi/midori/fix-1179200-4
To post a comment you must log in.
- 6326. By Cris Dywan
-
Merge lp:midori
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'midori/midori-array.c' |
2 | --- midori/midori-array.c 2013-08-05 06:48:53 +0000 |
3 | +++ midori/midori-array.c 2013-09-08 11:10:19 +0000 |
4 | @@ -1113,251 +1113,3 @@ |
5 | |
6 | return katze_array_from_statement (stmt); |
7 | } |
8 | - |
9 | -/** |
10 | - * midori_array_query_recursive: |
11 | - * @array: the main bookmark array |
12 | - * @fields: comma separated list of fields |
13 | - * @condition: condition, like "folder = '%q'" |
14 | - * @value: a value to be inserted if @condition contains %q |
15 | - * @recursive: if %TRUE include children |
16 | - * |
17 | - * Stores the result in a #KatzeArray. |
18 | - * |
19 | - * Return value: a #KatzeArray on success, %NULL otherwise |
20 | - * |
21 | - * Since: 0.4.4 |
22 | - **/ |
23 | -KatzeArray* |
24 | -midori_array_query_recursive (KatzeArray* bookmarks, |
25 | - const gchar* fields, |
26 | - const gchar* condition, |
27 | - const gchar* value, |
28 | - gboolean recursive) |
29 | -{ |
30 | - sqlite3* db; |
31 | - gchar* sqlcmd; |
32 | - char* sqlcmd_value; |
33 | - KatzeArray* array; |
34 | - KatzeItem* item; |
35 | - GList* list; |
36 | - |
37 | - g_return_val_if_fail (KATZE_IS_ARRAY (bookmarks), NULL); |
38 | - g_return_val_if_fail (fields, NULL); |
39 | - g_return_val_if_fail (condition, NULL); |
40 | - db = g_object_get_data (G_OBJECT (bookmarks), "db"); |
41 | - g_return_val_if_fail (db != NULL, NULL); |
42 | - |
43 | - sqlcmd = g_strdup_printf ("SELECT %s FROM bookmarks WHERE %s " |
44 | - "ORDER BY (uri='') ASC, title DESC", fields, condition); |
45 | - if (strstr (condition, "%q")) |
46 | - { |
47 | - sqlcmd_value = sqlite3_mprintf (sqlcmd, value ? value : ""); |
48 | - array = katze_array_from_sqlite (db, sqlcmd_value); |
49 | - sqlite3_free (sqlcmd_value); |
50 | - } |
51 | - else |
52 | - array = katze_array_from_sqlite (db, sqlcmd); |
53 | - g_free (sqlcmd); |
54 | - |
55 | - if (!recursive) |
56 | - return array; |
57 | - |
58 | - KATZE_ARRAY_FOREACH_ITEM_L (item, array, list) |
59 | - { |
60 | - if (KATZE_ITEM_IS_FOLDER (item)) |
61 | - { |
62 | - gchar* parentid = g_strdup_printf ("%" G_GINT64_FORMAT, |
63 | - katze_item_get_meta_integer (item, "id")); |
64 | - KatzeArray* subarray = midori_array_query_recursive (bookmarks, |
65 | - fields, "parentid=%q", parentid, TRUE); |
66 | - KatzeItem* subitem; |
67 | - GList* sublist; |
68 | - |
69 | - KATZE_ARRAY_FOREACH_ITEM_L (subitem, subarray, sublist) |
70 | - { |
71 | - katze_array_add_item (KATZE_ARRAY (item), subitem); |
72 | - } |
73 | - |
74 | - g_object_unref (subarray); |
75 | - g_free (parentid); |
76 | - } |
77 | - } |
78 | - g_list_free (list); |
79 | - return array; |
80 | -} |
81 | - |
82 | -/** |
83 | - * midori_array_query: |
84 | - * @array: the main bookmark array |
85 | - * @fields: comma separated list of fields |
86 | - * @condition: condition, like "folder = '%q'" |
87 | - * @value: a value to be inserted if @condition contains %q |
88 | - * |
89 | - * Stores the result in a #KatzeArray. |
90 | - * |
91 | - * Return value: a #KatzeArray on success, %NULL otherwise |
92 | - * |
93 | - * Since: 0.4.3 |
94 | - * |
95 | - * Deprecated: 0.4.4: Use midori_array_query_recursive() instead. |
96 | - **/ |
97 | -KatzeArray* |
98 | -midori_array_query (KatzeArray* bookmarks, |
99 | - const gchar* fields, |
100 | - const gchar* condition, |
101 | - const gchar* value) |
102 | -{ |
103 | - return midori_array_query_recursive (bookmarks, fields, condition, value, FALSE); |
104 | -} |
105 | - |
106 | -static gint64 |
107 | -count_from_sqlite (sqlite3* db, |
108 | - const gchar* sqlcmd) |
109 | -{ |
110 | - gint64 count = -1; |
111 | - sqlite3_stmt* stmt; |
112 | - gint result; |
113 | - |
114 | - result = sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL); |
115 | - if (result != SQLITE_OK) |
116 | - return -1; |
117 | - |
118 | - g_assert (sqlite3_column_count (stmt) == 1); |
119 | - |
120 | - if ((result = sqlite3_step (stmt)) == SQLITE_ROW) |
121 | - count = sqlite3_column_int64(stmt, 0); |
122 | - |
123 | - sqlite3_clear_bindings (stmt); |
124 | - sqlite3_reset (stmt); |
125 | - |
126 | - return count; |
127 | -} |
128 | - |
129 | -static gint64 |
130 | -midori_array_count_recursive_by_id (KatzeArray* bookmarks, |
131 | - const gchar* condition, |
132 | - const gchar* value, |
133 | - gint64 id, |
134 | - gboolean recursive) |
135 | -{ |
136 | - gint64 count = -1; |
137 | - sqlite3* db; |
138 | - gchar* sqlcmd; |
139 | - char* sqlcmd_value; |
140 | - sqlite3_stmt* stmt; |
141 | - gint result; |
142 | - GList* ids; |
143 | - GList* iter_ids; |
144 | - |
145 | - g_return_val_if_fail (condition, -1); |
146 | - g_return_val_if_fail (KATZE_IS_ARRAY (bookmarks), -1); |
147 | - db = g_object_get_data (G_OBJECT (bookmarks), "db"); |
148 | - g_return_val_if_fail (db != NULL, -1); |
149 | - |
150 | - g_assert(!strstr("parentid", condition)); |
151 | - |
152 | - if (id > 0) |
153 | - sqlcmd = g_strdup_printf ("SELECT COUNT(*) FROM bookmarks " |
154 | - "WHERE parentid = %" G_GINT64_FORMAT " AND %s", |
155 | - id, |
156 | - condition); |
157 | - else |
158 | - sqlcmd = g_strdup_printf ("SELECT COUNT(*) FROM bookmarks " |
159 | - "WHERE parentid IS NULL AND %s ", |
160 | - condition); |
161 | - |
162 | - if (strstr (condition, "%q")) |
163 | - { |
164 | - sqlcmd_value = sqlite3_mprintf (sqlcmd, value ? value : ""); |
165 | - count = count_from_sqlite (db, sqlcmd_value); |
166 | - sqlite3_free (sqlcmd_value); |
167 | - } |
168 | - else |
169 | - count = count_from_sqlite (db, sqlcmd); |
170 | - |
171 | - g_free (sqlcmd); |
172 | - |
173 | - if (!recursive || (count < 0)) |
174 | - return count; |
175 | - |
176 | - ids = NULL; |
177 | - |
178 | - if (id > 0) |
179 | - sqlcmd_value = sqlite3_mprintf ( |
180 | - "SELECT id FROM bookmarks " |
181 | - "WHERE parentid = %" G_GINT64_FORMAT " AND uri = ''", id); |
182 | - else |
183 | - sqlcmd_value = sqlite3_mprintf ( |
184 | - "SELECT id FROM bookmarks " |
185 | - "WHERE parentid IS NULL AND uri = ''"); |
186 | - |
187 | - if (sqlite3_prepare_v2 (db, sqlcmd_value, -1, &stmt, NULL) == SQLITE_OK) |
188 | - { |
189 | - g_assert (sqlite3_column_count (stmt) == 1); |
190 | - |
191 | - if ((result = sqlite3_step (stmt)) == SQLITE_ROW) |
192 | - { |
193 | - gint64* pid = g_new (gint64, 1); |
194 | - |
195 | - *pid = sqlite3_column_int64(stmt, 0); |
196 | - ids = g_list_append (ids, pid); |
197 | - } |
198 | - |
199 | - sqlite3_clear_bindings (stmt); |
200 | - sqlite3_reset (stmt); |
201 | - } |
202 | - |
203 | - sqlite3_free (sqlcmd_value); |
204 | - |
205 | - iter_ids = ids; |
206 | - while (iter_ids) |
207 | - { |
208 | - gint64 sub_count = midori_array_count_recursive_by_id (bookmarks, |
209 | - condition, |
210 | - value, |
211 | - *(gint64*)(iter_ids->data), |
212 | - recursive); |
213 | - |
214 | - if (sub_count < 0) |
215 | - { |
216 | - g_list_free_full (ids, g_free); |
217 | - return -1; |
218 | - } |
219 | - |
220 | - count += sub_count; |
221 | - iter_ids = g_list_next (iter_ids); |
222 | - } |
223 | - |
224 | - g_list_free_full (ids, g_free); |
225 | - return count; |
226 | -} |
227 | - |
228 | -/** |
229 | - * midori_array_count_recursive: |
230 | - * @array: the main bookmark array |
231 | - * @condition: condition, like "folder = '%q'" |
232 | - * @value: a value to be inserted if @condition contains %q |
233 | - * @recursive: if %TRUE include children |
234 | - * |
235 | - * Return value: the number of elements on success, -1 otherwise |
236 | - * |
237 | - * Since: 0.5.2 |
238 | - **/ |
239 | -gint64 |
240 | -midori_array_count_recursive (KatzeArray* bookmarks, |
241 | - const gchar* condition, |
242 | - const gchar* value, |
243 | - KatzeItem* folder, |
244 | - gboolean recursive) |
245 | -{ |
246 | - gint64 id = -1; |
247 | - |
248 | - g_return_val_if_fail (!folder || KATZE_ITEM_IS_FOLDER (folder), -1); |
249 | - |
250 | - id = folder ? katze_item_get_meta_integer (folder, "id") : 0; |
251 | - |
252 | - return midori_array_count_recursive_by_id (bookmarks, condition, |
253 | - value, id, |
254 | - recursive); |
255 | -} |
256 | |
257 | === modified file 'midori/midori-array.h' |
258 | --- midori/midori-array.h 2013-05-21 21:46:26 +0000 |
259 | +++ midori/midori-array.h 2013-09-08 11:10:19 +0000 |
260 | @@ -27,31 +27,16 @@ |
261 | const gchar* format, |
262 | GError** error); |
263 | |
264 | +void |
265 | +katze_item_set_value_from_column (sqlite3_stmt* stmt, |
266 | + gint column, |
267 | + KatzeItem* item); |
268 | + |
269 | KatzeArray* |
270 | katze_array_from_statement (sqlite3_stmt* stmt); |
271 | |
272 | KatzeArray* |
273 | -midori_array_query (KatzeArray* array, |
274 | - const gchar* fields, |
275 | - const gchar* condition, |
276 | - const gchar* value); |
277 | - |
278 | -KatzeArray* |
279 | -midori_array_query_recursive (KatzeArray* array, |
280 | - const gchar* fields, |
281 | - const gchar* condition, |
282 | - const gchar* value, |
283 | - gboolean recursive); |
284 | - |
285 | -KatzeArray* |
286 | katze_array_from_sqlite (sqlite3* db, |
287 | const gchar* sqlcmd); |
288 | |
289 | -gint64 |
290 | -midori_array_count_recursive (KatzeArray* bookmarks, |
291 | - const gchar* condition, |
292 | - const gchar* value, |
293 | - KatzeItem* folder, |
294 | - gboolean recursive); |
295 | - |
296 | #endif /* !__MIDORI_ARRAY_H__ */ |
297 | |
298 | === renamed file 'midori/midori-bookmarks.c' => 'midori/midori-bookmarks-db.c' |
299 | --- midori/midori-bookmarks.c 2013-08-05 09:26:20 +0000 |
300 | +++ midori/midori-bookmarks-db.c 2013-09-08 11:10:19 +0000 |
301 | @@ -10,8 +10,8 @@ |
302 | See the file COPYING for the full license text. |
303 | */ |
304 | |
305 | -#include "midori-bookmarks.h" |
306 | -#include "panels/midori-bookmarks.h" |
307 | +#include "midori-bookmarks-db.h" |
308 | + |
309 | #include "midori-app.h" |
310 | #include "midori-array.h" |
311 | #include "sokoke.h" |
312 | @@ -25,6 +25,167 @@ |
313 | #include <unistd.h> |
314 | #endif |
315 | |
316 | +static gboolean |
317 | +midori_bookmarks_update_item_db (sqlite3* db, |
318 | + KatzeItem* item); |
319 | + |
320 | +gint64 |
321 | +midori_bookmarks_insert_item_db (sqlite3* db, |
322 | + KatzeItem* item, |
323 | + gint64 parentid) |
324 | +{ |
325 | + gchar* sqlcmd; |
326 | + char* errmsg = NULL; |
327 | + KatzeItem* old_parent; |
328 | + gchar* new_parentid; |
329 | + gchar* id = NULL; |
330 | + const gchar* uri = NULL; |
331 | + const gchar* desc = NULL; |
332 | + gint64 seq = 0; |
333 | + |
334 | + /* Bookmarks must have a name, import may produce invalid items */ |
335 | + g_return_val_if_fail (katze_item_get_name (item), seq); |
336 | + |
337 | + if (!db) |
338 | + return seq; |
339 | + |
340 | + if (katze_item_get_meta_integer (item, "id") > 0) |
341 | + id = g_strdup_printf ("%" G_GINT64_FORMAT, katze_item_get_meta_integer(item, "id")); |
342 | + else |
343 | + id = g_strdup_printf ("NULL"); |
344 | + |
345 | + if (KATZE_ITEM_IS_BOOKMARK (item)) |
346 | + uri = katze_item_get_uri (item); |
347 | + |
348 | + if (katze_item_get_text (item)) |
349 | + desc = katze_item_get_text (item); |
350 | + |
351 | + /* Use folder, otherwise fallback to parent folder */ |
352 | + old_parent = katze_item_get_parent (item); |
353 | + if (parentid > 0) |
354 | + new_parentid = g_strdup_printf ("%" G_GINT64_FORMAT, parentid); |
355 | + else if (old_parent && katze_item_get_meta_integer (old_parent, "id") > 0) |
356 | + new_parentid = g_strdup_printf ("%" G_GINT64_FORMAT, katze_item_get_meta_integer (old_parent, "id")); |
357 | + else |
358 | + new_parentid = g_strdup_printf ("NULL"); |
359 | + |
360 | + sqlcmd = sqlite3_mprintf ( |
361 | + "INSERT INTO bookmarks (id, parentid, title, uri, desc, toolbar, app) " |
362 | + "VALUES (%q, %q, '%q', '%q', '%q', %d, %d)", |
363 | + id, |
364 | + new_parentid, |
365 | + katze_item_get_name (item), |
366 | + katze_str_non_null (uri), |
367 | + katze_str_non_null (desc), |
368 | + katze_item_get_meta_boolean (item, "toolbar"), |
369 | + katze_item_get_meta_boolean (item, "app")); |
370 | + |
371 | + if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) == SQLITE_OK) |
372 | + { |
373 | + /* Get insert id */ |
374 | + if (g_str_equal (id, "NULL")) |
375 | + { |
376 | + KatzeArray* seq_array; |
377 | + |
378 | + sqlite3_free (sqlcmd); |
379 | + sqlcmd = sqlite3_mprintf ( |
380 | + "SELECT seq FROM sqlite_sequence WHERE name = 'bookmarks'"); |
381 | + |
382 | + seq_array = katze_array_from_sqlite (db, sqlcmd); |
383 | + if (katze_array_get_nth_item (seq_array, 0)) |
384 | + { |
385 | + KatzeItem* seq_item = katze_array_get_nth_item (seq_array, 0); |
386 | + |
387 | + seq = katze_item_get_meta_integer (seq_item, "seq"); |
388 | + katze_item_set_meta_integer (item, "id", seq); |
389 | + } |
390 | + g_object_unref (seq_array); |
391 | + } |
392 | + } |
393 | + else |
394 | + { |
395 | + g_printerr (_("Failed to add bookmark item: %s\n"), errmsg); |
396 | + sqlite3_free (errmsg); |
397 | + } |
398 | + |
399 | + sqlite3_free (sqlcmd); |
400 | + g_free (new_parentid); |
401 | + g_free (id); |
402 | + |
403 | + return seq; |
404 | +} |
405 | + |
406 | +gboolean |
407 | +midori_bookmarks_update_item_db (sqlite3* db, |
408 | + KatzeItem* item) |
409 | +{ |
410 | + gchar* sqlcmd; |
411 | + char* errmsg = NULL; |
412 | + gchar* parentid; |
413 | + gboolean updated; |
414 | + gchar* id; |
415 | + |
416 | + id = g_strdup_printf ("%" G_GINT64_FORMAT, |
417 | + katze_item_get_meta_integer (item, "id")); |
418 | + |
419 | + if (katze_item_get_meta_integer (item, "parentid") > 0) |
420 | + parentid = g_strdup_printf ("%" G_GINT64_FORMAT, |
421 | + katze_item_get_meta_integer (item, "parentid")); |
422 | + else |
423 | + parentid = g_strdup_printf ("NULL"); |
424 | + |
425 | + sqlcmd = sqlite3_mprintf ( |
426 | + "UPDATE bookmarks SET " |
427 | + "parentid=%q, title='%q', uri='%q', desc='%q', toolbar=%d, app=%d " |
428 | + "WHERE id = %q ;", |
429 | + parentid, |
430 | + katze_item_get_name (item), |
431 | + katze_str_non_null (katze_item_get_uri (item)), |
432 | + katze_str_non_null (katze_item_get_meta_string (item, "desc")), |
433 | + katze_item_get_meta_boolean (item, "toolbar"), |
434 | + katze_item_get_meta_boolean (item, "app"), |
435 | + id); |
436 | + |
437 | + updated = TRUE; |
438 | + if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK) |
439 | + { |
440 | + updated = FALSE; |
441 | + g_printerr (_("Failed to update bookmark: %s\n"), errmsg); |
442 | + sqlite3_free (errmsg); |
443 | + } |
444 | + |
445 | + sqlite3_free (sqlcmd); |
446 | + g_free (parentid); |
447 | + g_free (id); |
448 | + |
449 | + return updated; |
450 | +} |
451 | + |
452 | +/** |
453 | + * midori_bookmarks_db_update_item: |
454 | + * @bookmarks: the main bookmark array |
455 | + * @item: #KatzeItem the item to update |
456 | + * |
457 | + * Updates the @item in the bookmark data base. |
458 | + * |
459 | + * Since: 0.5.5 |
460 | + **/ |
461 | +void |
462 | +midori_array_update_item (KatzeArray* bookmarks, |
463 | + KatzeItem* item) |
464 | +{ |
465 | + g_return_if_fail (KATZE_IS_ARRAY (bookmarks)); |
466 | + g_return_if_fail (KATZE_IS_ITEM (item)); |
467 | + g_return_if_fail (katze_item_get_meta_string (item, "id")); |
468 | + g_return_if_fail (0 != katze_item_get_meta_integer (item, "id")); |
469 | + |
470 | + sqlite3* db = g_object_get_data (G_OBJECT (bookmarks), "db"); |
471 | + |
472 | + g_return_if_fail (db); |
473 | + |
474 | + midori_bookmarks_update_item_db (db, item); |
475 | +} |
476 | + |
477 | void |
478 | midori_bookmarks_dbtracer (void* dummy, |
479 | const char* query) |
480 | @@ -32,7 +193,7 @@ |
481 | g_printerr ("%s\n", query); |
482 | } |
483 | |
484 | -void |
485 | +static void |
486 | midori_bookmarks_add_item_cb (KatzeArray* array, |
487 | KatzeItem* item, |
488 | sqlite3* db) |
489 | @@ -41,7 +202,7 @@ |
490 | katze_item_get_meta_integer (item, "parentid")); |
491 | } |
492 | |
493 | -void |
494 | +static void |
495 | midori_bookmarks_remove_item_cb (KatzeArray* array, |
496 | KatzeItem* item, |
497 | sqlite3* db) |
498 | @@ -319,3 +480,248 @@ |
499 | sqlite3_close (db); |
500 | } |
501 | |
502 | +void |
503 | +midori_bookmarks_import_array (KatzeArray* bookmarks, |
504 | + KatzeArray* array, |
505 | + gint64 parentid) |
506 | +{ |
507 | + GList* list; |
508 | + KatzeItem* item; |
509 | + |
510 | + if (!bookmarks) |
511 | + return; |
512 | + |
513 | + KATZE_ARRAY_FOREACH_ITEM_L (item, array, list) |
514 | + { |
515 | + katze_item_set_meta_integer (item, "parentid", parentid); |
516 | + katze_array_add_item (bookmarks, item); |
517 | + if (KATZE_IS_ARRAY (item)) |
518 | + midori_bookmarks_import_array (bookmarks, KATZE_ARRAY (item), |
519 | + katze_item_get_meta_integer(item, "id")); |
520 | + } |
521 | + g_list_free (list); |
522 | +} |
523 | + |
524 | +/** |
525 | + * midori_array_query_recursive: |
526 | + * @array: the main bookmark array |
527 | + * @fields: comma separated list of fields |
528 | + * @condition: condition, like "folder = '%q'" |
529 | + * @value: a value to be inserted if @condition contains %q |
530 | + * @recursive: if %TRUE include children |
531 | + * |
532 | + * Stores the result in a #KatzeArray. |
533 | + * |
534 | + * Return value: a #KatzeArray on success, %NULL otherwise |
535 | + * |
536 | + * Since: 0.4.4 |
537 | + **/ |
538 | +KatzeArray* |
539 | +midori_array_query_recursive (KatzeArray* bookmarks, |
540 | + const gchar* fields, |
541 | + const gchar* condition, |
542 | + const gchar* value, |
543 | + gboolean recursive) |
544 | +{ |
545 | + sqlite3* db; |
546 | + gchar* sqlcmd; |
547 | + char* sqlcmd_value; |
548 | + KatzeArray* array; |
549 | + KatzeItem* item; |
550 | + GList* list; |
551 | + |
552 | + g_return_val_if_fail (KATZE_IS_ARRAY (bookmarks), NULL); |
553 | + g_return_val_if_fail (fields, NULL); |
554 | + g_return_val_if_fail (condition, NULL); |
555 | + db = g_object_get_data (G_OBJECT (bookmarks), "db"); |
556 | + g_return_val_if_fail (db != NULL, NULL); |
557 | + |
558 | + sqlcmd = g_strdup_printf ("SELECT %s FROM bookmarks WHERE %s " |
559 | + "ORDER BY (uri='') ASC, title DESC", fields, condition); |
560 | + if (strstr (condition, "%q")) |
561 | + { |
562 | + sqlcmd_value = sqlite3_mprintf (sqlcmd, value ? value : ""); |
563 | + array = katze_array_from_sqlite (db, sqlcmd_value); |
564 | + sqlite3_free (sqlcmd_value); |
565 | + } |
566 | + else |
567 | + array = katze_array_from_sqlite (db, sqlcmd); |
568 | + g_free (sqlcmd); |
569 | + |
570 | + if (!recursive) |
571 | + return array; |
572 | + |
573 | + KATZE_ARRAY_FOREACH_ITEM_L (item, array, list) |
574 | + { |
575 | + if (KATZE_ITEM_IS_FOLDER (item)) |
576 | + { |
577 | + gchar* parentid = g_strdup_printf ("%" G_GINT64_FORMAT, |
578 | + katze_item_get_meta_integer (item, "id")); |
579 | + KatzeArray* subarray = midori_array_query_recursive (bookmarks, |
580 | + fields, "parentid=%q", parentid, TRUE); |
581 | + KatzeItem* subitem; |
582 | + GList* sublist; |
583 | + |
584 | + KATZE_ARRAY_FOREACH_ITEM_L (subitem, subarray, sublist) |
585 | + { |
586 | + katze_array_add_item (KATZE_ARRAY (item), subitem); |
587 | + } |
588 | + |
589 | + g_object_unref (subarray); |
590 | + g_free (parentid); |
591 | + } |
592 | + } |
593 | + g_list_free (list); |
594 | + return array; |
595 | +} |
596 | + |
597 | +static gint64 |
598 | +count_from_sqlite (sqlite3* db, |
599 | + const gchar* sqlcmd) |
600 | +{ |
601 | + gint64 count = -1; |
602 | + sqlite3_stmt* stmt; |
603 | + gint result; |
604 | + |
605 | + result = sqlite3_prepare_v2 (db, sqlcmd, -1, &stmt, NULL); |
606 | + if (result != SQLITE_OK) |
607 | + return -1; |
608 | + |
609 | + g_assert (sqlite3_column_count (stmt) == 1); |
610 | + |
611 | + if ((result = sqlite3_step (stmt)) == SQLITE_ROW) |
612 | + count = sqlite3_column_int64(stmt, 0); |
613 | + |
614 | + sqlite3_clear_bindings (stmt); |
615 | + sqlite3_reset (stmt); |
616 | + |
617 | + return count; |
618 | +} |
619 | + |
620 | +static gint64 |
621 | +midori_array_count_recursive_by_id (KatzeArray* bookmarks, |
622 | + const gchar* condition, |
623 | + const gchar* value, |
624 | + gint64 id, |
625 | + gboolean recursive) |
626 | +{ |
627 | + gint64 count = -1; |
628 | + sqlite3* db; |
629 | + gchar* sqlcmd; |
630 | + char* sqlcmd_value; |
631 | + sqlite3_stmt* stmt; |
632 | + gint result; |
633 | + GList* ids; |
634 | + GList* iter_ids; |
635 | + |
636 | + g_return_val_if_fail (condition, -1); |
637 | + g_return_val_if_fail (KATZE_IS_ARRAY (bookmarks), -1); |
638 | + db = g_object_get_data (G_OBJECT (bookmarks), "db"); |
639 | + g_return_val_if_fail (db != NULL, -1); |
640 | + |
641 | + g_assert(!strstr("parentid", condition)); |
642 | + |
643 | + if (id > 0) |
644 | + sqlcmd = g_strdup_printf ("SELECT COUNT(*) FROM bookmarks " |
645 | + "WHERE parentid = %" G_GINT64_FORMAT " AND %s", |
646 | + id, |
647 | + condition); |
648 | + else |
649 | + sqlcmd = g_strdup_printf ("SELECT COUNT(*) FROM bookmarks " |
650 | + "WHERE parentid IS NULL AND %s ", |
651 | + condition); |
652 | + |
653 | + if (strstr (condition, "%q")) |
654 | + { |
655 | + sqlcmd_value = sqlite3_mprintf (sqlcmd, value ? value : ""); |
656 | + count = count_from_sqlite (db, sqlcmd_value); |
657 | + sqlite3_free (sqlcmd_value); |
658 | + } |
659 | + else |
660 | + count = count_from_sqlite (db, sqlcmd); |
661 | + |
662 | + g_free (sqlcmd); |
663 | + |
664 | + if (!recursive || (count < 0)) |
665 | + return count; |
666 | + |
667 | + ids = NULL; |
668 | + |
669 | + if (id > 0) |
670 | + sqlcmd_value = sqlite3_mprintf ( |
671 | + "SELECT id FROM bookmarks " |
672 | + "WHERE parentid = %" G_GINT64_FORMAT " AND uri = ''", id); |
673 | + else |
674 | + sqlcmd_value = sqlite3_mprintf ( |
675 | + "SELECT id FROM bookmarks " |
676 | + "WHERE parentid IS NULL AND uri = ''"); |
677 | + |
678 | + if (sqlite3_prepare_v2 (db, sqlcmd_value, -1, &stmt, NULL) == SQLITE_OK) |
679 | + { |
680 | + g_assert (sqlite3_column_count (stmt) == 1); |
681 | + |
682 | + if ((result = sqlite3_step (stmt)) == SQLITE_ROW) |
683 | + { |
684 | + gint64* pid = g_new (gint64, 1); |
685 | + |
686 | + *pid = sqlite3_column_int64(stmt, 0); |
687 | + ids = g_list_append (ids, pid); |
688 | + } |
689 | + |
690 | + sqlite3_clear_bindings (stmt); |
691 | + sqlite3_reset (stmt); |
692 | + } |
693 | + |
694 | + sqlite3_free (sqlcmd_value); |
695 | + |
696 | + iter_ids = ids; |
697 | + while (iter_ids) |
698 | + { |
699 | + gint64 sub_count = midori_array_count_recursive_by_id (bookmarks, |
700 | + condition, |
701 | + value, |
702 | + *(gint64*)(iter_ids->data), |
703 | + recursive); |
704 | + |
705 | + if (sub_count < 0) |
706 | + { |
707 | + g_list_free_full (ids, g_free); |
708 | + return -1; |
709 | + } |
710 | + |
711 | + count += sub_count; |
712 | + iter_ids = g_list_next (iter_ids); |
713 | + } |
714 | + |
715 | + g_list_free_full (ids, g_free); |
716 | + return count; |
717 | +} |
718 | + |
719 | +/** |
720 | + * midori_array_count_recursive: |
721 | + * @array: the main bookmark array |
722 | + * @condition: condition, like "folder = '%q'" |
723 | + * @value: a value to be inserted if @condition contains %q |
724 | + * @recursive: if %TRUE include children |
725 | + * |
726 | + * Return value: the number of elements on success, -1 otherwise |
727 | + * |
728 | + * Since: 0.5.2 |
729 | + **/ |
730 | +gint64 |
731 | +midori_array_count_recursive (KatzeArray* bookmarks, |
732 | + const gchar* condition, |
733 | + const gchar* value, |
734 | + KatzeItem* folder, |
735 | + gboolean recursive) |
736 | +{ |
737 | + gint64 id = -1; |
738 | + |
739 | + g_return_val_if_fail (!folder || KATZE_ITEM_IS_FOLDER (folder), -1); |
740 | + |
741 | + id = folder ? katze_item_get_meta_integer (folder, "id") : 0; |
742 | + |
743 | + return midori_array_count_recursive_by_id (bookmarks, condition, |
744 | + value, id, |
745 | + recursive); |
746 | +} |
747 | |
748 | === renamed file 'midori/midori-bookmarks.h' => 'midori/midori-bookmarks-db.h' |
749 | --- midori/midori-bookmarks.h 2012-11-25 15:37:41 +0000 |
750 | +++ midori/midori-bookmarks-db.h 2013-09-08 11:10:19 +0000 |
751 | @@ -10,22 +10,12 @@ |
752 | See the file COPYING for the full license text. |
753 | */ |
754 | |
755 | -#ifndef __MIDORI_BOOKMARKS_H__ |
756 | -#define __MIDORI_BOOKMARKS_H__ 1 |
757 | +#ifndef __MIDORI_BOOKMARKS_DB_H__ |
758 | +#define __MIDORI_BOOKMARKS_DB_H__ 1 |
759 | |
760 | #include <sqlite3.h> |
761 | #include <katze/katze.h> |
762 | |
763 | -void |
764 | -midori_bookmarks_add_item_cb (KatzeArray* array, |
765 | - KatzeItem* item, |
766 | - sqlite3* db); |
767 | - |
768 | -void |
769 | -midori_bookmarks_remove_item_cb (KatzeArray* array, |
770 | - KatzeItem* item, |
771 | - sqlite3* db); |
772 | - |
773 | KatzeArray* |
774 | midori_bookmarks_new (char** errmsg); |
775 | |
776 | @@ -33,8 +23,31 @@ |
777 | midori_bookmarks_on_quit (KatzeArray* array); |
778 | |
779 | void |
780 | -midori_bookmarks_import (const gchar* filename, |
781 | - sqlite3* db); |
782 | - |
783 | -#endif /* !__MIDORI_BOOKMARKS_H__ */ |
784 | +midori_array_update_item (KatzeArray* bookmarks, KatzeItem* item); |
785 | + |
786 | +void |
787 | +midori_bookmarks_import_array (KatzeArray* bookmarks, |
788 | + KatzeArray* array, |
789 | + gint64 parentid); |
790 | + |
791 | +KatzeArray* |
792 | +midori_array_query_recursive (KatzeArray* bookmarks, |
793 | + const gchar* fields, |
794 | + const gchar* condition, |
795 | + const gchar* value, |
796 | + gboolean recursive); |
797 | + |
798 | +gint64 |
799 | +midori_array_count_recursive (KatzeArray* bookmarks, |
800 | + const gchar* condition, |
801 | + const gchar* value, |
802 | + KatzeItem* folder, |
803 | + gboolean recursive); |
804 | + |
805 | +gint64 |
806 | +midori_bookmarks_insert_item_db (sqlite3* db, |
807 | + KatzeItem* item, |
808 | + gint64 parentid); |
809 | + |
810 | +#endif /* !__MIDORI_BOOKMARKS_DB_H__ */ |
811 | |
812 | |
813 | === modified file 'midori/midori-browser.c' |
814 | --- midori/midori-browser.c 2013-09-07 20:22:40 +0000 |
815 | +++ midori/midori-browser.c 2013-09-08 11:10:19 +0000 |
816 | @@ -26,6 +26,7 @@ |
817 | #include "midori-privatedata.h" |
818 | #include "midori-core.h" |
819 | #include "midori-privatedata.h" |
820 | +#include "midori-bookmarks-db.h" |
821 | #include "katze-cellrenderercomboboxtext.h" |
822 | |
823 | #include "marshal.h" |
824 | @@ -165,15 +166,6 @@ |
825 | GParamSpec* pspec); |
826 | |
827 | void |
828 | -midori_bookmarks_import_array (KatzeArray* bookmarks, |
829 | - KatzeArray* array, |
830 | - gint64 parentid); |
831 | - |
832 | -gboolean |
833 | -midori_bookmarks_update_item_db (sqlite3* db, |
834 | - KatzeItem* item); |
835 | - |
836 | -void |
837 | midori_browser_open_bookmark (MidoriBrowser* browser, |
838 | KatzeItem* item); |
839 | |
840 | @@ -1111,9 +1103,6 @@ |
841 | GtkWidget* combo_folder; |
842 | GtkWidget* check_toolbar; |
843 | gboolean return_status = FALSE; |
844 | - sqlite3* db = g_object_get_data (G_OBJECT (browser->bookmarks), "db"); |
845 | - if (!db) |
846 | - return FALSE; |
847 | |
848 | if (is_folder) |
849 | title = new_bookmark ? _("New Folder") : _("Edit Folder"); |
850 | @@ -1245,7 +1234,7 @@ |
851 | katze_array_add_item (browser->bookmarks, bookmark); |
852 | else |
853 | { |
854 | - midori_bookmarks_update_item_db (db, bookmark); |
855 | + midori_array_update_item (browser->bookmarks, bookmark); |
856 | midori_browser_update_history (bookmark, "bookmark", "modify"); |
857 | |
858 | if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_toolbar))) |
859 | @@ -3252,8 +3241,8 @@ |
860 | else |
861 | condition = "parentid = %q"; |
862 | |
863 | - bookmarks = midori_array_query (browser->bookmarks, |
864 | - "id, title, parentid, uri, app, pos_panel, pos_bar", condition, id); |
865 | + bookmarks = midori_array_query_recursive (browser->bookmarks, |
866 | + "id, title, parentid, uri, app, pos_panel, pos_bar", condition, id, FALSE); |
867 | if (!bookmarks) |
868 | return FALSE; |
869 | |
870 | @@ -7067,8 +7056,8 @@ |
871 | gtk_toolbar_insert (GTK_TOOLBAR (browser->bookmarkbar), |
872 | gtk_separator_tool_item_new (), -1); |
873 | |
874 | - array = midori_array_query (browser->bookmarks, |
875 | - "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "toolbar = 1", NULL); |
876 | + array = midori_array_query_recursive (browser->bookmarks, |
877 | + "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "toolbar = 1", NULL, FALSE); |
878 | if (!array) |
879 | { |
880 | _action_set_sensitive (browser, "BookmarkAdd", FALSE); |
881 | |
882 | === modified file 'midori/midori-frontend.c' |
883 | --- midori/midori-frontend.c 2013-09-03 14:45:17 +0000 |
884 | +++ midori/midori-frontend.c 2013-09-08 11:10:19 +0000 |
885 | @@ -10,7 +10,7 @@ |
886 | */ |
887 | |
888 | #include "midori-array.h" |
889 | -#include "midori-bookmarks.h" |
890 | +#include "midori-bookmarks-db.h" |
891 | #include "midori-history.h" |
892 | #include "midori-preferences.h" |
893 | #include "midori-privatedata.h" |
894 | |
895 | === modified file 'midori/midori.h' |
896 | --- midori/midori.h 2012-12-02 15:32:20 +0000 |
897 | +++ midori/midori.h 2013-09-08 11:10:19 +0000 |
898 | @@ -14,7 +14,7 @@ |
899 | |
900 | #include "midori-app.h" |
901 | #include "midori-array.h" |
902 | -#include "midori-bookmarks.h" |
903 | +#include "midori-bookmarks-db.h" |
904 | #include "midori-browser.h" |
905 | #include "midori-extension.h" |
906 | #include "midori-frontend.h" |
907 | |
908 | === modified file 'panels/midori-bookmarks.c' |
909 | --- panels/midori-bookmarks.c 2013-09-03 23:09:55 +0000 |
910 | +++ panels/midori-bookmarks.c 2013-09-08 11:10:19 +0000 |
911 | @@ -17,6 +17,7 @@ |
912 | #include "midori-platform.h" |
913 | #include "midori-view.h" |
914 | #include "midori-core.h" |
915 | +#include "midori-bookmarks-db.h" |
916 | |
917 | #include <glib/gi18n.h> |
918 | #include <string.h> |
919 | @@ -137,7 +138,7 @@ |
920 | gchar* parent_id; |
921 | |
922 | parent_id = g_strdup_printf ("%" G_GINT64_FORMAT, parentid); |
923 | - if (!(root_array = midori_array_query (array, "*", "parentid = %q", parent_id))) |
924 | + if (!(root_array = midori_array_query_recursive (array, "*", "parentid = %q", parent_id, FALSE))) |
925 | { |
926 | g_free (parent_id); |
927 | return; |
928 | @@ -160,28 +161,6 @@ |
929 | g_list_free (list); |
930 | } |
931 | |
932 | -void |
933 | -midori_bookmarks_import_array (KatzeArray* bookmarks, |
934 | - KatzeArray* array, |
935 | - gint64 parentid) |
936 | -{ |
937 | - GList* list; |
938 | - KatzeItem* item; |
939 | - |
940 | - if (!bookmarks) |
941 | - return; |
942 | - |
943 | - KATZE_ARRAY_FOREACH_ITEM_L (item, array, list) |
944 | - { |
945 | - katze_item_set_meta_integer (item, "parentid", parentid); |
946 | - katze_array_add_item (bookmarks, item); |
947 | - if (KATZE_IS_ARRAY (item)) |
948 | - midori_bookmarks_import_array (bookmarks, KATZE_ARRAY (item), |
949 | - katze_item_get_meta_integer(item, "id")); |
950 | - } |
951 | - g_list_free (list); |
952 | -} |
953 | - |
954 | static KatzeArray* |
955 | midori_bookmarks_read_from_db (MidoriBookmarks* bookmarks, |
956 | gint64 parentid, |
957 | @@ -190,21 +169,21 @@ |
958 | KatzeArray* array; |
959 | |
960 | if (keyword && *keyword) |
961 | - array = midori_array_query (bookmarks->array, |
962 | - "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "title LIKE '%%%q%%'", keyword); |
963 | + array = midori_array_query_recursive (bookmarks->array, |
964 | + "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "title LIKE '%%%q%%'", keyword, FALSE); |
965 | else |
966 | { |
967 | if (parentid > 0) |
968 | { |
969 | gchar* parent_id = g_strdup_printf ("%" G_GINT64_FORMAT, parentid); |
970 | - array = midori_array_query (bookmarks->array, |
971 | - "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "parentid = %q", parent_id); |
972 | + array = midori_array_query_recursive (bookmarks->array, |
973 | + "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "parentid = %q", parent_id, FALSE); |
974 | |
975 | g_free (parent_id); |
976 | } |
977 | else |
978 | - array = midori_array_query (bookmarks->array, |
979 | - "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "parentid IS NULL", NULL); |
980 | + array = midori_array_query_recursive (bookmarks->array, |
981 | + "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "parentid IS NULL", NULL, FALSE); |
982 | } |
983 | return array ? array : katze_array_new (KATZE_TYPE_ITEM); |
984 | } |
985 | @@ -235,92 +214,6 @@ |
986 | g_object_unref (item); |
987 | } |
988 | |
989 | -gint64 |
990 | -midori_bookmarks_insert_item_db (sqlite3* db, |
991 | - KatzeItem* item, |
992 | - gint64 parentid) |
993 | -{ |
994 | - gchar* sqlcmd; |
995 | - char* errmsg = NULL; |
996 | - KatzeItem* old_parent; |
997 | - gchar* new_parentid; |
998 | - gchar* id = NULL; |
999 | - const gchar* uri = NULL; |
1000 | - const gchar* desc = NULL; |
1001 | - gint64 seq = 0; |
1002 | - |
1003 | - /* Bookmarks must have a name, import may produce invalid items */ |
1004 | - g_return_val_if_fail (katze_item_get_name (item), seq); |
1005 | - |
1006 | - if (!db) |
1007 | - return seq; |
1008 | - |
1009 | - if (katze_item_get_meta_integer (item, "id") > 0) |
1010 | - id = g_strdup_printf ("%" G_GINT64_FORMAT, katze_item_get_meta_integer(item, "id")); |
1011 | - else |
1012 | - id = g_strdup_printf ("NULL"); |
1013 | - |
1014 | - if (KATZE_ITEM_IS_BOOKMARK (item)) |
1015 | - uri = katze_item_get_uri (item); |
1016 | - |
1017 | - if (katze_item_get_text (item)) |
1018 | - desc = katze_item_get_text (item); |
1019 | - |
1020 | - /* Use folder, otherwise fallback to parent folder */ |
1021 | - old_parent = katze_item_get_parent (item); |
1022 | - if (parentid > 0) |
1023 | - new_parentid = g_strdup_printf ("%" G_GINT64_FORMAT, parentid); |
1024 | - else if (old_parent && katze_item_get_meta_integer (old_parent, "id") > 0) |
1025 | - new_parentid = g_strdup_printf ("%" G_GINT64_FORMAT, katze_item_get_meta_integer (old_parent, "id")); |
1026 | - else |
1027 | - new_parentid = g_strdup_printf ("NULL"); |
1028 | - |
1029 | - sqlcmd = sqlite3_mprintf ( |
1030 | - "INSERT INTO bookmarks (id, parentid, title, uri, desc, toolbar, app) " |
1031 | - "VALUES (%q, %q, '%q', '%q', '%q', %d, %d)", |
1032 | - id, |
1033 | - new_parentid, |
1034 | - katze_item_get_name (item), |
1035 | - katze_str_non_null (uri), |
1036 | - katze_str_non_null (desc), |
1037 | - katze_item_get_meta_boolean (item, "toolbar"), |
1038 | - katze_item_get_meta_boolean (item, "app")); |
1039 | - |
1040 | - if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) == SQLITE_OK) |
1041 | - { |
1042 | - /* Get insert id */ |
1043 | - if (g_str_equal (id, "NULL")) |
1044 | - { |
1045 | - KatzeArray* seq_array; |
1046 | - |
1047 | - sqlite3_free (sqlcmd); |
1048 | - sqlcmd = sqlite3_mprintf ( |
1049 | - "SELECT seq FROM sqlite_sequence WHERE name = 'bookmarks'"); |
1050 | - |
1051 | - seq_array = katze_array_from_sqlite (db, sqlcmd); |
1052 | - if (katze_array_get_nth_item (seq_array, 0)) |
1053 | - { |
1054 | - KatzeItem* seq_item = katze_array_get_nth_item (seq_array, 0); |
1055 | - |
1056 | - seq = katze_item_get_meta_integer (seq_item, "seq"); |
1057 | - katze_item_set_meta_integer (item, "id", seq); |
1058 | - } |
1059 | - g_object_unref (seq_array); |
1060 | - } |
1061 | - } |
1062 | - else |
1063 | - { |
1064 | - g_printerr (_("Failed to add bookmark item: %s\n"), errmsg); |
1065 | - sqlite3_free (errmsg); |
1066 | - } |
1067 | - |
1068 | - sqlite3_free (sqlcmd); |
1069 | - g_free (new_parentid); |
1070 | - g_free (id); |
1071 | - |
1072 | - return seq; |
1073 | -} |
1074 | - |
1075 | static void |
1076 | midori_bookmarks_add_item_cb (KatzeArray* array, |
1077 | KatzeItem* item, |
1078 | @@ -590,52 +483,6 @@ |
1079 | } |
1080 | } |
1081 | |
1082 | -gboolean |
1083 | -midori_bookmarks_update_item_db (sqlite3* db, |
1084 | - KatzeItem* item) |
1085 | -{ |
1086 | - gchar* sqlcmd; |
1087 | - char* errmsg = NULL; |
1088 | - gchar* parentid; |
1089 | - gboolean updated; |
1090 | - gchar* id; |
1091 | - |
1092 | - id = g_strdup_printf ("%" G_GINT64_FORMAT, |
1093 | - katze_item_get_meta_integer (item, "id")); |
1094 | - |
1095 | - if (katze_item_get_meta_integer (item, "parentid") > 0) |
1096 | - parentid = g_strdup_printf ("%" G_GINT64_FORMAT, |
1097 | - katze_item_get_meta_integer (item, "parentid")); |
1098 | - else |
1099 | - parentid = g_strdup_printf ("NULL"); |
1100 | - |
1101 | - sqlcmd = sqlite3_mprintf ( |
1102 | - "UPDATE bookmarks SET " |
1103 | - "parentid=%q, title='%q', uri='%q', desc='%q', toolbar=%d, app=%d " |
1104 | - "WHERE id = %q ;", |
1105 | - parentid, |
1106 | - katze_item_get_name (item), |
1107 | - katze_str_non_null (katze_item_get_uri (item)), |
1108 | - katze_str_non_null (katze_item_get_meta_string (item, "desc")), |
1109 | - katze_item_get_meta_boolean (item, "toolbar"), |
1110 | - katze_item_get_meta_boolean (item, "app"), |
1111 | - id); |
1112 | - |
1113 | - updated = TRUE; |
1114 | - if (sqlite3_exec (db, sqlcmd, NULL, NULL, &errmsg) != SQLITE_OK) |
1115 | - { |
1116 | - updated = FALSE; |
1117 | - g_printerr (_("Failed to update bookmark: %s\n"), errmsg); |
1118 | - sqlite3_free (errmsg); |
1119 | - } |
1120 | - |
1121 | - sqlite3_free (sqlcmd); |
1122 | - g_free (parentid); |
1123 | - g_free (id); |
1124 | - |
1125 | - return updated; |
1126 | -} |
1127 | - |
1128 | static void |
1129 | midori_bookmarks_delete_clicked_cb (GtkWidget* toolitem, |
1130 | MidoriBookmarks* bookmarks) |
1131 | |
1132 | === modified file 'po/POTFILES.in' |
1133 | --- po/POTFILES.in 2013-09-01 16:55:43 +0000 |
1134 | +++ po/POTFILES.in 2013-09-08 11:10:19 +0000 |
1135 | @@ -76,7 +76,7 @@ |
1136 | midori/midori-extensions-column.vala |
1137 | midori/midori-viewcompletion.vala |
1138 | midori/midori-history.c |
1139 | -midori/midori-bookmarks.c |
1140 | +midori/midori-bookmarks-db.c |
1141 | midori/midori-session.c |
1142 | extensions/nsplugin-manager.vala |
1143 | midori/midori-frontend.c |
Seems to work fine. Code looks ok as well.