Commit 317217d0 authored by Paolo Maggi's avatar Paolo Maggi Committed by Paolo Maggi

new functions

2002-07-10  Paolo Maggi  <maggi@athena.polito.it>

	* gedit-utils.[ch] (gedit_utils_uri_exists): new functions

	* gedit-mdi.c (gedit_mdi_remove_child_handler):  Check to see if
        the file has been deleted from the filesystem before closing
	(fixed bug #75861).

	* gedit-file.c (gedit_file_save): Save the file if it has
	been deleted from the filesystem ((fixed bug #75861).
parent cd89cb4e
2002-07-10 Paolo Maggi <maggi@athena.polito.it>
* gedit-utils.[ch] (gedit_utils_uri_exists): new functions
* gedit-mdi.c (gedit_mdi_remove_child_handler): Check to see if
the file has been deleted from the filesystem before closing
(fixed bug #75861).
* gedit-file.c (gedit_file_save): Save the file if it has
been deleted from the filesystem ((fixed bug #75861).
2002-07-10 Paolo Maggi <maggi@athena.polito.it>
* gedit-prefs-manager.[ch]:
......
......@@ -289,9 +289,23 @@ gedit_file_save (GeditMDIChild* child)
if (!gedit_document_get_modified (doc))
{
gchar *raw_uri;
gboolean deleted = FALSE;
gedit_debug (DEBUG_FILE, "Not modified");
return TRUE;
raw_uri = gedit_document_get_raw_uri (doc);
if (raw_uri != NULL)
{
if (gedit_document_is_readonly (doc))
deleted = FALSE;
else
deleted = !gedit_utils_uri_exists (raw_uri);
}
g_free (raw_uri);
if (!deleted)
return TRUE;
}
uri = gedit_document_get_uri (doc);
......
......@@ -799,6 +799,8 @@ gedit_mdi_remove_child_handler (BonoboMDI *mdi, BonoboMDIChild *child)
{
GeditDocument* doc;
gboolean close = TRUE;
gchar *raw_uri;
gboolean deleted = FALSE;
gedit_debug (DEBUG_MDI, "");
......@@ -807,7 +809,17 @@ gedit_mdi_remove_child_handler (BonoboMDI *mdi, BonoboMDIChild *child)
doc = GEDIT_MDI_CHILD (child)->document;
if (gedit_document_get_modified (doc))
raw_uri = gedit_document_get_raw_uri (doc);
if (raw_uri != NULL)
{
if (gedit_document_is_readonly (doc))
deleted = FALSE;
else
deleted = !gedit_utils_uri_exists (raw_uri);
}
g_free (raw_uri);
if (gedit_document_get_modified (doc) || deleted)
{
GtkWidget *msgbox, *w;
gchar *fname = NULL, *msg = NULL;
......
......@@ -1304,3 +1304,21 @@ gedit_utils_set_atk_relation ( GtkWidget *obj1,
g_object_unref (G_OBJECT (relation));
}
gboolean
gedit_utils_uri_exists (const gchar* text_uri)
{
GnomeVFSURI *uri;
gboolean res;
g_return_val_if_fail (text_uri != NULL, FALSE);
uri = gnome_vfs_uri_new (text_uri);
g_return_val_if_fail (uri != NULL, FALSE);
res = gnome_vfs_uri_exists (uri);
gnome_vfs_uri_unref (uri);
return res;
}
......@@ -79,6 +79,9 @@ void gedit_utils_set_atk_name_description (GtkWidget *widget, const gchar *name,
const gchar *description);
void gedit_utils_set_atk_relation (GtkWidget *obj1, GtkWidget *obj2,
AtkRelationType rel_type);
gboolean gedit_utils_uri_exists (const gchar* text_uri);
#endif /* __GEDIT_UTILS_H__ */
2002-07-10 Paolo Maggi <maggi@athena.polito.it>
* gedit-utils.[ch] (gedit_utils_uri_exists): new functions
* gedit-mdi.c (gedit_mdi_remove_child_handler): Check to see if
the file has been deleted from the filesystem before closing
(fixed bug #75861).
* gedit-file.c (gedit_file_save): Save the file if it has
been deleted from the filesystem ((fixed bug #75861).
2002-07-10 Paolo Maggi <maggi@athena.polito.it>
* gedit-prefs-manager.[ch]:
......
......@@ -289,9 +289,23 @@ gedit_file_save (GeditMDIChild* child)
if (!gedit_document_get_modified (doc))
{
gchar *raw_uri;
gboolean deleted = FALSE;
gedit_debug (DEBUG_FILE, "Not modified");
return TRUE;
raw_uri = gedit_document_get_raw_uri (doc);
if (raw_uri != NULL)
{
if (gedit_document_is_readonly (doc))
deleted = FALSE;
else
deleted = !gedit_utils_uri_exists (raw_uri);
}
g_free (raw_uri);
if (!deleted)
return TRUE;
}
uri = gedit_document_get_uri (doc);
......
......@@ -799,6 +799,8 @@ gedit_mdi_remove_child_handler (BonoboMDI *mdi, BonoboMDIChild *child)
{
GeditDocument* doc;
gboolean close = TRUE;
gchar *raw_uri;
gboolean deleted = FALSE;
gedit_debug (DEBUG_MDI, "");
......@@ -807,7 +809,17 @@ gedit_mdi_remove_child_handler (BonoboMDI *mdi, BonoboMDIChild *child)
doc = GEDIT_MDI_CHILD (child)->document;
if (gedit_document_get_modified (doc))
raw_uri = gedit_document_get_raw_uri (doc);
if (raw_uri != NULL)
{
if (gedit_document_is_readonly (doc))
deleted = FALSE;
else
deleted = !gedit_utils_uri_exists (raw_uri);
}
g_free (raw_uri);
if (gedit_document_get_modified (doc) || deleted)
{
GtkWidget *msgbox, *w;
gchar *fname = NULL, *msg = NULL;
......
......@@ -1304,3 +1304,21 @@ gedit_utils_set_atk_relation ( GtkWidget *obj1,
g_object_unref (G_OBJECT (relation));
}
gboolean
gedit_utils_uri_exists (const gchar* text_uri)
{
GnomeVFSURI *uri;
gboolean res;
g_return_val_if_fail (text_uri != NULL, FALSE);
uri = gnome_vfs_uri_new (text_uri);
g_return_val_if_fail (uri != NULL, FALSE);
res = gnome_vfs_uri_exists (uri);
gnome_vfs_uri_unref (uri);
return res;
}
......@@ -79,6 +79,9 @@ void gedit_utils_set_atk_name_description (GtkWidget *widget, const gchar *name,
const gchar *description);
void gedit_utils_set_atk_relation (GtkWidget *obj1, GtkWidget *obj2,
AtkRelationType rel_type);
gboolean gedit_utils_uri_exists (const gchar* text_uri);
#endif /* __GEDIT_UTILS_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment