[Glade-devel] [patch, glade3] don't warn on save file selector "cancel"

paolo borelli pborelli@katamail.com
15 Mar 2003 13:54:21 +0100


--=-rR3zZvm4YxRV7SBCYbqD
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

Hi!

Thanks to Joaquin for applying my previos patches.

The one attached fix the following problem: when the user is prompted
with a file selection dialog on "save" or "save as" and clicks on
"cancel" a g_warning is showed.

ciao
	paolo

--=-rR3zZvm4YxRV7SBCYbqD
Content-Disposition: attachment; filename=save-no-warn-on-cancel.patch
Content-Type: text/x-patch; name=save-no-warn-on-cancel.patch; charset=UTF-8
Content-Transfer-Encoding: 7bit

diff -pur gnome2/glade3/ChangeLog glade3/ChangeLog
--- gnome2/glade3/ChangeLog	2003-03-15 13:48:36.000000000 +0100
+++ glade3/ChangeLog	2003-03-15 13:51:29.000000000 +0100
@@ -1,3 +1,7 @@
+2003-03-15 Paolo Borelli <pborelli@katamail.com>
+
+	* src/glade-project.c: don't warn on save file selector "cancel"
+
 2003-03-14 Paolo Borelli <pborelli@katamail.com>
 
 	* src/glade-project-window.c: remove gpw_keypress_widget_tree_cb
diff -pur gnome2/glade3/src/glade-project.c glade3/src/glade-project.c
--- gnome2/glade3/src/glade-project.c	2003-03-12 19:05:44.000000000 +0100
+++ glade3/src/glade-project.c	2003-03-15 13:49:56.000000000 +0100
@@ -631,6 +631,13 @@ glade_project_save (GladeProject *projec
 	if (project->path == NULL) {
 		g_free (project->name);
 		project->path = glade_project_ui_get_path (_("Save ..."));
+
+		/* If the user hit cancel, restore its previous name and return */
+		if (project->path == NULL) {
+			project->path = backup;
+			return FALSE;
+		}
+
 		project->name = g_path_get_basename (project->path);
 		g_free (backup);
 	}
@@ -665,7 +672,13 @@ glade_project_save_as (GladeProject *pro
 
 	/* Keep the previous path */
 	backup = project->path;
-	project->path = glade_project_ui_get_path (_("Save ..."));
+	project->path = glade_project_ui_get_path (_("Save as ..."));
+
+	/* If the user hit cancel, restore its previous name and return */
+	if (project->path == NULL) {
+		project->path = backup;
+		return FALSE;
+	}
 
 	/* On error, warn and restore its previous name and return */
 	if (!glade_project_save_to_file (project, project->path)) {

--=-rR3zZvm4YxRV7SBCYbqD--