annotate src/bar_sort.c @ 675:cca86176bf81

Fix redundant application name in window titles. It simplifies code.
author zas_
date Fri, 16 May 2008 14:59:45 +0000
parents 905688aa2317
children b2eb4ff74d13
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"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23 #include "ui_bookmark.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 #include "ui_menu.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 #include "ui_misc.h"
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 *-------------------------------------------------------------------
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31 * sort bar
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35 typedef enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 BAR_SORT_MODE_FOLDER = 0,
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
37 BAR_SORT_MODE_COLLECTION,
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
38 BAR_SORT_MODE_COUNT
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 } SortModeType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
40
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
41 typedef enum {
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
42 BAR_SORT_COPY = 0,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 BAR_SORT_MOVE,
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
44 BAR_SORT_LINK,
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
45 BAR_SORT_ACTION_COUNT
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 } SortActionType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
47
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
48 typedef enum {
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
49 BAR_SORT_SELECTION_IMAGE = 0,
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
50 BAR_SORT_SELECTION_SELECTED,
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
51 BAR_SORT_SELECTION_COUNT
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
52 } SortSelectionType;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
53
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 typedef struct _SortData SortData;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 struct _SortData
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 GtkWidget *vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 GtkWidget *bookmarks;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 LayoutWindow *lw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 FileDialog *dialog;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 GtkWidget *dialog_name_entry;
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 SortModeType mode;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 SortActionType action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
66 SortSelectionType selection;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
67
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68 GtkWidget *folder_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
69 GtkWidget *collection_group;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 GtkWidget *add_button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72 GtkWidget *undo_button;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 SortActionType undo_action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 GList *undo_src_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
75 gchar *undo_src;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
76 gchar *undo_dest;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
77 };
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 #define SORT_KEY_FOLDERS "sort_manager"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 #define SORT_KEY_COLLECTIONS "sort_manager_collections"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
82
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
83
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
84 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
85 static void bar_sort_add_close(SortData *sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86
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 static void bar_sort_collection_list_build(GtkWidget *bookmarks)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
89 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 gchar *collect_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92 GList *work;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 history_list_free_key(SORT_KEY_COLLECTIONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95 bookmark_list_set_key(bookmarks, SORT_KEY_COLLECTIONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
97 collect_path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL);
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
98 filelist_read(collect_path, &list, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 g_free(collect_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
101 list = filelist_sort_path(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
103 work = list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
104 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
105 {
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
106 FileData *fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 gchar *name;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
109 fd = work->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 work = work->next;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
112 if (file_extension_match(fd->path, ".gqv"))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 {
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
114 name = remove_extension_from_path(fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
115 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
116 else
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 = g_strdup(fd->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 }
576
9dc0513837b5 dropped path_list functions, use filelist functions everywhere
nadvornik
parents: 521
diff changeset
120 bookmark_list_add(bookmarks, name, fd->path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 g_free(name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 }
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 filelist_free(list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 }
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 static void bar_sort_mode_sync(SortData *sd, SortModeType mode)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 gint folder_mode;
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 if (sd->mode == mode) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 sd->mode = mode;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 folder_mode = (sd->mode == BAR_SORT_MODE_FOLDER);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
136 bookmark_list_set_no_defaults(sd->bookmarks, !folder_mode);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 bookmark_list_set_editable(sd->bookmarks, folder_mode);
521
57007e49d767 Do not allow to add anything but directories to sort bar in
zas_
parents: 512
diff changeset
138 bookmark_list_set_only_directories(sd->bookmarks, folder_mode);
9
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);
512
f9bf33be53ff Remove whitespace between function name and first parenthesis for the sake of consistency.
zas_
parents: 491
diff changeset
144 bookmark_list_set_key(sd->bookmarks, SORT_KEY_FOLDERS);
9
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 }
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
170 options->panels.sort.mode_state = sd->mode;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 /* this takes control of src_list */
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
174 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
175 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
176 string_list_free(sd->undo_src_list);
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
177 sd->undo_src_list = filelist_to_path_list(src_list);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 g_free(sd->undo_src);
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
180 sd->undo_src = src ? g_strdup(src->path) : NULL;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 g_free(sd->undo_dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 sd->undo_dest = g_strdup(dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
183
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
184 sd->undo_action = sd->action;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 if (sd->undo_button)
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 gtk_widget_set_sensitive(sd->undo_button,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
189 ((sd->undo_src_list || sd->undo_src) && sd->undo_dest) );
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
193 static void bar_sort_undo_folder(SortData *sd, GtkWidget *button)
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 if (!sd->undo_src || !sd->undo_dest) return;
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 switch (sd->undo_action)
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 case BAR_SORT_MOVE:
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 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
202 gchar *src_dir;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
204 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
205 src_dir = remove_level_from_path(sd->undo_src);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206 file_util_move_simple(list, src_dir);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 g_free(src_dir);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
208 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
209 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 case BAR_SORT_COPY:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
211 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
212 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 case BAR_SORT_LINK:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 if (!unlink_file(sd->undo_dest))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217
67
f63ecca6c087 Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
218 buf = g_strdup_printf(_("Unable to remove symbolic link:\n%s"), sd->undo_dest);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 file_util_warning_dialog(_("Unlink failed"), buf, GTK_STOCK_DIALOG_ERROR, button);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 g_free(buf);
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 break;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
223 default:
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
224 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
226
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
227 layout_refresh(sd->lw);
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 if (isfile(sd->undo_src))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 {
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
231 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
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
237 static void bar_sort_undo_collection(SortData *sd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 GList *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 work = sd->undo_src_list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242 while (work)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 gchar *source;
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 source = work->data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247 work = work->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
248 collect_manager_remove(file_data_new_simple(source), sd->undo_dest);
9
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 bar_sort_undo_set(sd, NULL, NULL, NULL);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
254 static void bar_sort_undo_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
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 if (sd->mode == BAR_SORT_MODE_FOLDER)
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_folder(sd, button);
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 else
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 bar_sort_undo_collection(sd);
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 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
267
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
268 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
269 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
270 GList *list;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
271 gchar *dest_path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
272
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
273 if (!isdir(path)) return;
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 dest_path = concat_dir_and_file(path, source->name);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
276 bar_sort_undo_set(sd, NULL, source, dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
277
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
278 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
279
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
280 switch (sd->action)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
281 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
282 case BAR_SORT_COPY:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
283 file_util_copy_simple(list, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
284 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
285 layout_image_next(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
286 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
287 case BAR_SORT_MOVE:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
288 file_util_move_simple(list, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
289 list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
290 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
291 case BAR_SORT_LINK:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
292 if (symlink_utf8(source->path, dest_path))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
293 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
294 layout_image_next(sd->lw);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
297 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
298 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
299
67
f63ecca6c087 Fri Oct 13 05:22:43 2006 John Ellis <johne@verizon.net>
gqview
parents: 41
diff changeset
300 buf = g_strdup_printf(_("Unable to create symbolic link:\n%s"), dest_path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
301 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
302
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
303 g_free(buf);
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 break;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
306 default:
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
307 break;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
308 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
309
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
310 g_list_free(list);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
311 g_free(dest_path);
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
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
314 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
315 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
316 GList *list = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
317
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
318 switch (sd->selection)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
319 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
320 case BAR_SORT_SELECTION_IMAGE:
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
321 list = g_list_append(NULL, file_data_ref(source));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
322 break;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
323 case BAR_SORT_SELECTION_SELECTED:
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
324 list = layout_selection_list(sd->lw);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
325 break;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
326 default:
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
327 break;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
330 if (!list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
331 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
332 bar_sort_undo_set(sd, NULL, NULL, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
333 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
336 bar_sort_undo_set(sd, list, NULL, path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
337
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
338 while (list)
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 FileData *image_fd;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
341
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
342 image_fd = list->data;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
343 list = list->next;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
344 collect_manager_add(image_fd, path);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
345 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
346 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
347
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
348 static void bar_sort_bookmark_select(const gchar *path, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
349 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
350 SortData *sd = data;
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
351 FileData *source;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
352
138
71e1ebee420e replaced gchar* path with FileData *fd
nadvornik
parents: 67
diff changeset
353 source = layout_image_get_fd(sd->lw);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
354 if (!path || !source) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
355
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
356 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 bar_sort_bookmark_select_folder(sd, source, path);
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 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
361 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
362 bar_sort_bookmark_select_collection(sd, source, path);
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
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
366 static void bar_sort_set_action(SortData *sd, SortActionType action)
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
367 {
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
368 options->panels.sort.action_state = sd->action = action;
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
369 }
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
370
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
371 static void bar_sort_set_copy_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
374 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
375 bar_sort_set_action(sd, BAR_SORT_COPY);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
376 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
377
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
378 static void bar_sort_set_move_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
381 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
382 bar_sort_set_action(sd, BAR_SORT_MOVE);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
383 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
384
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
385 static void bar_sort_set_link_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
388 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
389 bar_sort_set_action(sd, BAR_SORT_LINK);
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
390 }
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
391
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
392 static void bar_sort_set_selection(SortData *sd, SortSelectionType selection)
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
393 {
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
394 options->panels.sort.selection_state = sd->selection = selection;
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
397 static void bar_sort_set_selection_image_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
398 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
399 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
400 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
401 bar_sort_set_selection(sd, BAR_SORT_SELECTION_IMAGE);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
404 static void bar_sort_set_selection_selected_cb(GtkWidget *button, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
407 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
408 bar_sort_set_selection(sd, BAR_SORT_SELECTION_SELECTED);
9
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
411 static void bar_sort_add_close(SortData *sd)
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 if (sd->dialog) file_dialog_close(sd->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
414 sd->dialog_name_entry = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
415 sd->dialog = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
416 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
417
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
418 static void bar_sort_add_ok_cb(FileDialog *fd, gpointer data)
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 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
421 const gchar *name;
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 name = gtk_entry_get_text(GTK_ENTRY(sd->dialog_name_entry));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
424 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
425 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
426 if (strlen(name) == 0)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
427 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
428 name = filename_from_path(fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
429 }
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 bookmark_list_add(sd->bookmarks, name, fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
432 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
433 else
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 *path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
436 gchar *ext;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
437
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
438 if (strlen(name) == 0) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
439
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
440 if (file_extension_match(name, ".gqv"))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
441 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
442 ext = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
443 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
444 else
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 ext = ".gqv";
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
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
449 path = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, "/", name, ext, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
450 if (isfile(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 gchar *text = g_strdup_printf(_("The collection:\n%s\nalready exists."), name);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
453 file_util_warning_dialog(_("Collection exists"), text, GTK_STOCK_DIALOG_INFO, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
454 g_free(text);
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 else
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 CollectionData *cd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
459
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
460 cd = collection_new(path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
461 if (collection_save(cd, path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
462 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
463 bar_sort_collection_list_build(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
464 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
465 else
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 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
468 file_util_warning_dialog(_("Save Failed"), text,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
469 GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
470 g_free(text);
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 collection_unref(cd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
475 g_free(path);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
478 bar_sort_add_close(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
479 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
480
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
481 static void bar_sort_add_cancel_cb(FileDialog *fd, gpointer data)
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 SortData *sd = data;
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 bar_sort_add_close(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
488 static void bar_sort_add_cb(GtkWidget *button, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
489 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
490 SortData *sd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
491 GtkWidget *hbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
492 const gchar *title;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
493
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
494 if (sd->dialog)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
495 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
496 gtk_window_present(GTK_WINDOW(GENERIC_DIALOG(sd->dialog)->dialog));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
497 return;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
500 if (sd->mode == BAR_SORT_MODE_FOLDER)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
501 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
502 title = _("Add Bookmark");
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 else
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 title = _("Add Collection");
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
509 sd->dialog = file_util_file_dlg(title,
254
9faf34f047b1 Make the wmclass value unique among the code by defining
zas_
parents: 228
diff changeset
510 GQ_WMCLASS, "add_bookmark", button,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
511 bar_sort_add_cancel_cb, sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
512 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
513
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
514 generic_dialog_add_message(GENERIC_DIALOG(sd->dialog), NULL, title, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
515
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
516 if (sd->mode == BAR_SORT_MODE_FOLDER)
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 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
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 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
522
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
523 pref_label_new(hbox, _("Name:"));
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->dialog_name_entry = gtk_entry_new();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
526 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
527 generic_dialog_attach_default(GENERIC_DIALOG(sd->dialog), sd->dialog_name_entry);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
528 gtk_widget_show(sd->dialog_name_entry);
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 if (sd->mode == BAR_SORT_MODE_COLLECTION)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
531 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
532 gtk_widget_grab_focus(sd->dialog_name_entry);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
535 gtk_widget_show(GENERIC_DIALOG(sd->dialog)->dialog);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
538 void bar_sort_close(GtkWidget *bar)
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 SortData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
541
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
542 sd = g_object_get_data(G_OBJECT(bar), "bar_sort_data");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
543 if (!sd) return;
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 gtk_widget_destroy(sd->vbox);
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 static void bar_sort_destroy(GtkWidget *widget, gpointer data)
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 = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
551
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
552 bar_sort_add_close(sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
553
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
554 g_free(sd->undo_src);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
555 g_free(sd->undo_dest);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
556 g_free(sd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
559 GtkWidget *bar_sort_new(LayoutWindow *lw)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
560 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
561 SortData *sd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
562 GtkWidget *buttongrp;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
563 GtkWidget *label;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
564 GtkWidget *tbar;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
565 GtkWidget *combo;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
566 SortModeType mode;
9
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 if (!lw) return NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
569
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
570 sd = g_new0(SortData, 1);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
571
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
572 sd->lw = lw;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
573
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
574 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
575 sd->action = CLAMP(options->panels.sort.action_state, 0, BAR_SORT_ACTION_COUNT - 1);
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
576 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
577 sd->undo_src = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
578 sd->undo_dest = NULL;
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 sd->vbox = gtk_vbox_new(FALSE, PREF_PAD_GAP);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
581 g_object_set_data(G_OBJECT(sd->vbox), "bar_sort_data", sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
582 g_signal_connect(G_OBJECT(sd->vbox), "destroy",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
583 G_CALLBACK(bar_sort_destroy), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
584
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
585 label = gtk_label_new(_("Sort Manager"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
586 pref_label_bold(label, TRUE, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
587 gtk_box_pack_start(GTK_BOX(sd->vbox), label, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
588 gtk_widget_show(label);
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 combo = gtk_combo_box_new_text();
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
591 gtk_box_pack_start(GTK_BOX(sd->vbox), combo, FALSE, FALSE, 0);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
592 gtk_widget_show(combo);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
593
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
594 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Folders"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
595 gtk_combo_box_append_text(GTK_COMBO_BOX(combo), _("Collections"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
596
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
597 g_signal_connect(G_OBJECT(combo), "changed",
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
598 G_CALLBACK(bar_sort_mode_cb), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
599
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
600 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
601
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
602 buttongrp = pref_radiobutton_new(sd->folder_group, NULL,
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
603 _("Copy"), (sd->action == BAR_SORT_COPY),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
604 G_CALLBACK(bar_sort_set_copy_cb), sd);
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
605 pref_radiobutton_new(sd->folder_group, buttongrp,
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
606 _("Move"), (sd->action == BAR_SORT_MOVE),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
607 G_CALLBACK(bar_sort_set_move_cb), sd);
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
608 pref_radiobutton_new(sd->folder_group, buttongrp,
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
609 _("Link"), (sd->action == BAR_SORT_LINK),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
610 G_CALLBACK(bar_sort_set_link_cb), sd);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
611
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
612 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
613
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
614 buttongrp = pref_radiobutton_new(sd->collection_group, NULL,
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
615 _("Add image"), (sd->selection == BAR_SORT_SELECTION_IMAGE),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
616 G_CALLBACK(bar_sort_set_selection_image_cb), sd);
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
617 pref_radiobutton_new(sd->collection_group, buttongrp,
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
618 _("Add selection"), (sd->selection == BAR_SORT_SELECTION_SELECTED),
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
619 G_CALLBACK(bar_sort_set_selection_selected_cb), sd);
9
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 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
622 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
623 gtk_widget_show(sd->bookmarks);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
624
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
625 tbar = pref_toolbar_new(sd->vbox, GTK_TOOLBAR_ICONS);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
626
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
627 sd->add_button = pref_toolbar_button(tbar, GTK_STOCK_ADD, NULL, FALSE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
628 _("Add Bookmark"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
629 G_CALLBACK(bar_sort_add_cb), sd);
41
6281cc38e5ca Wed Apr 27 15:17:57 2005 John Ellis <johne@verizon.net>
gqview
parents: 9
diff changeset
630 sd->undo_button = pref_toolbar_button(tbar, GTK_STOCK_UNDO, NULL, FALSE,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
631 _("Undo last image"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
632 G_CALLBACK(bar_sort_undo_cb), sd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
633
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
634 sd->mode = -1;
491
4a9570cd06f8 Save sort manager state to rc file.
zas_
parents: 475
diff changeset
635 bar_sort_mode_sync(sd, mode);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
636 gtk_combo_box_set_active(GTK_COMBO_BOX(combo), sd->mode);
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 283
diff changeset
637
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
638 return sd->vbox;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
639 }