Commit 65d5e587 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

don't g_message() on error but return a GError.

2002-10-30  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpdata.[ch] (gimp_data_delete_from_disk): don't
	g_message() on error but return a GError.

	* app/widgets/gimpdatafactoryview.c: show the message here.
parent 0aace896
2002-10-30 Michael Natterer <mitch@gimp.org>
* app/core/gimpdata.[ch] (gimp_data_delete_from_disk): don't
g_message() on error but return a GError.
* app/widgets/gimpdatafactoryview.c: show the message here.
2002-10-30 Michael Natterer <mitch@gimp.org>
 
* app/widgets/gimpdevices.c: don't #include "core/gimpbrush.h"
......
......@@ -37,6 +37,8 @@
#include "gimpdata.h"
#include "gimpmarshal.h"
#include "libgimp/gimpintl.h"
enum
{
......@@ -243,18 +245,21 @@ gimp_data_real_dirty (GimpData *data)
}
gboolean
gimp_data_delete_from_disk (GimpData *data)
gimp_data_delete_from_disk (GimpData *data,
GError **error)
{
g_return_val_if_fail (GIMP_IS_DATA (data), FALSE);
g_return_val_if_fail (data->filename != NULL, FALSE);
g_return_val_if_fail (error == NULL || *error == NULL, FALSE);
if (data->internal)
return TRUE;
if (unlink (data->filename) == -1)
{
g_message ("%s(): could not unlink() %s: %s",
G_GNUC_FUNCTION, data->filename, g_strerror (errno));
g_set_error (error, 0, 0,
_("Could not delete '%s': %s"),
data->filename, g_strerror (errno));
return FALSE;
}
......
......@@ -58,20 +58,21 @@ struct _GimpDataClass
GType gimp_data_get_type (void) G_GNUC_CONST;
gboolean gimp_data_save (GimpData *data);
gboolean gimp_data_save (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data);
void gimp_data_dirty (GimpData *data);
gboolean gimp_data_delete_from_disk (GimpData *data,
GError **error);
const gchar * gimp_data_get_extension (GimpData *data);
const gchar * gimp_data_get_extension (GimpData *data);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *data_path);
void gimp_data_set_filename (GimpData *data,
const gchar *filename);
void gimp_data_create_filename (GimpData *data,
const gchar *filename,
const gchar *data_path);
GimpData * gimp_data_duplicate (GimpData *data);
GimpData * gimp_data_duplicate (GimpData *data);
#endif /* __GIMP_DATA_H__ */
......@@ -370,7 +370,15 @@ gimp_data_factory_view_delete_callback (GtkWidget *widget,
GIMP_OBJECT (delete_data->data)))
{
if (delete_data->data->filename)
gimp_data_delete_from_disk (delete_data->data);
{
GError *error = NULL;
if (! gimp_data_delete_from_disk (delete_data->data, &error))
{
g_message (error->message);
g_clear_error (&error);
}
}
gimp_container_remove (delete_data->factory->container,
GIMP_OBJECT (delete_data->data));
......
Supports Markdown
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