[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: gaf.git: branch: master updated (1.7.0-20110116-39-g3f0e6e8)
The branch, master has been updated
via 3f0e6e8bc8771a83ed8df36a0818258f51813580 (commit)
via 0b49dd7aba9cbef87d765151adb728b781e4cf81 (commit)
via d506039d41aea6ecd9e15e62e7b79de8cca284bd (commit)
from 6c4b8a72cd917872709bfb7918f9a1141d9c8548 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
=========
Summary
=========
gattrib/src/x_fileselect.c | 2 +-
gschem/src/o_misc.c | 2 +-
gschem/src/o_undo.c | 2 +-
gschem/src/x_window.c | 16 ++++++++++++++--
libgeda/include/libgeda/prototype.h | 4 ++--
libgeda/src/a_basic.c | 7 +++----
libgeda/src/f_basic.c | 17 +++++++++++++----
libgeda/src/s_page.c | 2 +-
8 files changed, 36 insertions(+), 16 deletions(-)
=================
Commit Messages
=================
commit 3f0e6e8bc8771a83ed8df36a0818258f51813580
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
gschem: show error dialog when save fails
Closes-bug: lp-698566
:100644 100644 5513183... c9290a7... M gschem/src/x_window.c
commit 0b49dd7aba9cbef87d765151adb728b781e4cf81
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
libgeda: report errors in f_save
Affects-bug: lp-698566
:100644 100644 7fec6cc... 723b19c... M libgeda/src/f_basic.c
commit d506039d41aea6ecd9e15e62e7b79de8cca284bd
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
libgeda: add GError argument to f_save and o_save
o_save and f_save now can report errors during file write using GLib
GError mechanism, similar to f_open.
Affects-bug: lp-698566
:100644 100644 e384aa9... 382305b... M gattrib/src/x_fileselect.c
:100644 100644 d629054... 340a054... M gschem/src/o_misc.c
:100644 100644 b920fe4... dc30c36... M gschem/src/o_undo.c
:100644 100644 2ee9f82... 5513183... M gschem/src/x_window.c
:100644 100644 fc58114... 4f0f584... M libgeda/include/libgeda/prototype.h
:100644 100644 158eb2d... b397f00... M libgeda/src/a_basic.c
:100644 100644 a79aaf2... 7fec6cc... M libgeda/src/f_basic.c
:100644 100644 a8fa900... 25a69d8... M libgeda/src/s_page.c
=========
Changes
=========
commit 3f0e6e8bc8771a83ed8df36a0818258f51813580
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
gschem: show error dialog when save fails
Closes-bug: lp-698566
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 5513183..c9290a7 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -834,6 +834,7 @@ x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filenam
PAGE *old_current;
const gchar *log_msg, *state_msg;
gint ret;
+ GError *err = NULL;
g_return_val_if_fail (toplevel != NULL, 0);
g_return_val_if_fail (page != NULL, 0);
@@ -845,12 +846,23 @@ x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filenam
/* change to page */
s_page_goto (toplevel, page);
/* and try saving current page to filename */
- ret = (gint)f_save (toplevel, toplevel->page_current, filename, NULL);
+ ret = (gint)f_save (toplevel, toplevel->page_current, filename, &err);
if (ret != 1) {
- /* an error occured when saving page to file */
log_msg = _("Could NOT save page [%s]\n");
state_msg = _("Error while trying to save");
+ GtkWidget *dialog;
+
+ dialog = gtk_message_dialog_new (GTK_WINDOW (w_current->main_window),
+ GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_MESSAGE_ERROR,
+ GTK_BUTTONS_CLOSE,
+ "%s",
+ err->message);
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Failed to save file"));
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ g_clear_error (&err);
} else {
/* successful save of page to file, update page... */
/* change page name if necessary and prepare log message */
commit 0b49dd7aba9cbef87d765151adb728b781e4cf81
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
libgeda: report errors in f_save
Affects-bug: lp-698566
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index 7fec6cc..723b19c 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -356,12 +356,16 @@ int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename, GError **err)
gchar *dirname;
mode_t saved_umask, mask;
struct stat st;
+ GError *tmp_err = NULL;
/* Get the real filename and file permissions */
- real_filename = follow_symlinks (filename, NULL);
+ real_filename = follow_symlinks (filename, &tmp_err);
if (real_filename == NULL) {
- s_log_message (_("Can't get the real filename of %s."), filename);
+ g_set_error (err, tmp_err->domain, tmp_err->code,
+ _("Can't get the real filename of %s: %s"),
+ filename,
+ tmp_err->message);
return 0;
}
@@ -433,7 +437,7 @@ int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename, GError **err)
g_free (dirname);
g_free (only_filename);
- if (o_save (toplevel, s_page_objects (page), real_filename, err)) {
+ if (o_save (toplevel, s_page_objects (page), real_filename, &tmp_err)) {
page->saved_since_first_loaded = 1;
@@ -455,6 +459,9 @@ int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename, GError **err)
return 1;
}
else {
+ g_set_error (err, tmp_err->domain, tmp_err->code,
+ _("Could NOT save file: %s"), tmp_err->message);
+ g_clear_error (&tmp_err);
g_free (real_filename);
return 0;
}
commit d506039d41aea6ecd9e15e62e7b79de8cca284bd
Author: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
Commit: Krzysztof KoÅ?ciuszkiewicz <k.kosciuszkiewicz@xxxxxxxxx>
libgeda: add GError argument to f_save and o_save
o_save and f_save now can report errors during file write using GLib
GError mechanism, similar to f_open.
Affects-bug: lp-698566
diff --git a/gattrib/src/x_fileselect.c b/gattrib/src/x_fileselect.c
index e384aa9..382305b 100644
--- a/gattrib/src/x_fileselect.c
+++ b/gattrib/src/x_fileselect.c
@@ -303,7 +303,7 @@ x_fileselect_save (void)
/* try saving current page of toplevel to file filename */
if (filename != NULL &&
- f_save (pr_current, pr_current->page_current, filename)) {
+ f_save (pr_current, pr_current->page_current, filename, NULL)) {
s_log_message ("Saved As [%s]\n", filename);
/* replace page filename with new one, do not free filename */
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index d629054..340a054 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -800,7 +800,7 @@ void o_autosave_backups(GSCHEM_TOPLEVEL *w_current)
if (o_save (toplevel,
s_page_objects (toplevel->page_current),
- backup_filename)) {
+ backup_filename, NULL)) {
p_current->ops_since_last_backup = 0;
p_current->do_autosave_backup = 0;
diff --git a/gschem/src/o_undo.c b/gschem/src/o_undo.c
index b920fe4..dc30c36 100644
--- a/gschem/src/o_undo.c
+++ b/gschem/src/o_undo.c
@@ -117,7 +117,7 @@ void o_undo_savestate(GSCHEM_TOPLEVEL *w_current, int flag)
/* f_save manages the creaton of backup copies.
This way, f_save is called only when saving a file, and not when
saving an undo backup copy */
- o_save (toplevel, s_page_objects (toplevel->page_current), filename);
+ o_save (toplevel, s_page_objects (toplevel->page_current), filename, NULL);
} else if (w_current->undo_type == UNDO_MEMORY && flag == UNDO_ALL) {
object_list = o_glist_copy_all (toplevel,
diff --git a/gschem/src/x_window.c b/gschem/src/x_window.c
index 2ee9f82..5513183 100644
--- a/gschem/src/x_window.c
+++ b/gschem/src/x_window.c
@@ -845,7 +845,7 @@ x_window_save_page (GSCHEM_TOPLEVEL *w_current, PAGE *page, const gchar *filenam
/* change to page */
s_page_goto (toplevel, page);
/* and try saving current page to filename */
- ret = (gint)f_save (toplevel, toplevel->page_current, filename);
+ ret = (gint)f_save (toplevel, toplevel->page_current, filename, NULL);
if (ret != 1) {
/* an error occured when saving page to file */
log_msg = _("Could NOT save page [%s]\n");
diff --git a/libgeda/include/libgeda/prototype.h b/libgeda/include/libgeda/prototype.h
index fc58114..4f0f584 100644
--- a/libgeda/include/libgeda/prototype.h
+++ b/libgeda/include/libgeda/prototype.h
@@ -2,7 +2,7 @@
/* a_basic.c */
const gchar *o_file_format_header();
gchar *o_save_buffer (TOPLEVEL *toplevel, const GList *object_list);
-int o_save (TOPLEVEL *toplevel, const GList *object_list, const char *filename);
+int o_save (TOPLEVEL *toplevel, const GList *object_list, const char *filename, GError **err);
GList *o_read_buffer(TOPLEVEL *toplevel, GList *object_list, char *buffer, const int size, const char *name);
GList *o_read(TOPLEVEL *toplevel, GList *object_list, char *filename, GError **err);
void o_scale(TOPLEVEL *toplevel, GList *list, int x_scale, int y_scale);
@@ -14,7 +14,7 @@ int f_open(TOPLEVEL *toplevel, PAGE *page, const gchar *filename, GError **err);
int f_open_flags(TOPLEVEL *toplevel, PAGE *page, const gchar *filename,
const gint flags, GError **err);
void f_close(TOPLEVEL *toplevel);
-int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename);
+int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename, GError **error);
gchar *f_normalize_filename (const gchar *filename, GError **error);
char *follow_symlinks (const gchar *filename, GError **error);
diff --git a/libgeda/src/a_basic.c b/libgeda/src/a_basic.c
index 158eb2d..b397f00 100644
--- a/libgeda/src/a_basic.c
+++ b/libgeda/src/a_basic.c
@@ -218,18 +218,17 @@ gchar *o_save_objects (TOPLEVEL *toplevel, const GList *object_list, gboolean sa
* \param [in] toplevel The current TOPLEVEL.
* \param [in] object_list The head of a GList of OBJECTs to save.
* \param [in] filename The filename to save the data to.
+ * \param [in,out] err #GError structure for error reporting.
* \return 1 on success, 0 on failure.
*/
int o_save (TOPLEVEL *toplevel, const GList *object_list,
- const char *filename)
+ const char *filename, GError **err)
{
char *buffer;
- GError *err = NULL;
buffer = o_save_buffer (toplevel, object_list);
- if (!g_file_set_contents (filename, buffer, strlen(buffer), &err)) {
+ if (!g_file_set_contents (filename, buffer, strlen(buffer), err)) {
g_free (buffer);
- g_error_free (err);
return 0;
}
g_free (buffer);
diff --git a/libgeda/src/f_basic.c b/libgeda/src/f_basic.c
index a79aaf2..7fec6cc 100644
--- a/libgeda/src/f_basic.c
+++ b/libgeda/src/f_basic.c
@@ -344,9 +344,11 @@ void f_close(TOPLEVEL *toplevel)
*
* \param [in,out] toplevel The TOPLEVEL object containing the schematic.
* \param [in] filename The file name to save the schematic to.
+ * \param [in,out] err #GError structure for error reporting, or
+ * NULL to disable error reporting
* \return 1 on success, 0 on failure.
*/
-int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename)
+int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename, GError **err)
{
gchar *backup_filename;
gchar *real_filename;
@@ -431,7 +433,7 @@ int f_save(TOPLEVEL *toplevel, PAGE *page, const char *filename)
g_free (dirname);
g_free (only_filename);
- if (o_save (toplevel, s_page_objects (page), real_filename)) {
+ if (o_save (toplevel, s_page_objects (page), real_filename, err)) {
page->saved_since_first_loaded = 1;
diff --git a/libgeda/src/s_page.c b/libgeda/src/s_page.c
index a8fa900..25a69d8 100644
--- a/libgeda/src/s_page.c
+++ b/libgeda/src/s_page.c
@@ -495,7 +495,7 @@ gint s_page_save_all (TOPLEVEL *toplevel)
p_current = (PAGE *)iter->data;
if (f_save (toplevel, p_current,
- p_current->page_filename)) {
+ p_current->page_filename, NULL)) {
s_log_message (_("Saved [%s]\n"),
p_current->page_filename);
/* reset the CHANGED flag of p_current */
_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs