annotate src/bar_sort.c @ 788:477dba06deb6

Fix "No newline at end of file" warning.
author zas_
date Thu, 05 Jun 2008 23:31:22 +0000
parents d6a7fb4b8e7c
children c414002a1f27
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;
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 781
diff changeset
92 FileData *dir_fd;
780
44128da39e13 Drop initialization to NULL since filelist_read() will take care of it.
zas_
parents: 754
diff changeset
93 GList *list;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 history_list_free_key(SORT_KEY_COLLECTIONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98
700
b2eb4ff74d13 Use g_build_filename() to build paths.
zas_
parents: 586
diff changeset
99 collect_path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, NULL);
783
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 781
diff changeset
100 dir_fd = file_data_new_simple(collect_path);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 781
diff changeset
101 filelist_read(dir_fd, &list, NULL);
d6a7fb4b8e7c replaced directory path with FileData* dir_fd
nadvornik
parents: 781
diff changeset
102 file_data_unref(dir_fd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 g_free(collect_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
105 list = filelist_sort_path(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 while (work)
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 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 gchar *name;
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 fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 780
diff changeset
116 if (file_extension_match(fd->path, GQ_COLLECTION_EXT))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 {
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
118 name = remove_extension_from_path(fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 {
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
122 name = g_strdup(fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
123 }
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
124 bookmark_list_add(bookmarks, name, fd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 g_free(name);
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
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
128 filelist_free(list);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 static void bar_sort_mode_sync(SortData *sd, SortModeType mode)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 gint folder_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 if (sd->mode == mode) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 sd->mode = mode;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 folder_mode = (sd->mode == BAR_SORT_MODE_FOLDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 bookmark_list_set_no_defaults(sd->bookmarks, !folder_mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 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
142 bookmark_list_set_only_directories(sd->bookmarks, folder_mode);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 if (folder_mode)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 gtk_widget_hide(sd->collection_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 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
148 bookmark_list_set_key(sd->bookmarks, SORT_KEY_FOLDERS);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 gtk_widget_hide(sd->folder_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 gtk_widget_show(sd->collection_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154 bar_sort_collection_list_build(sd->bookmarks);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 bar_sort_add_close(sd);
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 static void bar_sort_mode_cb(GtkWidget *combo, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166 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
167 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 bar_sort_mode_sync(sd, BAR_SORT_MODE_FOLDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 bar_sort_mode_sync(sd, BAR_SORT_MODE_COLLECTION);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 }
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
174 options->panels.sort.mode_state = sd->mode;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 /* this takes control of src_list */
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
178 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
179 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
180 string_list_free(sd->undo_src_list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
181 sd->undo_src_list = filelist_to_path_list(src_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183 g_free(sd->undo_src);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
184 sd->undo_src = src ? g_strdup(src->path) : NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 g_free(sd->undo_dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 sd->undo_dest = g_strdup(dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 sd->undo_action = sd->action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
190 if (sd->undo_button)
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 gtk_widget_set_sensitive(sd->undo_button,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 ((sd->undo_src_list || sd->undo_src) && sd->undo_dest) );
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 static void bar_sort_undo_folder(SortData *sd, GtkWidget *button)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
198 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
199 if (!sd->undo_src || !sd->undo_dest) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 switch (sd->undo_action)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 case BAR_SORT_MOVE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 gchar *src_dir;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
208 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
209 src_dir = remove_level_from_path(sd->undo_src);
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
210 file_util_move_simple(list, src_dir, sd->lw->window);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 g_free(src_dir);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 case BAR_SORT_COPY:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
215 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
216 break;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
217 default:
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
218 /* undo external command */
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
219 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
220 break;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 layout_refresh(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 if (isfile(sd->undo_src))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
227 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
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 static void bar_sort_undo_collection(SortData *sd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 GList *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 work = sd->undo_src_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 gchar *source;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 source = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
244 collect_manager_remove(file_data_new_simple(source), sd->undo_dest);
9
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
250 static void bar_sort_undo_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
252 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
253
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
255 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
256 bar_sort_undo_folder(sd, button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
257 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
258 else
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 bar_sort_undo_collection(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 }
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
264 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
265 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
266 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 gchar *dest_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269 if (!isdir(path)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270
702
e07895754e65 Drop concat_dir_and_file() and use g_build_filename() instead.
zas_
parents: 700
diff changeset
271 dest_path = g_build_filename(path, source->name, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272 bar_sort_undo_set(sd, NULL, source, dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
274 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
275
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 switch (sd->action)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 case BAR_SORT_COPY:
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
279 file_util_copy_simple(list, path, sd->lw->window);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 layout_image_next(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 case BAR_SORT_MOVE:
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
284 file_util_move_simple(list, path, sd->lw->window);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 break;
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
287 default:
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
288 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
289 {
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
290 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
291 list = NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
292 layout_image_next(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 }
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
294 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 }
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 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 g_free(dest_path);
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
301 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
302 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
304
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 switch (sd->selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 case BAR_SORT_SELECTION_IMAGE:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
308 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 case BAR_SORT_SELECTION_SELECTED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 list = layout_selection_list(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
312 break;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
313 default:
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
314 break;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 if (!list)
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 bar_sort_undo_set(sd, list, NULL, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
327 FileData *image_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
329 image_fd = list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 list = list->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
331 collect_manager_add(image_fd, path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
335 static void bar_sort_bookmark_select(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337 SortData *sd = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
338 FileData *source;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
339
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
340 source = layout_image_get_fd(sd->lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 if (!path || !source) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
342
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
344 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 bar_sort_bookmark_select_folder(sd, source, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 else
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 bar_sort_bookmark_select_collection(sd, source, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
351 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
353 static void bar_sort_set_action(SortData *sd, SortActionType action)
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
354 {
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
355 options->panels.sort.action_state = sd->action = action;
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
356 }
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
357
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358 static void bar_sort_set_copy_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
360 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 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
362 bar_sort_set_action(sd, BAR_SORT_COPY);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
365 static void bar_sort_set_move_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
367 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
368 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
369 bar_sort_set_action(sd, BAR_SORT_MOVE);
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
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
372 static void bar_sort_set_filter_cb(GtkWidget *button, gpointer data)
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 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
375 guint n;
7dbdd80610a3 bar_sort_set_filter_cb(): filter_idx was set as uint so get it as uint.
zas_
parents: 753
diff changeset
376
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 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
378 n = GPOINTER_TO_UINT(g_object_get_data(G_OBJECT(button), "filter_idx"));
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
379 if (n == 0) return;
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
380 n--;
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
381 bar_sort_set_action(sd, BAR_SORT_FILTER + n);
491
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
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
384 static void bar_sort_set_selection(SortData *sd, SortSelectionType selection)
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
385 {
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
386 options->panels.sort.selection_state = sd->selection = selection;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
389 static void bar_sort_set_selection_image_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
392 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
393 bar_sort_set_selection(sd, BAR_SORT_SELECTION_IMAGE);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
396 static void bar_sort_set_selection_selected_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 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
400 bar_sort_set_selection(sd, BAR_SORT_SELECTION_SELECTED);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
403 static void bar_sort_add_close(SortData *sd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
405 if (sd->dialog) file_dialog_close(sd->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
406 sd->dialog_name_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 sd->dialog = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 static void bar_sort_add_ok_cb(FileDialog *fd, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413 const gchar *name;
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 name = gtk_entry_get_text(GTK_ENTRY(sd->dialog_name_entry));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 if (strlen(name) == 0)
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 name = filename_from_path(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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
423 bookmark_list_add(sd->bookmarks, name, fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 gchar *path;
700
b2eb4ff74d13 Use g_build_filename() to build paths.
zas_
parents: 586
diff changeset
428
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 if (strlen(name) == 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 780
diff changeset
431 if (!file_extension_match(name, GQ_COLLECTION_EXT))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 {
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 780
diff changeset
433 gchar *tmp = g_strconcat(name, GQ_COLLECTION_EXT, NULL);
700
b2eb4ff74d13 Use g_build_filename() to build paths.
zas_
parents: 586
diff changeset
434 g_free((gpointer) name);
b2eb4ff74d13 Use g_build_filename() to build paths.
zas_
parents: 586
diff changeset
435 name = tmp;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437
700
b2eb4ff74d13 Use g_build_filename() to build paths.
zas_
parents: 586
diff changeset
438 path = g_build_filename(homedir(), GQ_RC_DIR_COLLECTIONS, name, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 if (isfile(path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 file_util_warning_dialog(_("Collection exists"), text, GTK_STOCK_DIALOG_INFO, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
445 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
446 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 CollectionData *cd;
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 cd = collection_new(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 if (collection_save(cd, path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
451 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 bar_sort_collection_list_build(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 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
457 file_util_warning_dialog(_("Save Failed"), text,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
458 GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459 g_free(text);
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 collection_unref(cd);
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 g_free(path);
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 bar_sort_add_close(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 static void bar_sort_add_cancel_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
472 SortData *sd = data;
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 bar_sort_add_close(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
477 static void bar_sort_add_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 const gchar *title;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
482
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 if (sd->dialog)
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 gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(sd->dialog)->dialog));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 title = _("Add Bookmark");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493 else
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 title = _("Add Collection");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498 sd->dialog = file_util_file_dlg(title,
254
9faf34f047b1 Make the wmclass value unique among the code by defining
zas_
parents: 228
diff changeset
499 GQ_WMCLASS, "add_bookmark", button,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 bar_sort_add_cancel_cb, sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 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
502
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
503 generic_dialog_add_message(GENERIC_DIALOG(sd->dialog), NULL, title, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
504
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
505 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 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
508 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
510 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
511
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 pref_label_new(hbox, _("Name:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 sd->dialog_name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 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
516 generic_dialog_attach_default(GENERIC_DIALOG(sd->dialog), sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
517 gtk_widget_show(sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
518
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
519 if (sd->mode == BAR_SORT_MODE_COLLECTION)
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_grab_focus(sd->dialog_name_entry);
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 gtk_widget_show(GENERIC_DIALOG(sd->dialog)->dialog);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
527 void bar_sort_close(GtkWidget *bar)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 SortData *sd;
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 sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 if (!sd) return;
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 gtk_widget_destroy(sd->vbox);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 static void bar_sort_destroy(GtkWidget *widget, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
539 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
540
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541 bar_sort_add_close(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 g_free(sd->undo_src);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
544 g_free(sd->undo_dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
545 g_free(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
548 GtkWidget *bar_sort_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
549 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
550 SortData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551 GtkWidget *buttongrp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 GtkWidget *tbar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 GtkWidget *combo;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
555 SortModeType mode;
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
556 guint i;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
557
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 if (!lw) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 sd = g_new0(SortData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 sd->lw = lw;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
563
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
564 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
565 sd->action = CLAMP(options->panels.sort.action_state, 0, BAR_SORT_ACTION_COUNT - 1);
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
566
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
567 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
568
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
569 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
570 sd->undo_src = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 sd->undo_dest = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
573 sd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 g_object_set_data(G_OBJECT(sd->vbox), "bar_sort_data", sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 g_signal_connect(G_OBJECT(sd->vbox), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576 G_CALLBACK(bar_sort_destroy), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 label = gtk_label_new(_("Sort Manager"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
579 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
580 gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 gtk_widget_show(label);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 combo = gtk_combo_box_new_text();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584 gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 gtk_widget_show(combo);
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 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections"));
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 g_signal_connect(G_OBJECT(combo), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 G_CALLBACK(bar_sort_mode_cb), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593 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
594
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
595 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
596 _("Copy"), (sd->action == BAR_SORT_COPY),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
597 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
598 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
599 _("Move"), (sd->action == BAR_SORT_MOVE),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
600 G_CALLBACK(bar_sort_set_move_cb), sd);
753
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
601
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
602
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
603 for (i = 0; i < GQ_EDITOR_GENERIC_SLOTS; i++)
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
604 {
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
605 GtkWidget *button;
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
606
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
607 const gchar *name = editor_get_name(i);
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
608 if (!name || !editor_is_filter(i)) continue;
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
609
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
610 button = pref_radiobutton_new(sd->folder_group, buttongrp,
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
611 name, (sd->action == BAR_SORT_FILTER + i),
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
612 G_CALLBACK(bar_sort_set_filter_cb), sd);
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
613
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
614
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
615 g_object_set_data(G_OBJECT(button), "filter_idx", GUINT_TO_POINTER(i + 1));
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
616 }
477f48ba28d8 rewritten utilops.h:
nadvornik
parents: 702
diff changeset
617
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 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
620
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
621 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
622 _("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
623 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
624 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
625 _("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
626 G_CALLBACK(bar_sort_set_selection_selected_cb), sd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
627
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 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
629 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
630 gtk_widget_show(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 tbar = pref_toolbar_new(sd->vbox, GTK_TOOLBAR_ICONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
634 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
635 _("Add Bookmark"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 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
637 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
638 _("Undo last image"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 G_CALLBACK(bar_sort_undo_cb), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
640
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
641 sd->mode = -1;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
642 bar_sort_mode_sync(sd, mode);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
643 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sd->mode);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 283
diff changeset
644
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
645 return sd->vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
646 }