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