for load and save errors, use a GtkMessageDialog and make it transient for

2006-08-10  Sven Neumann  <sven@gimp.org>

	* app/tools/gimpimagemaptool.c: for load and save errors, use a
	GtkMessageDialog and make it transient for the tool dialog.

	* app/tools/gimpvectortool.c: use gimp_message().
This commit is contained in:
Sven Neumann 2006-08-10 12:46:01 +00:00 committed by Sven Neumann
parent 056c8f77f5
commit 6f6bb9051d
3 changed files with 52 additions and 10 deletions

View File

@ -1,4 +1,9 @@
2006-08-10 Sven Neumann <neumann@jpk.com> 2006-08-10 Sven Neumann <sven@gimp.org>
* app/tools/gimpimagemaptool.c: for load and save errors, use a
GtkMessageDialog and make it transient for the tool dialog.
* app/tools/gimpvectortool.c: use gimp_message().
2006-08-10 Sven Neumann <sven@gimp.org> 2006-08-10 Sven Neumann <sven@gimp.org>

View File

@ -36,6 +36,7 @@
#include "core/gimpimage-pick-color.h" #include "core/gimpimage-pick-color.h"
#include "core/gimpimagemap.h" #include "core/gimpimagemap.h"
#include "core/gimppickable.h" #include "core/gimppickable.h"
#include "core/gimpprogress.h"
#include "core/gimpprojection.h" #include "core/gimpprojection.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
@ -96,7 +97,9 @@ static void gimp_image_map_tool_save_ext_clicked (GtkWidget *widget,
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool, static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
const gchar *title, const gchar *title,
gboolean save); gboolean save);
static void gimp_image_map_tool_error_dialog (GimpImageMapTool *tool,
const gchar *format,
...) G_GNUC_PRINTF(2,3);
static void gimp_image_map_tool_notify_preview (GObject *config, static void gimp_image_map_tool_notify_preview (GObject *config,
GParamSpec *pspec, GParamSpec *pspec,
GimpImageMapTool *im_tool); GimpImageMapTool *im_tool);
@ -580,11 +583,13 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
if (! file) if (! file)
{ {
g_message (save ? const gchar *format = save ?
_("Could not open '%s' for writing: %s") : _("Could not open '%s' for writing: %s") :
_("Could not open '%s' for reading: %s"), _("Could not open '%s' for reading: %s");
gimp_filename_to_utf8 (filename),
g_strerror (errno)); gimp_image_map_tool_error_dialog (tool, format,
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return; return;
} }
@ -598,8 +603,10 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
} }
else if (! gimp_image_map_tool_settings_load (tool, file, &error)) else if (! gimp_image_map_tool_settings_load (tool, file, &error))
{ {
g_message (_("Error reading '%s': %s"), gimp_image_map_tool_error_dialog (tool,
gimp_filename_to_utf8 (filename), error->message); _("Error reading '%s': %s"),
gimp_filename_to_utf8 (filename),
error->message);
g_error_free (error); g_error_free (error);
} }
@ -776,3 +783,30 @@ gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
gtk_widget_show (tool->settings_dialog); gtk_widget_show (tool->settings_dialog);
} }
static void
gimp_image_map_tool_error_dialog (GimpImageMapTool *tool,
const gchar *format,
...)
{
GtkWidget *dialog;
gchar *text;
va_list args;
va_start (args, format);
text = g_strdup_vprintf (format, args);
va_end (args);
dialog = gtk_message_dialog_new (GTK_WINDOW (tool->shell),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR,
GTK_BUTTONS_OK,
text);
g_free (text);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
gtk_widget_show (dialog);
}

View File

@ -36,6 +36,7 @@
#include "core/gimpimage.h" #include "core/gimpimage.h"
#include "core/gimpimage-undo-push.h" #include "core/gimpimage-undo-push.h"
#include "core/gimplist.h" #include "core/gimplist.h"
#include "core/gimpprogress.h"
#include "core/gimptoolinfo.h" #include "core/gimptoolinfo.h"
#include "core/gimpundo.h" #include "core/gimpundo.h"
#include "core/gimpundostack.h" #include "core/gimpundostack.h"
@ -1891,7 +1892,9 @@ gimp_vector_tool_stroke_vectors (GimpVectorTool *vector_tool,
if (! active_drawable) if (! active_drawable)
{ {
g_message (_("There is no active layer or channel to stroke to")); gimp_message (image->gimp,
GIMP_PROGRESS (GIMP_TOOL (vector_tool)->display),
_("There is no active layer or channel to stroke to"));
return; return;
} }