[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: globals.nw
User: cnieves
Date: 05/11/26 19:15:03
Modified: . globals.nw o_misc.nw x_fileselect.nw
Log:
Libgeda checks if there is an autosave backup file when loading a new
schematic and call an app-dependant function to ask the user what to do.
Gschem opens a window to ask the user. Other apps just output a warning
and continue.
Revision Changes Path
1.9 +1 -0 eda/geda/devel/gschem/noweb/globals.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: globals.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/globals.nw,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- globals.nw 5 Aug 2005 02:49:48 -0000 1.8
+++ globals.nw 27 Nov 2005 00:15:01 -0000 1.9
@@ -95,6 +95,7 @@
void (*x_log_update_func)() = NULL;
void (*quit_func)() = NULL; /* not used by gschem */
void (*variable_set_func)() = NULL; /* not used by gschem */
+int (*load_newer_backup_func)() = x_fileselect_load_backup;
/* command line options */
int quiet_mode = FALSE;
1.39 +2 -2 eda/geda/devel/gschem/noweb/o_misc.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_misc.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_misc.nw,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- o_misc.nw 18 Nov 2005 20:31:48 -0000 1.38
+++ o_misc.nw 27 Nov 2005 00:15:01 -0000 1.39
@@ -1761,8 +1761,8 @@
only_filename = g_path_get_basename(real_filename);
- backup_filename = g_strdup_printf("%s%c#%s#", dirname,
- G_DIR_SEPARATOR, only_filename);
+ backup_filename = g_strdup_printf("%s%c"AUTOSAVE_BACKUP_FILENAME_STRING,
+ dirname, G_DIR_SEPARATOR, only_filename);
/* If there is not an existing file with that name, compute the
* permissions and uid/gid that we will use for the newly-created file.
1.35 +34 -0 eda/geda/devel/gschem/noweb/x_fileselect.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_fileselect.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_fileselect.nw,v
retrieving revision 1.34
retrieving revision 1.35
diff -u -b -r1.34 -r1.35
--- x_fileselect.nw 22 Oct 2005 22:21:47 -0000 1.34
+++ x_fileselect.nw 27 Nov 2005 00:15:01 -0000 1.35
@@ -58,6 +58,7 @@
<<x_fileselect.c : x_fileselect_setup()>>
+<<x_fileselect.c : x_fileselect_load_backup()>>
@
@@ -2717,3 +2718,36 @@
@ %def x_fileselect_setup
+@section Function @code{x_fileselect_load_backup()}
+
+@defun x_fileselect_load_backup toplevel
+This function opens a message dialog and wait for the user to choose if load the backup or the original file.
+
+It returns TRUE if the user wants to load the backup file, and FALSE otherwise.
+@end defun
+
+<<x_fileselect.c : x_fileselect_load_backup()>>=
+int
+x_fileselect_load_backup(TOPLEVEL *toplevel, GString *message)
+{
+ GtkWidget *dialog;
+
+ g_string_append(message, "\nIf you load the original file, the backup file will be overwritten in the next autosave timeout and it will be lost.\n\nDo you want to load the backup file?\n");
+
+ dialog = gtk_message_dialog_new(GTK_WINDOW(toplevel->main_window),
+ GTK_DIALOG_MODAL,
+ GTK_MESSAGE_QUESTION,
+ GTK_BUTTONS_YES_NO,
+ message->str);
+ gtk_widget_show (dialog);
+ if (gtk_dialog_run ((GtkDialog*)dialog) == GTK_RESPONSE_YES) {
+ gtk_widget_destroy(dialog);
+ return TRUE;
+ }
+ else {
+ gtk_widget_destroy(dialog);
+ return FALSE;
+ }
+}
+
+@ %def x_fileselect_load_backup