Commit c2fb4200 authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

introduced a simple message dialog to use when there's no progress but a

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

	* app/widgets/gimpwidgets-utils.[ch]: introduced a simple message
	dialog to use when there's no progress but a parent widget.

	* app/dialogs/convert-dialog.c
	* app/dialogs/palette-import-dialog.c
	* app/dialogs/preferences-dialog.c
	* app/dialogs/stroke-dialog.c
	* app/tools/gimpimagemaptool.c
	* app/widgets/gimpactionview.c
	* app/widgets/gimpcontrollerlist.c
	* app/widgets/gimplayertreeview.c
	* app/widgets/gimppdbdialog.c
	* app/widgets/gimpvectorstreeview.c: use the new utility function
	instead of g_message().
parent a2959ab1
2006-08-11 Sven Neumann <sven@gimp.org>
* app/widgets/gimpwidgets-utils.[ch]: introduced a simple message
dialog to use when there's no progress but a parent widget.
* app/dialogs/convert-dialog.c
* app/dialogs/palette-import-dialog.c
* app/dialogs/preferences-dialog.c
* app/dialogs/stroke-dialog.c
* app/tools/gimpimagemaptool.c
* app/widgets/gimpactionview.c
* app/widgets/gimpcontrollerlist.c
* app/widgets/gimplayertreeview.c
* app/widgets/gimppdbdialog.c
* app/widgets/gimpvectorstreeview.c: use the new utility function
instead of g_message().
2006-08-11 Sven Neumann <sven@gimp.org>
* app/gui/gui-message.c (gui_message_error_dialog): use the global
......
......@@ -392,7 +392,9 @@ convert_dialog_palette_changed (GimpContext *context,
if (palette->n_colors > 256)
{
g_message (_("Cannot convert to a palette with more than 256 colors."));
gimp_show_message_dialog (dialog->dialog, GTK_MESSAGE_WARNING,
_("Cannot convert to a palette "
"with more than 256 colors."));
}
else
{
......
......@@ -42,6 +42,7 @@
#include "widgets/gimpdnd.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpview.h"
#include "widgets/gimpwidgets-utils.h"
#include "palette-import-dialog.h"
......@@ -856,7 +857,8 @@ palette_import_make_palette (ImportDialog *dialog)
if (! palette)
{
g_message (error->message);
gimp_show_message_dialog (dialog->dialog, GTK_MESSAGE_ERROR,
error->message);
g_error_free (error);
}
}
......
......@@ -1273,9 +1273,9 @@ prefs_message (GtkMessageType type,
type, GTK_BUTTONS_OK,
message);
g_signal_connect_swapped (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
dialog);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
......
......@@ -39,6 +39,7 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimpviewabledialog.h"
#include "widgets/gimpstrokeeditor.h"
#include "widgets/gimpwidgets-utils.h"
#include "stroke-dialog.h"
......@@ -276,7 +277,9 @@ stroke_dialog_response (GtkWidget *widget,
if (! drawable)
{
g_message (_("There is no active layer or channel to stroke to."));
gimp_show_message_dialog (widget, GTK_MESSAGE_WARNING,
_("There is no active layer or channel "
"to stroke to."));
return;
}
......
......@@ -97,9 +97,6 @@ static void gimp_image_map_tool_save_ext_clicked (GtkWidget *widget,
static void gimp_image_map_tool_settings_dialog (GimpImageMapTool *im_tool,
const gchar *title,
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,
GParamSpec *pspec,
GimpImageMapTool *im_tool);
......@@ -587,9 +584,10 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
_("Could not open '%s' for writing: %s") :
_("Could not open '%s' for reading: %s");
gimp_image_map_tool_error_dialog (tool, format,
gimp_filename_to_utf8 (filename),
g_strerror (errno));
gimp_show_message_dialog (tool->shell, GTK_MESSAGE_ERROR,
format,
gimp_filename_to_utf8 (filename),
g_strerror (errno));
return;
}
......@@ -603,10 +601,10 @@ gimp_image_map_tool_load_save (GimpImageMapTool *tool,
}
else if (! gimp_image_map_tool_settings_load (tool, file, &error))
{
gimp_image_map_tool_error_dialog (tool,
_("Error reading '%s': %s"),
gimp_filename_to_utf8 (filename),
error->message);
gimp_show_message_dialog (tool->shell, GTK_MESSAGE_ERROR,
_("Error reading '%s': %s"),
gimp_filename_to_utf8 (filename),
error->message);
g_error_free (error);
}
......@@ -783,30 +781,3 @@ gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
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);
}
......@@ -481,7 +481,8 @@ gimp_action_view_conflict_response (GtkWidget *dialog,
confirm_data->accel_mask,
TRUE))
{
g_message (_("Changing shortcut failed."));
gimp_show_message_dialog (dialog, GTK_MESSAGE_ERROR,
_("Changing shortcut failed."));
}
}
......@@ -599,12 +600,14 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel,
{
if (! gtk_accel_map_change_entry (accel_path, 0, 0, FALSE))
{
g_message (_("Removing shortcut failed."));
gimp_show_message_dialog (GTK_WIDGET (view), GTK_MESSAGE_ERROR,
_("Removing shortcut failed."));
}
}
else if (! accel_key)
{
g_message (_("Invalid shortcut."));
gimp_show_message_dialog (GTK_WIDGET (view), GTK_MESSAGE_ERROR,
_("Invalid shortcut."));
}
else if (! gtk_accel_map_change_entry (accel_path,
accel_key, accel_mask, FALSE))
......@@ -663,7 +666,9 @@ gimp_action_view_accel_edited (GimpCellRendererAccel *accel,
}
else
{
g_message (_("Changing shortcut failed."));
gimp_show_message_dialog (GTK_WIDGET (view),
GTK_MESSAGE_ERROR,
_("Changing shortcut failed."));
}
}
}
......
......@@ -505,17 +505,21 @@ gimp_controller_list_add_clicked (GtkWidget *button,
if (list->src_gtype == GIMP_TYPE_CONTROLLER_KEYBOARD &&
gimp_controllers_get_keyboard (list->gimp) != NULL)
{
g_message (_("There can only be one active keyboard controller.\n\n"
"You already have a keyboard controller in your list "
"of active controllers."));
gimp_show_message_dialog (button, GTK_MESSAGE_WARNING,
_("There can only be one active keyboard "
"controller.\n\n"
"You already have a keyboard controller in "
"your list of active controllers."));
return;
}
else if (list->src_gtype == GIMP_TYPE_CONTROLLER_WHEEL &&
gimp_controllers_get_wheel (list->gimp) != NULL)
{
g_message (_("There can only be one active wheel controller.\n\n"
"You already have a wheel controller in your list "
"of active controllers."));
gimp_show_message_dialog (button, GTK_MESSAGE_WARNING,
_("There can only be one active wheel "
"controller.\n\n"
"You already have a wheel controller in "
"your list of active controllers."));
return;
}
......
......@@ -724,8 +724,7 @@ gimp_layer_tree_view_drop_uri_list (GimpContainerTreeView *view,
{
gchar *filename = file_utils_uri_display_name (uri);
g_message (_("Opening '%s' failed:\n\n%s"),
filename, error->message);
g_message (_("Opening '%s' failed:\n\n%s"), filename, error->message);
g_clear_error (&error);
g_free (filename);
......
......@@ -36,6 +36,7 @@
#include "gimpmenufactory.h"
#include "gimppdbdialog.h"
#include "gimpwidgets-utils.h"
#include "gimp-intl.h"
......@@ -338,9 +339,11 @@ gimp_pdb_dialog_run_callback (GimpPdbDialog *dialog,
if (g_value_get_enum (&return_vals->values[0]) != GIMP_PDB_SUCCESS)
{
g_message (_("Unable to run %s callback. "
"The corresponding plug-in may have crashed."),
g_type_name (G_TYPE_FROM_INSTANCE (dialog)));
gimp_show_message_dialog (dialog, GTK_MESSAGE_ERROR,
_("Unable to run %s callback. "
"The corresponding plug-in may have "
"crashed."),
g_type_name (G_TYPE_FROM_INSTANCE (dialog)));
}
g_value_array_free (return_vals);
......
......@@ -235,7 +235,8 @@ gimp_vectors_tree_view_drop_svg (GimpContainerTreeView *tree_view,
if (! gimp_vectors_import_buffer (image, svg_data, svg_data_len,
TRUE, TRUE, index, &error))
{
g_message (error->message);
gimp_show_message_dialog (GTK_WIDGET (tree_view), GTK_MESSAGE_ERROR,
error->message);
g_clear_error (&error);
}
else
......
......@@ -1067,3 +1067,34 @@ gimp_widget_set_accel_help (GtkWidget *widget,
g_free (tooltip);
}
}
void
gimp_show_message_dialog (GtkWidget *parent,
GtkMessageType type,
const gchar *format,
...)
{
GtkWidget *dialog;
gchar *message;
va_list args;
g_return_if_fail (GTK_IS_WIDGET (parent));
g_return_if_fail (format != NULL);
va_start (args, format);
message = g_strdup_vprintf (format, args);
va_end (args);
dialog =
gtk_message_dialog_new (GTK_WINDOW (gtk_widget_get_toplevel (parent)),
GTK_DIALOG_DESTROY_WITH_PARENT,
type, GTK_BUTTONS_OK,
message);
g_free (message);
g_signal_connect (dialog, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
gtk_widget_show (dialog);
}
......@@ -91,5 +91,10 @@ void gimp_toggle_button_set_visible (GtkToggleButton *toggle,
void gimp_widget_set_accel_help (GtkWidget *widget,
GtkAction *action);
void gimp_show_message_dialog (GtkWidget *parent,
GtkMessageType type,
const gchar *format,
...) G_GNUC_PRINTF(3,4);
#endif /* __GIMP_WIDGETS_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