Mercurial > geeqie
annotate src/bar_sort.c @ 675:cca86176bf81
Fix redundant application name in window titles.
It simplifies code.
author | zas_ |
---|---|
date | Fri, 16 May 2008 14:59:45 +0000 |
parents | 905688aa2317 |
children | b2eb4ff74d13 |
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" | |
586 | 19 #include "filedata.h" |
9 | 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); |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
98 filelist_read(collect_path, &list, NULL); |
9 | 99 g_free(collect_path); |
100 | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
101 list = filelist_sort_path(list); |
9 | 102 |
103 work = list; | |
104 while (work) | |
105 { | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
106 FileData *fd; |
9 | 107 gchar *name; |
108 | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
109 fd = work->data; |
9 | 110 work = work->next; |
111 | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
112 if (file_extension_match(fd->path, ".gqv")) |
9 | 113 { |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
114 name = remove_extension_from_path(fd->name); |
9 | 115 } |
116 else | |
117 { | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
118 name = g_strdup(fd->name); |
9 | 119 } |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
120 bookmark_list_add(bookmarks, name, fd->path); |
9 | 121 g_free(name); |
122 } | |
123 | |
576
9dc0513837b5
dropped path_list functions, use filelist functions everywhere
nadvornik
parents:
521
diff
changeset
|
124 filelist_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); | |
521
57007e49d767
Do not allow to add anything but directories to sort bar in
zas_
parents:
512
diff
changeset
|
138 bookmark_list_set_only_directories(sd->bookmarks, folder_mode); |
9 | 139 |
140 if (folder_mode) | |
141 { | |
142 gtk_widget_hide(sd->collection_group); | |
143 gtk_widget_show(sd->folder_group); | |
512
f9bf33be53ff
Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents:
491
diff
changeset
|
144 bookmark_list_set_key(sd->bookmarks, SORT_KEY_FOLDERS); |
9 | 145 } |
146 else | |
147 { | |
148 gtk_widget_hide(sd->folder_group); | |
149 gtk_widget_show(sd->collection_group); | |
150 bar_sort_collection_list_build(sd->bookmarks); | |
151 } | |
152 | |
153 bar_sort_add_close(sd); | |
154 | |
155 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
156 } | |
157 | |
158 static void bar_sort_mode_cb(GtkWidget *combo, gpointer data) | |
159 { | |
160 SortData *sd = data; | |
161 | |
162 if (gtk_combo_box_get_active(GTK_COMBO_BOX(combo)) == BAR_SORT_MODE_FOLDER) | |
163 { | |
164 bar_sort_mode_sync(sd, BAR_SORT_MODE_FOLDER); | |
165 } | |
166 else | |
167 { | |
168 bar_sort_mode_sync(sd, BAR_SORT_MODE_COLLECTION); | |
169 } | |
491 | 170 options->panels.sort.mode_state = sd->mode; |
9 | 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; | |
491 | 223 default: |
224 break; | |
9 | 225 } |
226 | |
227 layout_refresh(sd->lw); | |
228 | |
229 if (isfile(sd->undo_src)) | |
230 { | |
138 | 231 layout_image_set_fd(sd->lw, file_data_new_simple(sd->undo_src)); |
9 | 232 } |
233 | |
234 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
235 } | |
236 | |
237 static void bar_sort_undo_collection(SortData *sd) | |
238 { | |
239 GList *work; | |
240 | |
241 work = sd->undo_src_list; | |
242 while (work) | |
243 { | |
244 gchar *source; | |
245 | |
246 source = work->data; | |
247 work = work->next; | |
138 | 248 collect_manager_remove(file_data_new_simple(source), sd->undo_dest); |
9 | 249 } |
250 | |
251 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
252 } | |
253 | |
254 static void bar_sort_undo_cb(GtkWidget *button, gpointer data) | |
255 { | |
256 SortData *sd = data; | |
257 | |
258 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
259 { | |
260 bar_sort_undo_folder(sd, button); | |
261 } | |
262 else | |
263 { | |
264 bar_sort_undo_collection(sd); | |
265 } | |
266 } | |
267 | |
138 | 268 static void bar_sort_bookmark_select_folder(SortData *sd, FileData *source, const gchar *path) |
9 | 269 { |
270 GList *list; | |
271 gchar *dest_path; | |
272 | |
273 if (!isdir(path)) return; | |
274 | |
138 | 275 dest_path = concat_dir_and_file(path, source->name); |
9 | 276 bar_sort_undo_set(sd, NULL, source, dest_path); |
277 | |
138 | 278 list = g_list_append(NULL, file_data_ref(source)); |
9 | 279 |
280 switch (sd->action) | |
281 { | |
282 case BAR_SORT_COPY: | |
283 file_util_copy_simple(list, path); | |
284 list = NULL; | |
285 layout_image_next(sd->lw); | |
286 break; | |
287 case BAR_SORT_MOVE: | |
288 file_util_move_simple(list, path); | |
289 list = NULL; | |
290 break; | |
291 case BAR_SORT_LINK: | |
138 | 292 if (symlink_utf8(source->path, dest_path)) |
9 | 293 { |
294 layout_image_next(sd->lw); | |
295 } | |
296 else | |
297 { | |
298 gchar *buf; | |
299 | |
67
f63ecca6c087
Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents:
41
diff
changeset
|
300 buf = g_strdup_printf(_("Unable to create symbolic link:\n%s"), dest_path); |
9 | 301 file_util_warning_dialog(_("Link failed"), buf, GTK_STOCK_DIALOG_ERROR, sd->bookmarks); |
302 | |
303 g_free(buf); | |
304 } | |
305 break; | |
491 | 306 default: |
307 break; | |
9 | 308 } |
309 | |
310 g_list_free(list); | |
311 g_free(dest_path); | |
312 } | |
313 | |
138 | 314 static void bar_sort_bookmark_select_collection(SortData *sd, FileData *source, const gchar *path) |
9 | 315 { |
316 GList *list = NULL; | |
317 | |
318 switch (sd->selection) | |
319 { | |
320 case BAR_SORT_SELECTION_IMAGE: | |
138 | 321 list = g_list_append(NULL, file_data_ref(source)); |
9 | 322 break; |
323 case BAR_SORT_SELECTION_SELECTED: | |
324 list = layout_selection_list(sd->lw); | |
325 break; | |
491 | 326 default: |
327 break; | |
9 | 328 } |
329 | |
330 if (!list) | |
331 { | |
332 bar_sort_undo_set(sd, NULL, NULL, NULL); | |
333 return; | |
334 } | |
335 | |
336 bar_sort_undo_set(sd, list, NULL, path); | |
337 | |
338 while (list) | |
339 { | |
138 | 340 FileData *image_fd; |
9 | 341 |
138 | 342 image_fd = list->data; |
9 | 343 list = list->next; |
138 | 344 collect_manager_add(image_fd, path); |
9 | 345 } |
346 } | |
347 | |
348 static void bar_sort_bookmark_select(const gchar *path, gpointer data) | |
349 { | |
350 SortData *sd = data; | |
138 | 351 FileData *source; |
9 | 352 |
138 | 353 source = layout_image_get_fd(sd->lw); |
9 | 354 if (!path || !source) return; |
355 | |
356 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
357 { | |
358 bar_sort_bookmark_select_folder(sd, source, path); | |
359 } | |
360 else | |
361 { | |
362 bar_sort_bookmark_select_collection(sd, source, path); | |
363 } | |
364 } | |
365 | |
491 | 366 static void bar_sort_set_action(SortData *sd, SortActionType action) |
367 { | |
368 options->panels.sort.action_state = sd->action = action; | |
369 } | |
370 | |
9 | 371 static void bar_sort_set_copy_cb(GtkWidget *button, gpointer data) |
372 { | |
373 SortData *sd = data; | |
374 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
491 | 375 bar_sort_set_action(sd, BAR_SORT_COPY); |
9 | 376 } |
377 | |
378 static void bar_sort_set_move_cb(GtkWidget *button, gpointer data) | |
379 { | |
380 SortData *sd = data; | |
381 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
491 | 382 bar_sort_set_action(sd, BAR_SORT_MOVE); |
9 | 383 } |
384 | |
385 static void bar_sort_set_link_cb(GtkWidget *button, gpointer data) | |
386 { | |
387 SortData *sd = data; | |
388 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
491 | 389 bar_sort_set_action(sd, BAR_SORT_LINK); |
390 } | |
391 | |
392 static void bar_sort_set_selection(SortData *sd, SortSelectionType selection) | |
393 { | |
394 options->panels.sort.selection_state = sd->selection = selection; | |
9 | 395 } |
396 | |
397 static void bar_sort_set_selection_image_cb(GtkWidget *button, gpointer data) | |
398 { | |
399 SortData *sd = data; | |
400 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
491 | 401 bar_sort_set_selection(sd, BAR_SORT_SELECTION_IMAGE); |
9 | 402 } |
403 | |
404 static void bar_sort_set_selection_selected_cb(GtkWidget *button, gpointer data) | |
405 { | |
406 SortData *sd = data; | |
407 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return; | |
491 | 408 bar_sort_set_selection(sd, BAR_SORT_SELECTION_SELECTED); |
9 | 409 } |
410 | |
411 static void bar_sort_add_close(SortData *sd) | |
412 { | |
413 if (sd->dialog) file_dialog_close(sd->dialog); | |
414 sd->dialog_name_entry = NULL; | |
415 sd->dialog = NULL; | |
416 } | |
417 | |
418 static void bar_sort_add_ok_cb(FileDialog *fd, gpointer data) | |
419 { | |
420 SortData *sd = data; | |
421 const gchar *name; | |
422 | |
423 name = gtk_entry_get_text(GTK_ENTRY(sd->dialog_name_entry)); | |
424 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
425 { | |
426 if (strlen(name) == 0) | |
427 { | |
428 name = filename_from_path(fd->dest_path); | |
429 } | |
430 | |
431 bookmark_list_add(sd->bookmarks, name, fd->dest_path); | |
432 } | |
433 else | |
434 { | |
435 gchar *path; | |
436 gchar *ext; | |
437 | |
438 if (strlen(name) == 0) return; | |
439 | |
440 if (file_extension_match(name, ".gqv")) | |
441 { | |
442 ext = NULL; | |
443 } | |
444 else | |
445 { | |
446 ext = ".gqv"; | |
447 } | |
448 | |
283 | 449 path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, "/", name, ext, NULL); |
9 | 450 if (isfile(path)) |
451 { | |
452 gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name); | |
453 file_util_warning_dialog(_("Collection exists"), text, GTK_STOCK_DIALOG_INFO, NULL); | |
454 g_free(text); | |
455 } | |
456 else | |
457 { | |
458 CollectionData *cd; | |
459 | |
460 cd = collection_new(path); | |
461 if (collection_save(cd, path)) | |
462 { | |
463 bar_sort_collection_list_build(sd->bookmarks); | |
464 } | |
465 else | |
466 { | |
467 gchar *text = g_strdup_printf(_("Failed to save the collection:\n%s"), path); | |
468 file_util_warning_dialog(_("Save Failed"), text, | |
469 GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog); | |
470 g_free(text); | |
471 } | |
472 collection_unref(cd); | |
473 } | |
474 | |
475 g_free(path); | |
476 } | |
477 | |
478 bar_sort_add_close(sd); | |
479 } | |
480 | |
481 static void bar_sort_add_cancel_cb(FileDialog *fd, gpointer data) | |
482 { | |
483 SortData *sd = data; | |
484 | |
485 bar_sort_add_close(sd); | |
486 } | |
487 | |
488 static void bar_sort_add_cb(GtkWidget *button, gpointer data) | |
489 { | |
490 SortData *sd = data; | |
491 GtkWidget *hbox; | |
492 const gchar *title; | |
493 | |
494 if (sd->dialog) | |
495 { | |
496 gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(sd->dialog)->dialog)); | |
497 return; | |
498 } | |
499 | |
500 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
501 { | |
502 title = _("Add Bookmark"); | |
503 } | |
504 else | |
505 { | |
506 title = _("Add Collection"); | |
507 } | |
508 | |
509 sd->dialog = file_util_file_dlg(title, | |
254
9faf34f047b1
Make the wmclass value unique among the code by defining
zas_
parents:
228
diff
changeset
|
510 GQ_WMCLASS, "add_bookmark", button, |
9 | 511 bar_sort_add_cancel_cb, sd); |
512 file_dialog_add_button(sd->dialog, GTK_STOCK_OK, NULL, bar_sort_add_ok_cb, TRUE); | |
513 | |
514 generic_dialog_add_message(GENERIC_DIALOG(sd->dialog), NULL, title, NULL); | |
515 | |
516 if (sd->mode == BAR_SORT_MODE_FOLDER) | |
517 { | |
518 file_dialog_add_path_widgets(sd->dialog, NULL, NULL, "add_bookmark", NULL, NULL); | |
519 } | |
520 | |
521 hbox = pref_box_new(GENERIC_DIALOG(sd->dialog)->vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_GAP); | |
522 | |
523 pref_label_new(hbox, _("Name:")); | |
524 | |
525 sd->dialog_name_entry = gtk_entry_new(); | |
526 gtk_box_pack_start(GTK_BOX(hbox), sd->dialog_name_entry, TRUE, TRUE, 0); | |
527 generic_dialog_attach_default(GENERIC_DIALOG(sd->dialog), sd->dialog_name_entry); | |
528 gtk_widget_show(sd->dialog_name_entry); | |
529 | |
530 if (sd->mode == BAR_SORT_MODE_COLLECTION) | |
531 { | |
532 gtk_widget_grab_focus(sd->dialog_name_entry); | |
533 } | |
534 | |
535 gtk_widget_show(GENERIC_DIALOG(sd->dialog)->dialog); | |
536 } | |
537 | |
538 void bar_sort_close(GtkWidget *bar) | |
539 { | |
540 SortData *sd; | |
541 | |
542 sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data"); | |
543 if (!sd) return; | |
544 | |
545 gtk_widget_destroy(sd->vbox); | |
546 } | |
547 | |
548 static void bar_sort_destroy(GtkWidget *widget, gpointer data) | |
549 { | |
550 SortData *sd = data; | |
551 | |
552 bar_sort_add_close(sd); | |
553 | |
554 g_free(sd->undo_src); | |
555 g_free(sd->undo_dest); | |
556 g_free(sd); | |
557 } | |
558 | |
559 GtkWidget *bar_sort_new(LayoutWindow *lw) | |
560 { | |
561 SortData *sd; | |
562 GtkWidget *buttongrp; | |
563 GtkWidget *label; | |
564 GtkWidget *tbar; | |
565 GtkWidget *combo; | |
491 | 566 SortModeType mode; |
9 | 567 |
568 if (!lw) return NULL; | |
569 | |
570 sd = g_new0(SortData, 1); | |
571 | |
572 sd->lw = lw; | |
491 | 573 |
574 mode = CLAMP(options->panels.sort.mode_state, 0, BAR_SORT_MODE_COUNT - 1); | |
575 sd->action = CLAMP(options->panels.sort.action_state, 0, BAR_SORT_ACTION_COUNT - 1); | |
576 sd->selection = CLAMP(options->panels.sort.selection_state, 0, BAR_SORT_SELECTION_COUNT - 1); | |
9 | 577 sd->undo_src = NULL; |
578 sd->undo_dest = NULL; | |
579 | |
580 sd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP); | |
581 g_object_set_data(G_OBJECT(sd->vbox), "bar_sort_data", sd); | |
582 g_signal_connect(G_OBJECT(sd->vbox), "destroy", | |
583 G_CALLBACK(bar_sort_destroy), sd); | |
584 | |
585 label = gtk_label_new(_("Sort Manager")); | |
586 pref_label_bold(label, TRUE, FALSE); | |
587 gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0); | |
588 gtk_widget_show(label); | |
589 | |
590 combo = gtk_combo_box_new_text(); | |
591 gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0); | |
592 gtk_widget_show(combo); | |
593 | |
594 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders")); | |
595 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections")); | |
596 | |
597 g_signal_connect(G_OBJECT(combo), "changed", | |
598 G_CALLBACK(bar_sort_mode_cb), sd); | |
599 | |
600 sd->folder_group = pref_box_new(sd->vbox, FALSE, GTK_ORIENTATION_VERTICAL, 0); | |
601 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
602 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
|
603 _("Copy"), (sd->action == BAR_SORT_COPY), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
604 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
|
605 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
|
606 _("Move"), (sd->action == BAR_SORT_MOVE), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
607 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
|
608 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
|
609 _("Link"), (sd->action == BAR_SORT_LINK), |
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
610 G_CALLBACK(bar_sort_set_link_cb), sd); |
9 | 611 |
612 sd->collection_group = pref_box_new(sd->vbox, FALSE, GTK_ORIENTATION_VERTICAL, 0); | |
613 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
614 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
|
615 _("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
|
616 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
|
617 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
|
618 _("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
|
619 G_CALLBACK(bar_sort_set_selection_selected_cb), sd); |
9 | 620 |
621 sd->bookmarks = bookmark_list_new(SORT_KEY_FOLDERS, bar_sort_bookmark_select, sd); | |
622 gtk_box_pack_start(GTK_BOX(sd->vbox), sd->bookmarks, TRUE, TRUE, 0); | |
623 gtk_widget_show(sd->bookmarks); | |
624 | |
625 tbar = pref_toolbar_new(sd->vbox, GTK_TOOLBAR_ICONS); | |
626 | |
41
6281cc38e5ca
Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents:
9
diff
changeset
|
627 sd->add_button = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE, |
9 | 628 _("Add Bookmark"), |
629 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
|
630 sd->undo_button = pref_toolbar_button(tbar, GTK_STOCK_UNDO, NULL, FALSE, |
9 | 631 _("Undo last image"), |
632 G_CALLBACK(bar_sort_undo_cb), sd); | |
633 | |
634 sd->mode = -1; | |
491 | 635 bar_sort_mode_sync(sd, mode); |
9 | 636 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sd->mode); |
442 | 637 |
9 | 638 return sd->vbox; |
639 } |