? src/glade-3.pc
Index: src/glade-app.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-app.c,v
retrieving revision 1.38
diff -u -p -r1.38 glade-app.c
--- src/glade-app.c	30 Apr 2006 06:27:36 -0000	1.38
+++ src/glade-app.c	3 Jun 2006 20:44:19 -0000
@@ -776,6 +776,41 @@ glade_app_is_project_loaded (const gchar
 	return loaded;
 }
 
+/**
+ * glade_app_get_loaded_project:
+ * @project_path: The path of an open project
+ *
+ * Finds an open project with @path
+ *
+ * Returns: A #GladeProject, or NULL if no such open project was found
+ */
+GladeProject*
+glade_app_get_loaded_project (const gchar *project_path)
+{
+	GladeApp *app;
+	GList    *l;
+	gchar *canonical_path;
+
+	if (project_path == NULL) return FALSE;
+
+	app = glade_app_get ();
+
+	canonical_path = glade_util_canonical_path (project_path);
+
+	for (l = app->priv->projects; l; l = l->next)
+	{
+		GladeProject *project = (GladeProject *) l->data;
+
+		if (project->path && strcmp (canonical_path, project->path) == 0) {
+			g_free (canonical_path);
+			return project;
+		}
+	}
+
+	g_free (canonical_path);
+
+	return NULL;
+}
 
 void
 glade_app_show_properties (gboolean raise)
Index: src/glade-app.h
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-app.h,v
retrieving revision 1.17
diff -u -p -r1.17 glade-app.h
--- src/glade-app.h	24 Apr 2006 15:36:44 -0000	1.17
+++ src/glade-app.h	3 Jun 2006 20:44:19 -0000
@@ -102,6 +102,8 @@ GKeyFile*          glade_app_get_config 
 LIBGLADEUI_API 
 gboolean           glade_app_is_project_loaded (const gchar *project_path);
 LIBGLADEUI_API 
+GladeProject*      glade_app_get_loaded_project (const gchar *project_path);
+LIBGLADEUI_API 
 void               glade_app_show_properties (gboolean raise);
 LIBGLADEUI_API 
 void               glade_app_hide_properties (void);
Index: src/glade-editor-property.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-editor-property.c,v
retrieving revision 1.32
diff -u -p -r1.32 glade-editor-property.c
--- src/glade-editor-property.c	3 Jun 2006 17:57:50 -0000	1.32
+++ src/glade-editor-property.c	3 Jun 2006 20:44:32 -0000
@@ -925,8 +925,9 @@ glade_eprop_flags_load (GladeEditorPrope
 		g_type_class_unref(class);	
 	}
 
-	gtk_entry_set_text (GTK_ENTRY (eprop_flags->entry), 
-			    g_string_free (string, FALSE));
+	gtk_entry_set_text (GTK_ENTRY (eprop_flags->entry), string->str);
+
+	g_string_free (string, TRUE);
 }
 
 
Index: src/glade-project-window.c
===================================================================
RCS file: /cvs/gnome/glade3/src/glade-project-window.c,v
retrieving revision 1.149
diff -u -p -r1.149 glade-project-window.c
--- src/glade-project-window.c	27 May 2006 01:22:27 -0000	1.149
+++ src/glade-project-window.c	3 Jun 2006 20:44:40 -0000
@@ -552,7 +552,7 @@ gpw_save (GladeProjectWindow *gpw, Glade
 static void
 gpw_save_as (GladeProjectWindow *gpw, const gchar *dialog_title)
 {
- 	GladeProject *project;
+ 	GladeProject *project, *another_project;
  	GtkWidget *filechooser;
 	gchar *path = NULL;
 	gchar *real_path, *ch;
@@ -601,17 +601,37 @@ gpw_save_as (GladeProjectWindow *gpw, co
 	
 	g_free (path);
 
-	if (glade_app_is_project_loaded (real_path))
+	/* checks if selected path is actually writable */
+	if (glade_util_file_is_writeable (real_path) == FALSE)
 	{
-		glade_util_ui_message (gpw->priv->window, GLADE_UI_WARN,
-				       _("%s is already open"), real_path);
+
+		glade_util_ui_message (gpw->priv->window, 
+				       GLADE_UI_ERROR,
+			     	       _("Could not save the file %s. You do not have the permissions necessary to save the file."), 
+				       real_path);
+
 		return;
 	}
+
+	/* checks if another open project is using selected path */
+	if ((another_project = glade_app_get_loaded_project (real_path)) != NULL)
+	{
+		if (project != another_project) {
+
+			glade_util_ui_message (gpw->priv->window, 
+					       GLADE_UI_ERROR,
+				     	       _("Could not save file %s. Another project with that path is open."), 
+					       real_path);
+
+			return;
+		}
+
+	}
+
 	gpw_save (gpw, project, real_path);
 
 	g_free (real_path);
 }
-
 
 static void
 gpw_save_cb (GtkAction *action, GladeProjectWindow *gpw)
Index: src/main.c
===================================================================
RCS file: /cvs/gnome/glade3/src/main.c,v
retrieving revision 1.48
diff -u -p -r1.48 main.c
--- src/main.c	3 Jun 2006 17:57:50 -0000	1.48
+++ src/main.c	3 Jun 2006 20:44:41 -0000
@@ -107,6 +107,8 @@ main (int argc, char *argv[])
 		return -1;
 	}
 	
+	g_option_context_free (option_context);
+	option_context = NULL;
 
 	if (version != FALSE)
 	{
