annotate src/bar_sort.c @ 328:a742c200b2e4

Re-order and try to group options.
author zas_
date Sat, 12 Apr 2008 08:28:08 +0000
parents e213fb025621
children 4b2d7f9af171
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
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
4 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
5 * Author: John Ellis
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
6 *
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
7 * This software is released under the GNU General Public License (GNU GPL).
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
8 * Please read the included file COPYING for more information.
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
9 * 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
10 */
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
281
9995c5fb202a gqview.h -> main.h
zas_
parents: 254
diff changeset
13 #include "main.h"
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
14 #include "bar_sort.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
15
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17 #include "collect-io.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "filelist.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "layout.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "layout_image.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_misc.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27
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 * sort bar
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 */
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 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 BAR_SORT_MODE_FOLDER = 0,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 BAR_SORT_MODE_COLLECTION
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 } SortModeType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40 BAR_SORT_COPY,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 BAR_SORT_MOVE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 BAR_SORT_LINK
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 } SortActionType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 BAR_SORT_SELECTION_IMAGE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47 BAR_SORT_SELECTION_SELECTED
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 } SortSelectionType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
49
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
50 typedef struct _SortData SortData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 struct _SortData
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 GtkWidget *bookmarks;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
56
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
57 FileDialog *dialog;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 GtkWidget *dialog_name_entry;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 SortModeType mode;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 SortActionType action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 SortSelectionType selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
63
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
64 GtkWidget *folder_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 GtkWidget *collection_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67 GtkWidget *add_button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 GtkWidget *undo_button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 SortActionType undo_action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 GList *undo_src_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 gchar *undo_src;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 gchar *undo_dest;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 #define SORT_KEY_FOLDERS "sort_manager"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 #define SORT_KEY_COLLECTIONS "sort_manager_collections"
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 static gint bar_sort_mode_state = BAR_SORT_MODE_FOLDER;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 static gint bar_sort_action_state = BAR_SORT_COPY;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82 static gint bar_sort_selection_state = BAR_SORT_SELECTION_IMAGE;
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
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
98 collect_path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 path_list(collect_path, &list, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 list = path_list_sort(list);
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 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 const gchar *path;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 path = work->data;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 if (file_extension_match(path, ".gqv"))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 name = remove_extension_from_path(filename_from_path(path));
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 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 name = g_strdup(filename_from_path(path));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 bookmark_list_add(bookmarks, name, path);
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
125 string_list_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);
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 if (folder_mode)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 gtk_widget_hide(sd->collection_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 gtk_widget_show(sd->folder_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 bookmark_list_set_key(sd->bookmarks, SORT_KEY_FOLDERS );
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 gtk_widget_hide(sd->folder_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 gtk_widget_show(sd->collection_group);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 bar_sort_collection_list_build(sd->bookmarks);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 bar_sort_add_close(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 static void bar_sort_mode_cb(GtkWidget *combo, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 SortData *sd = data;
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 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
163 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 bar_sort_mode_sync(sd, BAR_SORT_MODE_FOLDER);
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 else
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_COLLECTION);
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 }
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 /* this takes control of src_list */
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
173 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
174 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
175 string_list_free(sd->undo_src_list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
176 sd->undo_src_list = filelist_to_path_list(src_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 g_free(sd->undo_src);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
179 sd->undo_src = src ? g_strdup(src->path) : NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 g_free(sd->undo_dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 sd->undo_dest = g_strdup(dest);
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 sd->undo_action = sd->action;
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 if (sd->undo_button)
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 gtk_widget_set_sensitive(sd->undo_button,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 ((sd->undo_src_list || sd->undo_src) && sd->undo_dest) );
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 }
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 static void bar_sort_undo_folder(SortData *sd, GtkWidget *button)
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 if (!sd->undo_src || !sd->undo_dest) return;
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 switch (sd->undo_action)
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 case BAR_SORT_MOVE:
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 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201 gchar *src_dir;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
203 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
204 src_dir = remove_level_from_path(sd->undo_src);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 file_util_move_simple(list, src_dir);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 g_free(src_dir);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 case BAR_SORT_COPY:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
210 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
211 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 case BAR_SORT_LINK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 if (!unlink_file(sd->undo_dest))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216
67
f63ecca6c087 Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
217 buf = g_strdup_printf(_("Unable to remove symbolic link:\n%s"), sd->undo_dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 file_util_warning_dialog(_("Unlink failed"), buf, GTK_STOCK_DIALOG_ERROR, button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 break;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 layout_refresh(sd->lw);
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 if (isfile(sd->undo_src))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
228 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
229 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 static void bar_sort_undo_collection(SortData *sd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 work = sd->undo_src_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 gchar *source;
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 source = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
245 collect_manager_remove(file_data_new_simple(source), sd->undo_dest);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 static void bar_sort_undo_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
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 if (sd->mode == BAR_SORT_MODE_FOLDER)
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_folder(sd, button);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
260 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
261 bar_sort_undo_collection(sd);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
264
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
265 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
266 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
268 gchar *dest_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
269
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 if (!isdir(path)) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
272 dest_path = concat_dir_and_file(path, source->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 bar_sort_undo_set(sd, NULL, source, dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
274
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
275 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277 switch (sd->action)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
278 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279 case BAR_SORT_COPY:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 file_util_copy_simple(list, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 layout_image_next(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 case BAR_SORT_MOVE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 file_util_move_simple(list, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 case BAR_SORT_LINK:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
289 if (symlink_utf8(source->path, dest_path))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 layout_image_next(sd->lw);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
295 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
296
67
f63ecca6c087 Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
297 buf = g_strdup_printf(_("Unable to create symbolic link:\n%s"), dest_path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 file_util_warning_dialog(_("Link failed"), buf, GTK_STOCK_DIALOG_ERROR, sd->bookmarks);
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 g_free(buf);
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 break;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
305 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
306 g_free(dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
307 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
309 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
310 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 GList *list = NULL;
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 switch (sd->selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
314 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
315 case BAR_SORT_SELECTION_IMAGE:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
316 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 case BAR_SORT_SELECTION_SELECTED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 list = layout_selection_list(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 break;
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 if (!list)
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
326 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
327 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
328
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
329 bar_sort_undo_set(sd, list, NULL, path);
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 while (list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
333 FileData *image_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
334
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
335 image_fd = list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 list = list->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
337 collect_manager_add(image_fd, path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 }
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341 static void bar_sort_bookmark_select(const gchar *path, gpointer data)
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 SortData *sd = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
344 FileData *source;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
346 source = layout_image_get_fd(sd->lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347 if (!path || !source) return;
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 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 bar_sort_bookmark_select_folder(sd, source, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
353 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355 bar_sort_bookmark_select_collection(sd, source, path);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
358
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
359 static void bar_sort_set_copy_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
363 sd->action = BAR_SORT_COPY;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
366 static void bar_sort_set_move_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
369 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
370 sd->action = BAR_SORT_MOVE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
372
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
373 static void bar_sort_set_link_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
375 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377 sd->action = BAR_SORT_LINK;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
379
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
380 static void bar_sort_set_selection_image_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
382 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384 sd->selection = BAR_SORT_SELECTION_IMAGE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
387 static void bar_sort_set_selection_selected_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
390 if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
391 sd->selection = BAR_SORT_SELECTION_SELECTED;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
394 static void bar_sort_add_close(SortData *sd)
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 if (sd->dialog) file_dialog_close(sd->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 sd->dialog_name_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 sd->dialog = NULL;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
401 static void bar_sort_add_ok_cb(FileDialog *fd, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 const gchar *name;
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 name = gtk_entry_get_text(GTK_ENTRY(sd->dialog_name_entry));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 if (strlen(name) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
410 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 name = filename_from_path(fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
412 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
413
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 bookmark_list_add(sd->bookmarks, name, fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 else
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 gchar *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
419 gchar *ext;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
420
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 if (strlen(name) == 0) return;
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 if (file_extension_match(name, ".gqv"))
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 ext = NULL;
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 ext = ".gqv";
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
430 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
431
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
432 path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, "/", name, ext, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 if (isfile(path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
434 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
435 gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 file_util_warning_dialog(_("Collection exists"), text, GTK_STOCK_DIALOG_INFO, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439 else
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 CollectionData *cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 cd = collection_new(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 if (collection_save(cd, path))
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 bar_sort_collection_list_build(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
447 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
448 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
449 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 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
451 file_util_warning_dialog(_("Save Failed"), text,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
452 GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 g_free(text);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
455 collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
456 }
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 g_free(path);
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 bar_sort_add_close(sd);
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 static void bar_sort_add_cancel_cb(FileDialog *fd, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
467
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
468 bar_sort_add_close(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
471 static void bar_sort_add_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
474 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 const gchar *title;
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 if (sd->dialog)
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 gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(sd->dialog)->dialog));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
483 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 title = _("Add Bookmark");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
486 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
487 else
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 title = _("Add Collection");
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 sd->dialog = file_util_file_dlg(title,
254
9faf34f047b1 Make the wmclass value unique among the code by defining
zas_
parents: 228
diff changeset
493 GQ_WMCLASS, "add_bookmark", button,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 bar_sort_add_cancel_cb, sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 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
496
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 generic_dialog_add_message(GENERIC_DIALOG(sd->dialog), NULL, title, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
498
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
499 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 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
502 }
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 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
505
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
506 pref_label_new(hbox, _("Name:"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
507
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
508 sd->dialog_name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 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
510 generic_dialog_attach_default(GENERIC_DIALOG(sd->dialog), sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 gtk_widget_show(sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
513 if (sd->mode == BAR_SORT_MODE_COLLECTION)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515 gtk_widget_grab_focus(sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 }
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_show(GENERIC_DIALOG(sd->dialog)->dialog);
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 void bar_sort_close(GtkWidget *bar)
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 SortData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
524
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
525 sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 if (!sd) return;
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 gtk_widget_destroy(sd->vbox);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
529 }
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 static void bar_sort_destroy(GtkWidget *widget, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
534
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 bar_sort_add_close(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
536 bar_sort_mode_state = sd->mode;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
537 bar_sort_action_state = sd->action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 bar_sort_selection_state = sd->selection;
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;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553 if (!lw) return NULL;
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 sd = g_new0(SortData, 1);
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->lw = lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
558 sd->action = bar_sort_action_state;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 sd->selection = bar_sort_selection_state;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 sd->undo_src = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 sd->undo_dest = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 sd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 g_object_set_data(G_OBJECT(sd->vbox), "bar_sort_data", sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 g_signal_connect(G_OBJECT(sd->vbox), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
566 G_CALLBACK(bar_sort_destroy), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
567
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
568 label = gtk_label_new(_("Sort Manager"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571 gtk_widget_show(label);
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 combo = gtk_combo_box_new_text();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
574 gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
575 gtk_widget_show(combo);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
576
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
577 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections"));
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 g_signal_connect(G_OBJECT(combo), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 G_CALLBACK(bar_sort_mode_cb), sd);
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 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
584
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
585 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
586 _("Copy"), (sd->action == BAR_SORT_COPY),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
587 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
588 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
589 _("Move"), (sd->action == BAR_SORT_MOVE),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
590 G_CALLBACK(bar_sort_set_move_cb), sd);
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
591 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
592 _("Link"), (sd->action == BAR_SORT_LINK),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
593 G_CALLBACK(bar_sort_set_link_cb), sd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 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
596
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
597 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
598 _("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
599 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
600 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
601 _("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
602 G_CALLBACK(bar_sort_set_selection_selected_cb), sd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
603
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
604 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
605 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
606 gtk_widget_show(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
607
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
608 tbar = pref_toolbar_new(sd->vbox, GTK_TOOLBAR_ICONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
609
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
610 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
611 _("Add Bookmark"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 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
613 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
614 _("Undo last image"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
615 G_CALLBACK(bar_sort_undo_cb), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
616
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
617 sd->mode = -1;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
618 bar_sort_mode_sync(sd, bar_sort_mode_state);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
619 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sd->mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
620
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
621 return sd->vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
622 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
623