annotate src/collect-dlg.c @ 1149:c4fcf8001574

Implement preliminary support for XDG Base Directory Specification. See http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html. This feature was requested for a long time (feature requests #1950978 and #2289481). For now, it is disabled since it breaks compatibility with previous versions. To be able to test it, you have to enable it by defining USE_XDG to 1 in main.h. geeqierc and other conf files are going to: $XDG_CONFIG_HOME/geeqie/ (default to $HOME/.config/geeqie/). metadata and thumbnails cache (if std is not used) are going to: $XDG_CACHE_HOME/geeqie/metadata/ (default to $HOME/.cache/geeqie/metadata/) and $XDG_CACHE_HOME/geeqie/thumbnails/ (default to $HOME/.cache/geeqie/thumbnails/) collections are going to: $XDG_DATA_HOME/geeqie/collections/ (default to $HOME/.local/share/geeqie/collections/) Please test and report any issue.
author zas_
date Sat, 15 Nov 2008 20:17:14 +0000
parents 3a7af6a8cd5f
children 0bea79d87065
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: 9
diff changeset
2 * Geeqie
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
3 * (C) 2004 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 "collect.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
16 #include "collect-dlg.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
17
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
18 #include "collect-io.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
19 #include "utilops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
20 #include "ui_fileops.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
21 #include "ui_tabcomp.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
22 #include "ui_utildlg.h"
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
23
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
24
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
25 enum {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
26 DIALOG_SAVE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
27 DIALOG_SAVE_CLOSE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
28 DIALOG_LOAD,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
29 DIALOG_APPEND
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
30 };
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
31
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
32
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
33 static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
34
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
35
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
36 static void collection_confirm_ok_cb(GenericDialog *gd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
37 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
38 FileDialog *fd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
39 CollectionData *cd = GENERIC_DIALOG(fd)->data;
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 if (!collection_save_confirmed(fd, TRUE, cd))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
42 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
43 collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
44 file_dialog_close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
45 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
46 }
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 static void collection_confirm_cancel_cb(GenericDialog *gd, gpointer data)
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 /* this is a no-op, so the cancel button is added */
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
51 }
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 static gint collection_save_confirmed(FileDialog *fd, gint overwrite, CollectionData *cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
54 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
55 gchar *buf;
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 if (isdir(fd->dest_path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
58 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
59 buf = g_strdup_printf(_("Specified path:\n%s\nis a folder, collections are files"), fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
60 file_util_warning_dialog(_("Invalid filename"), buf, GTK_STOCK_DIALOG_INFO, GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
61 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
62 return FALSE;
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
65 if (!overwrite && isfile(fd->dest_path))
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 GenericDialog *gd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
68
254
9faf34f047b1 Make the wmclass value unique among the code by defining
zas_
parents: 196
diff changeset
69 gd = file_util_gen_dlg(_("Overwrite File"), GQ_WMCLASS, "dlg_confirm",
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
70 GENERIC_DIALOG(fd)->dialog, TRUE,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
71 collection_confirm_cancel_cb, fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
72
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
73 generic_dialog_add_message(gd, GTK_STOCK_DIALOG_QUESTION,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
74 _("Overwrite existing file?"), fd->dest_path);
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 generic_dialog_add_button(gd, GTK_STOCK_OK, _("_Overwrite"), collection_confirm_ok_cb, TRUE);
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 gtk_widget_show(gd->dialog);
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 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
81 }
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 if (!collection_save(cd, fd->dest_path))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
84 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
85 buf = g_strdup_printf(_("Failed to save the collection:\n%s"), fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
86 file_util_warning_dialog(_("Save Failed"), buf, GTK_STOCK_DIALOG_ERROR, GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
87 g_free(buf);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
90 collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
91 file_dialog_sync_history(fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
92
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
93 if (fd->type == DIALOG_SAVE_CLOSE) collection_window_close_by_collection(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
94 file_dialog_close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
95
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
96 return TRUE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
97 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
98
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
99 static void collection_save_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
100 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
101 CollectionData *cd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
102 const gchar *path;
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 path = fd->dest_path;
442
4b2d7f9af171 Big whitespaces cleanup:
zas_
parents: 283
diff changeset
105
605
651ae2be1031 Use g_ascii_strncasecmp() instead of strncasecmp() where applicable.
zas_
parents: 475
diff changeset
106 /* FIXME: utf8 */
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 711
diff changeset
107 if (!file_extension_match(path, GQ_COLLECTION_EXT))
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 gchar *buf;
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 711
diff changeset
110 buf = g_strconcat(path, GQ_COLLECTION_EXT, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 gtk_entry_set_text(GTK_ENTRY(fd->entry), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113 }
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 collection_save_confirmed(fd, FALSE, cd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120 CollectionData *cd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
122 if (!fd->dest_path || isdir(fd->dest_path)) return;
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 if (append)
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 collection_load(cd, fd->dest_path, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 collection_unref(cd);
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 else
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 collection_window_new(fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 file_dialog_sync_history(fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
135 file_dialog_close(fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 static void collection_load_cb(FileDialog *fd, gpointer data)
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 real_collection_button_pressed(fd, data, FALSE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 static void collection_append_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
145 real_collection_button_pressed(fd, data, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
146 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
148 static void collection_save_or_load_dialog_close_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150 CollectionData *cd = data;
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 if (cd) collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 file_dialog_close(fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 static void collection_save_or_load_dialog(const gchar *path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
157 gint type, CollectionData *cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
158 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 FileDialog *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 GtkWidget *parent = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 CollectWindow *cw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 const gchar *title;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 const gchar *btntext;
1002
3096a47232ec Use gpointer instead of void *.
zas_
parents: 781
diff changeset
164 gpointer btnfunc;
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
165 const gchar *stock_id;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
166
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
167 if (type == DIALOG_SAVE || type == DIALOG_SAVE_CLOSE)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
168 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
169 if (!cd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
170 title = _("Save collection");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
171 btntext = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
172 btnfunc = collection_save_cb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
173 stock_id = GTK_STOCK_SAVE;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
174 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
175 else if (type == DIALOG_LOAD)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
176 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
177 title = _("Open collection");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
178 btntext = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
179 btnfunc = collection_load_cb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
180 stock_id = GTK_STOCK_OPEN;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
181 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
182 else
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 if (!cd) return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
185 title = _("Append collection");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
186 btntext = _("_Append");
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
187 btnfunc = collection_append_cb;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
188 stock_id = GTK_STOCK_ADD;
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 if (cd) collection_ref(cd);
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 cw = collection_window_find(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
194 if (cw) parent = cw->window;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
195
254
9faf34f047b1 Make the wmclass value unique among the code by defining
zas_
parents: 196
diff changeset
196 fd = file_util_file_dlg(title, GQ_WMCLASS, "dlg_collection", parent,
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
197 collection_save_or_load_dialog_close_cb, cd);
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 generic_dialog_add_message(GENERIC_DIALOG(fd), NULL, title, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
200 file_dialog_add_button(fd, stock_id, btntext, btnfunc, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
201
1145
3a7af6a8cd5f Use functions to return directories instead of constants.
zas_
parents: 1055
diff changeset
202 file_dialog_add_path_widgets(fd, get_collections_dir(), path,
781
2d2cca2bceb0 Replace hardcoded collection filename extension by a macro (GQ_COLLECTION_EXT).
zas_
parents: 711
diff changeset
203 "collection_load_save", GQ_COLLECTION_EXT, _("Collection Files"));
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 fd->type = type;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
206
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
207 gtk_widget_show(GENERIC_DIALOG(fd)->dialog);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 void collection_dialog_save_as(gchar *path, CollectionData *cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
211 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
212 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 if (!cd->list)
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 GtkWidget *parent = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 CollectWindow *cw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 cw = collection_window_find(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219 if (cw) parent = cw->window;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 file_util_warning_dialog(_("Collection empty"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 _("The current collection is empty, save aborted."),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 GTK_STOCK_DIALOG_INFO, parent);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 return;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 #endif
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 if (!path) path = cd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
228 if (!path) path = cd->name;
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 collection_save_or_load_dialog(path, DIALOG_SAVE, cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
231 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
232
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
233 void collection_dialog_save_close(gchar *path, CollectionData *cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
234 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 if (!path) path = cd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
236 if (!path) path = cd->name;
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 collection_save_or_load_dialog(path, DIALOG_SAVE_CLOSE, cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
239 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
240
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 void collection_dialog_load(gchar *path)
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 collection_save_or_load_dialog(path, DIALOG_LOAD, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
244 }
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 void collection_dialog_append(gchar *path, CollectionData *cd)
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 collection_save_or_load_dialog(path, DIALOG_APPEND, cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
249 }
1055
1646720364cf Adding a vim modeline to all files - patch by Klaus Ethgen
nadvornik
parents: 1002
diff changeset
250 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */