annotate src/bar_sort.c @ 777:088b71bf5715

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