annotate src/collect-dlg.c @ 603:e8b28413ffbf

Replace deprecated functions by their counterparts: g_strcasecmp() -> g_ascii_strcasecmp() g_strncasecmp() -> g_ascii_strncasecmp() gtk_input_remove() -> g_source_remove() g_io_channel_close() -> g_io_channel_shutdown() + g_io_channel_unref() All these are deprecated either since 2.2 or 2.4.
author zas_
date Wed, 07 May 2008 23:27:26 +0000
parents 48c8e49b571c
children 651ae2be1031
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
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
106 if (!(strlen(path) > 7 && strncasecmp(path + (strlen(path) - 4), ".gqv", 4) == 0))
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
107 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
108 gchar *buf;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
109 buf = g_strconcat(path, ".gqv", NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
110 gtk_entry_set_text(GTK_ENTRY(fd->entry), buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
111 g_free(buf);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
112 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
113
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
114 collection_save_confirmed(fd, FALSE, cd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
117 static void real_collection_button_pressed(FileDialog *fd, gpointer data, gint append)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
118 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
119 CollectionData *cd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
120
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
121 if (!fd->dest_path || isdir(fd->dest_path)) return;
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 if (append)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
124 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
125 collection_load(cd, fd->dest_path, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
126 collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
127 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
128 else
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
129 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
130 collection_window_new(fd->dest_path);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
131 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
132
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
133 file_dialog_sync_history(fd, TRUE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
134 file_dialog_close(fd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
137 static void collection_load_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
138 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
139 real_collection_button_pressed(fd, data, FALSE);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
140 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
141
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
142 static void collection_append_cb(FileDialog *fd, gpointer data)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
143 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
144 real_collection_button_pressed(fd, data, TRUE);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
147 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
148 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
149 CollectionData *cd = data;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
150
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
151 if (cd) collection_unref(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
152 file_dialog_close(fd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
153 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
154
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
155 static void collection_save_or_load_dialog(const gchar *path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
156 gint type, CollectionData *cd)
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 FileDialog *fd;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
159 GtkWidget *parent = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
160 CollectWindow *cw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
161 const gchar *title;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
162 const gchar *btntext;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
163 void *btnfunc;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
164 gchar *base;
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
283
e213fb025621 GQVIEW_* -> GQ_*
zas_
parents: 281
diff changeset
202 base = g_strconcat(homedir(), "/", GQ_RC_DIR_COLLECTIONS, NULL);
9
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
203 file_dialog_add_path_widgets(fd, base, path,
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
204 "collection_load_save", ".gqv", _("Collection Files"));
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
205 g_free(base);
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 fd->type = type;
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 gtk_widget_show(GENERIC_DIALOG(fd)->dialog);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
210 }
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 void collection_dialog_save_as(gchar *path, CollectionData *cd)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
213 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
214 #if 0
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
215 if (!cd->list)
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
216 {
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
217 GtkWidget *parent = NULL;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
218 CollectWindow *cw;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
219
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
220 cw = collection_window_find(cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
221 if (cw) parent = cw->window;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
222 file_util_warning_dialog(_("Collection empty"),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
223 _("The current collection is empty, save aborted."),
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
224 GTK_STOCK_DIALOG_INFO, parent);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
225 return;
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 #endif
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 (!path) path = cd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
230 if (!path) path = cd->name;
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 collection_save_or_load_dialog(path, DIALOG_SAVE, cd);
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
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
235 void collection_dialog_save_close(gchar *path, CollectionData *cd)
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 if (!path) path = cd->path;
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
238 if (!path) path = cd->name;
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 collection_save_or_load_dialog(path, DIALOG_SAVE_CLOSE, cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
241 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
242
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
243 void collection_dialog_load(gchar *path)
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 collection_save_or_load_dialog(path, DIALOG_LOAD, NULL);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
246 }
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
247
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
248 void collection_dialog_append(gchar *path, CollectionData *cd)
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 collection_save_or_load_dialog(path, DIALOG_APPEND, cd);
d907d608745f Sync to GQview 1.5.9 release.
gqview
parents:
diff changeset
251 }