Mercurial > geeqie
annotate src/bar_sort.c @ 483:c9e3baeda1b1
Correctly escape data before using pango_layout_set_markup().
Exif data may contain characters like & or < >.
author | zas_ |
---|---|
date | Tue, 22 Apr 2008 09:40:05 +0000 |
parents | 48c8e49b571c |
children | 4a9570cd06f8 |
rev | line source |
---|---|
9 | 1 /* |
196 | 2 * Geeqie |
67
f63ecca6c087
Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
3 * (C) 2006 John Ellis |
475 | 4 * Copyright (C) 2008 The Geeqie Team |
9 | 5 * |
6 * Author: John Ellis | |
7 * | |
8 * This software is released under the GNU General Public License (GNU GPL). | |
9 * Please read the included file COPYING for more information. | |
10 * This software comes with no warranty of any kind, use at your own risk! | |
11 */ | |
12 | |
13 | |
281 | 14 #include "main.h" |
9 | 15 #include "bar_sort.h" |
16 | |
17 #include "collect.h" | |
18 #include "collect-io.h" | |
19 #include "filelist.h" | |
20 #include "layout.h" | |
21 #include "layout_image.h" | |
22 #include "utilops.h" | |
23 #include "ui_bookmark.h" | |
24 #include "ui_fileops.h" | |
25 #include "ui_menu.h" | |
26 #include "ui_misc.h" | |
27 | |
28 | |
29 /* | |
30 *------------------------------------------------------------------- | |
31 * sort bar | |
32 *------------------------------------------------------------------- | |
33 */ | |
34 | |
35 typedef enum { | |
36 BAR_SORT_MODE_FOLDER = 0, | |
37 BAR_SORT_MODE_COLLECTION | |
38 } SortModeType; | |
39 | |
40 typedef enum { | |
41 BAR_SORT_COPY, | |
42 BAR_SORT_MOVE, | |
43 BAR_SORT_LINK | |
44 } SortActionType; | |
45 | |
46 typedef enum { | |
47 BAR_SORT_SELECTION_IMAGE, | |
48 BAR_SORT_SELECTION_SELECTED | |
49 } SortSelectionType; | |
50 | |
51 typedef struct _SortData SortData; | |
52 struct _SortData | |
53 { | |
54 GtkWidget *vbox; | |
55 GtkWidget *bookmarks; | |
56 LayoutWindow *lw; | |
57 | |
58 FileDialog *dialog; | |
59 GtkWidget *dialog_name_entry; | |
60 | |
61 SortModeType mode; | |
62 SortActionType action; | |
63 SortSelectionType selection; | |
64 | |
65 GtkWidget *folder_group; | |
66 GtkWidget *collection_group; | |
67 | |
68 GtkWidget *add_button; | |
69 GtkWidget *undo_button; | |
70 SortActionType undo_action; | |
71 GList *undo_src_list; | |
72 gchar *undo_src; | |
73 gchar *undo_dest; | |
74 }; | |
75 | |
76 | |
77 #define SORT_KEY_FOLDERS "sort_manager" | |
78 #define SORT_KEY_COLLECTIONS "sort_manager_collections" | |
79 | |
80 | |
81 static gint bar_sort_mode_state = BAR_SORT_MODE_FOLDER; | |
82 static gint bar_sort_action_state = BAR_SORT_COPY; | |
83 static gint bar_sort_selection_state = BAR_SORT_SELECTION_IMAGE; | |
84 | |
85 | |
138 | 86 static void bar_sort_undo_set(SortData *sd, GList *src_list, FileData *src, const gchar *dest); |
9 | 87 static void bar_sort_add_close(SortData *sd); |
88 | |
89 | |
90 static void bar_sort_collection_list_build(GtkWidget *bookmarks) | |
91 { | |
92 gchar *collect_path; | |
93 GList *list = NULL; | |
94 GList *work; | |
95 | |
96 history_list_free_key(SORT_KEY_COLLECTIONS); | |
97 bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS); | |
98 | |
283 | 99 collect_path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL); |
9 | 100 path_list(collect_path, &list, NULL); |
101 g_free(collect_path); | |
102 | |
103 list = path_list_sort(list); | |
104 | |
105 work = list; | |
106 while (work) | |
107 { | |
108 const gchar *path; | |
109 gchar *name; | |
110 | |
111 path = work->data; | |
112 work = work->next; | |
113 | |
114 if (file_extension_match(path, ".gqv")) | |
115 { | |
116 name = remove_extension_from_path(filename_from_path(path)); | |
117 } | |
118 else | |
119 { | |
120 name = g_strdup(filename_from_path(path)); | |
121 } | |
122 bookmark_list_add(bookmarks, name, path); | |
123 g_free(name); | |
124 } | |
125 | |
138 | 126 string_list_free(list); |
9 | 127 } |
128 | |
129 static void bar_sort_mode_sync(SortData *sd, SortModeType mode) | |
130 { | |
131 gint folder_mode; | |
132 | |
133 if (sd->mode == mode) return; | |
134 sd->mode = mode; | |
135 | |
136 folder_mode = (sd->mode == BAR_SORT_MODE_FOLDER); | |
137 | |
138 bookmark_list_set_no_defaults(sd->bookmarks, !folder_mode); | |
139 bookmark_list_set_editable(sd->bookmarks, folder_mode); | |
140 | |
141 if (folder_mode) | |
142 { | |
143 gtk_widget_hide(sd->collection_group); | |
144 gtk_widget_show(sd->folder_group); | |
145 bookmark_list_set_key(sd->bookmarks, SORT_KEY_FOLDERS ); | |
146 } | |
147 else | |
148 { | |
149 gtk_widget_hide(sd->folder_group); | |
150 gtk_widget_show(sd->collection_group); | |
151 bar_sort_collection_list_build(sd->bookmarks); | |
152 } | |
153 | |
154 bar_sort_add_close(sd); | |
155 | |
156 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
157 } | |
158 | |
159 static void bar_sort_mode_cb(GtkWidget *combo, gpointer data) | |
160 { | |
161 SortData *sd = data; | |
162 | |
163 if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo)) == BAR_SORT_MODE_FOLDER) | |
164 { | |
165 bar_sort_mode_sync(sd, BAR_SORT_MODE_FOLDER); | |
166 } | |
167 else | |
168 { | |
169 bar_sort_mode_sync(sd, BAR_SORT_MODE_COLLECTION); | |
170 } | |
171 } | |
172 | |
173 /* this takes control of src_list */ | |
138 | 174 static void bar_sort_undo_set(SortData *sd, GList *src_list, FileData *src, const gchar *dest) |
9 | 175 { |
138 | 176 string_list_free(sd->undo_src_list); |
177 sd->undo_src_list = filelist_to_path_list(src_list); | |
9 | 178 |
179 g_free(sd->undo_src); | |
138 | 180 sd->undo_src = src ? g_strdup(src->path) : NULL; |
9 | 181 g_free(sd->undo_dest); |
182 sd->undo_dest = g_strdup(dest); | |
183 | |
184 sd->undo_action = sd->action; | |
185 | |
186 if (sd->undo_button) | |
187 { | |
188 gtk_widget_set_sensitive(sd->undo_button, | |
189 ((sd->undo_src_list || sd->undo_src) && sd->undo_dest) ); | |
190 } | |
191 } | |
192 | |
193 static void bar_sort_undo_folder(SortData *sd, GtkWidget *button) | |
194 { | |
195 if (!sd->undo_src || !sd->undo_dest) return; | |
196 | |
197 switch (sd->undo_action) | |
198 { | |
199 case BAR_SORT_MOVE: | |
200 { | |
201 GList *list; | |
202 gchar *src_dir; | |
203 | |
138 | 204 list = g_list_append(NULL, file_data_new_simple(sd->undo_dest)); |
9 | 205 src_dir = remove_level_from_path(sd->undo_src); |
206 file_util_move_simple(list, src_dir); | |
207 g_free(src_dir); | |
208 } | |
209 break; | |
210 case BAR_SORT_COPY: | |
138 | 211 file_util_delete(file_data_new_simple(sd->undo_dest), NULL, button); |
9 | 212 break; |
213 case BAR_SORT_LINK: | |
214 if (!unlink_file(sd->undo_dest)) | |
215 { | |
216 gchar *buf; | |
217 | |
67
f63ecca6c087
Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
218 buf = g_strdup_printf(_("Unable to remove symbolic link:\n%s"), sd->undo_dest); |
9 | 219 file_util_warning_dialog(_("Unlink failed"), buf, GTK_STOCK_DIALOG_ERROR, button); |
220 g_free(buf); | |
221 } | |
222 break; | |
223 } | |
224 | |
225 layout_refresh(sd->lw); | |
226 | |
227 if (isfile(sd->undo_src)) | |
228 { | |
138 | 229 layout_image_set_fd(sd->lw, file_data_new_simple(sd->undo_src)); |
9 | 230 } |
231 | |
232 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
233 } | |
234 | |
235 static void bar_sort_undo_collection(SortData *sd) | |
236 { | |
237 GList *work; | |
238 | |
239 work = sd->undo_src_list; | |
240 while (work) | |
241 { | |
242 gchar *source; | |
243 | |
244 source = work->data; | |
245 work = work->next; | |
138 | 246 collect_manager_remove(file_data_new_simple(source), sd->undo_dest); |
9 | 247 } |
248 | |
249 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
250 } | |
251 | |
252 static void bar_sort_undo_cb(GtkWidget *button, gpointer data) | |
253 { | |
254 SortData *sd = data; | |
255 | |
256 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
257 { | |
258 bar_sort_undo_folder(sd, button); | |
259 } | |
260 else | |
261 { | |
262 bar_sort_undo_collection(sd); | |
263 } | |
264 } | |
265 | |
138 | 266 static void bar_sort_bookmark_select_folder(SortData *sd, FileData *source, const gchar *path) |
9 | 267 { |
268 GList *list; | |
269 gchar *dest_path; | |
270 | |
271 if (!isdir(path)) return; | |
272 | |
138 | 273 dest_path = concat_dir_and_file(path, source->name); |
9 | 274 bar_sort_undo_set(sd, NULL, source, dest_path); |
275 | |
138 | 276 list = g_list_append(NULL, file_data_ref(source)); |
9 | 277 |
278 switch (sd->action) | |
279 { | |
280 case BAR_SORT_COPY: | |
281 file_util_copy_simple(list, path); | |
282 list = NULL; | |
283 layout_image_next(sd->lw); | |
284 break; | |
285 case BAR_SORT_MOVE: | |
286 file_util_move_simple(list, path); | |
287 list = NULL; | |
288 break; | |
289 case BAR_SORT_LINK: | |
138 | 290 if (symlink_utf8(source->path, dest_path)) |
9 | 291 { |
292 layout_image_next(sd->lw); | |
293 } | |
294 else | |
295 { | |
296 gchar *buf; | |
297 | |
67
f63ecca6c087
Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
298 buf = g_strdup_printf(_("Unable to create symbolic link:\n%s"), dest_path); |
9 | 299 file_util_warning_dialog(_("Link failed"), buf, GTK_STOCK_DIALOG_ERROR, sd->bookmarks); |
300 | |
301 g_free(buf); | |
302 } | |
303 break; | |
304 } | |
305 | |
306 g_list_free(list); | |
307 g_free(dest_path); | |
308 } | |
309 | |
138 | 310 static void bar_sort_bookmark_select_collection(SortData *sd, FileData *source, const gchar *path) |
9 | 311 { |
312 GList *list = NULL; | |
313 | |
314 switch (sd->selection) | |
315 { | |
316 case BAR_SORT_SELECTION_IMAGE: | |
138 | 317 list = g_list_append(NULL, file_data_ref(source)); |
9 | 318 break; |
319 case BAR_SORT_SELECTION_SELECTED: | |
320 list = layout_selection_list(sd->lw); | |
321 break; | |
322 } | |
323 | |
324 if (!list) | |
325 { | |
326 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
327 return; | |
328 } | |
329 | |
330 bar_sort_undo_set(sd, list, NULL, path); | |
331 | |
332 while (list) | |
333 { | |
138 | 334 FileData *image_fd; |
9 | 335 |
138 | 336 image_fd = list->data; |
9 | 337 list = list->next; |
138 | 338 collect_manager_add(image_fd, path); |
9 | 339 } |
340 } | |
341 | |
342 static void bar_sort_bookmark_select(const gchar *path, gpointer data) | |
343 { | |
344 SortData *sd = data; | |
138 | 345 FileData *source; |
9 | 346 |
138 | 347 source = layout_image_get_fd(sd->lw); |
9 | 348 if (!path || !source) return; |
349 | |
350 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
351 { | |
352 bar_sort_bookmark_select_folder(sd, source, path); | |
353 } | |
354 else | |
355 { | |
356 bar_sort_bookmark_select_collection(sd, source, path); | |
357 } | |
358 } | |
359 | |
360 static void bar_sort_set_copy_cb(GtkWidget *button, gpointer data) | |
361 { | |
362 SortData *sd = data; | |
363 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
364 sd->action = BAR_SORT_COPY; | |
365 } | |
366 | |
367 static void bar_sort_set_move_cb(GtkWidget *button, gpointer data) | |
368 { | |
369 SortData *sd = data; | |
370 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
371 sd->action = BAR_SORT_MOVE; | |
372 } | |
373 | |
374 static void bar_sort_set_link_cb(GtkWidget *button, gpointer data) | |
375 { | |
376 SortData *sd = data; | |
377 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
378 sd->action = BAR_SORT_LINK; | |
379 } | |
380 | |
381 static void bar_sort_set_selection_image_cb(GtkWidget *button, gpointer data) | |
382 { | |
383 SortData *sd = data; | |
384 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
385 sd->selection = BAR_SORT_SELECTION_IMAGE; | |
386 } | |
387 | |
388 static void bar_sort_set_selection_selected_cb(GtkWidget *button, gpointer data) | |
389 { | |
390 SortData *sd = data; | |
391 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
392 sd->selection = BAR_SORT_SELECTION_SELECTED; | |
393 } | |
394 | |
395 static void bar_sort_add_close(SortData *sd) | |
396 { | |
397 if (sd->dialog) file_dialog_close(sd->dialog); | |
398 sd->dialog_name_entry = NULL; | |
399 sd->dialog = NULL; | |
400 } | |
401 | |
402 static void bar_sort_add_ok_cb(FileDialog *fd, gpointer data) | |
403 { | |
404 SortData *sd = data; | |
405 const gchar *name; | |
406 | |
407 name = gtk_entry_get_text(GTK_ENTRY(sd->dialog_name_entry)); | |
408 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
409 { | |
410 if (strlen(name) == 0) | |
411 { | |
412 name = filename_from_path(fd->dest_path); | |
413 } | |
414 | |
415 bookmark_list_add(sd->bookmarks, name, fd->dest_path); | |
416 } | |
417 else | |
418 { | |
419 gchar *path; | |
420 gchar *ext; | |
421 | |
422 if (strlen(name) == 0) return; | |
423 | |
424 if (file_extension_match(name, ".gqv")) | |
425 { | |
426 ext = NULL; | |
427 } | |
428 else | |
429 { | |
430 ext = ".gqv"; | |
431 } | |
432 | |
283 | 433 path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, "/", name, ext, NULL); |
9 | 434 if (isfile(path)) |
435 { | |
436 gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name); | |
437 file_util_warning_dialog(_("Collection exists"), text, GTK_STOCK_DIALOG_INFO, NULL); | |
438 g_free(text); | |
439 } | |
440 else | |
441 { | |
442 CollectionData *cd; | |
443 | |
444 cd = collection_new(path); | |
445 if (collection_save(cd, path)) | |
446 { | |
447 bar_sort_collection_list_build(sd->bookmarks); | |
448 } | |
449 else | |
450 { | |
451 gchar *text = g_strdup_printf(_("Failed to save the collection:\n%s"), path); | |
452 file_util_warning_dialog(_("Save Failed"), text, | |
453 GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog); | |
454 g_free(text); | |
455 } | |
456 collection_unref(cd); | |
457 } | |
458 | |
459 g_free(path); | |
460 } | |
461 | |
462 bar_sort_add_close(sd); | |
463 } | |
464 | |
465 static void bar_sort_add_cancel_cb(FileDialog *fd, gpointer data) | |
466 { | |
467 SortData *sd = data; | |
468 | |
469 bar_sort_add_close(sd); | |
470 } | |
471 | |
472 static void bar_sort_add_cb(GtkWidget *button, gpointer data) | |
473 { | |
474 SortData *sd = data; | |
475 GtkWidget *hbox; | |
476 const gchar *title; | |
477 | |
478 if (sd->dialog) | |
479 { | |
480 gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(sd->dialog)->dialog)); | |
481 return; | |
482 } | |
483 | |
484 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
485 { | |
486 title = _("Add Bookmark"); | |
487 } | |
488 else | |
489 { | |
490 title = _("Add Collection"); | |
491 } | |
492 | |
493 sd->dialog = file_util_file_dlg(title, | |
254
9faf34f047b1
Make the wmclass value unique among the code by defining
zas_
parents:
228
diff
changeset
|
494 GQ_WMCLASS, "add_bookmark", button, |
9 | 495 bar_sort_add_cancel_cb, sd); |
496 file_dialog_add_button(sd->dialog, GTK_STOCK_OK, NULL, bar_sort_add_ok_cb, TRUE); | |
497 | |
498 generic_dialog_add_message(GENERIC_DIALOG(sd->dialog), NULL, title, NULL); | |
499 | |
500 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
501 { | |
502 file_dialog_add_path_widgets(sd->dialog, NULL, NULL, "add_bookmark", NULL, NULL); | |
503 } | |
504 | |
505 hbox = pref_box_new(GENERIC_DIALOG(sd->dialog)->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); | |
506 | |
507 pref_label_new(hbox, _("Name:")); | |
508 | |
509 sd->dialog_name_entry = gtk_entry_new(); | |
510 gtk_box_pack_start(GTK_BOX(hbox), sd->dialog_name_entry, TRUE, TRUE, 0); | |
511 generic_dialog_attach_default(GENERIC_DIALOG(sd->dialog), sd->dialog_name_entry); | |
512 gtk_widget_show(sd->dialog_name_entry); | |
513 | |
514 if (sd->mode == BAR_SORT_MODE_COLLECTION) | |
515 { | |
516 gtk_widget_grab_focus(sd->dialog_name_entry); | |
517 } | |
518 | |
519 gtk_widget_show(GENERIC_DIALOG(sd->dialog)->dialog); | |
520 } | |
521 | |
522 void bar_sort_close(GtkWidget *bar) | |
523 { | |
524 SortData *sd; | |
525 | |
526 sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data"); | |
527 if (!sd) return; | |
528 | |
529 gtk_widget_destroy(sd->vbox); | |
530 } | |
531 | |
532 static void bar_sort_destroy(GtkWidget *widget, gpointer data) | |
533 { | |
534 SortData *sd = data; | |
535 | |
536 bar_sort_add_close(sd); | |
537 bar_sort_mode_state = sd->mode; | |
538 bar_sort_action_state = sd->action; | |
539 bar_sort_selection_state = sd->selection; | |
540 | |
541 g_free(sd->undo_src); | |
542 g_free(sd->undo_dest); | |
543 g_free(sd); | |
544 } | |
545 | |
546 GtkWidget *bar_sort_new(LayoutWindow *lw) | |
547 { | |
548 SortData *sd; | |
549 GtkWidget *buttongrp; | |
550 GtkWidget *label; | |
551 GtkWidget *tbar; | |
552 GtkWidget *combo; | |
553 | |
554 if (!lw) return NULL; | |
555 | |
556 sd = g_new0(SortData, 1); | |
557 | |
558 sd->lw = lw; | |
559 sd->action = bar_sort_action_state; | |
560 sd->selection = bar_sort_selection_state; | |
561 sd->undo_src = NULL; | |
562 sd->undo_dest = NULL; | |
563 | |
564 sd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); | |
565 g_object_set_data(G_OBJECT(sd->vbox), "bar_sort_data", sd); | |
566 g_signal_connect(G_OBJECT(sd->vbox), "destroy", | |
567 G_CALLBACK(bar_sort_destroy), sd); | |
568 | |
569 label = gtk_label_new(_("Sort Manager")); | |
570 pref_label_bold(label, TRUE, FALSE); | |
571 gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0); | |
572 gtk_widget_show(label); | |
573 | |
574 combo = gtk_combo_box_new_text(); | |
575 gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0); | |
576 gtk_widget_show(combo); | |
577 | |
578 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders")); | |
579 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections")); | |
580 | |
581 g_signal_connect(G_OBJECT(combo), "changed", | |
582 G_CALLBACK(bar_sort_mode_cb), sd); | |
583 | |
584 sd->folder_group = pref_box_new(sd->vbox, FALSE, GTK_ORIENTATION_VERTICAL, 0); | |
585 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
586 buttongrp = pref_radiobutton_new(sd->folder_group, NULL, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
587 _("Copy"), (sd->action == BAR_SORT_COPY), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
588 G_CALLBACK(bar_sort_set_copy_cb), sd); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
589 pref_radiobutton_new(sd->folder_group, buttongrp, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
590 _("Move"), (sd->action == BAR_SORT_MOVE), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
591 G_CALLBACK(bar_sort_set_move_cb), sd); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
592 pref_radiobutton_new(sd->folder_group, buttongrp, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
593 _("Link"), (sd->action == BAR_SORT_LINK), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
594 G_CALLBACK(bar_sort_set_link_cb), sd); |
9 | 595 |
596 sd->collection_group = pref_box_new(sd->vbox, FALSE, GTK_ORIENTATION_VERTICAL, 0); | |
597 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
598 buttongrp = pref_radiobutton_new(sd->collection_group, NULL, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
599 _("Add image"), (sd->selection == BAR_SORT_SELECTION_IMAGE), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
600 G_CALLBACK(bar_sort_set_selection_image_cb), sd); |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
601 pref_radiobutton_new(sd->collection_group, buttongrp, |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
602 _("Add selection"), (sd->selection == BAR_SORT_SELECTION_SELECTED), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
603 G_CALLBACK(bar_sort_set_selection_selected_cb), sd); |
9 | 604 |
605 sd->bookmarks = bookmark_list_new(SORT_KEY_FOLDERS, bar_sort_bookmark_select, sd); | |
606 gtk_box_pack_start(GTK_BOX(sd->vbox), sd->bookmarks, TRUE, TRUE, 0); | |
607 gtk_widget_show(sd->bookmarks); | |
608 | |
609 tbar = pref_toolbar_new(sd->vbox, GTK_TOOLBAR_ICONS); | |
610 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
611 sd->add_button = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE, |
9 | 612 _("Add Bookmark"), |
613 G_CALLBACK(bar_sort_add_cb), sd); | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
614 sd->undo_button = pref_toolbar_button(tbar, GTK_STOCK_UNDO, NULL, FALSE, |
9 | 615 _("Undo last image"), |
616 G_CALLBACK(bar_sort_undo_cb), sd); | |
617 | |
618 sd->mode = -1; | |
619 bar_sort_mode_sync(sd, bar_sort_mode_state); | |
620 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sd->mode); | |
442 | 621 |
9 | 622 return sd->vbox; |
623 } |