Commit 1c9069c4 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

cleanup.

2001-08-07  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimpbutton.[ch]: cleanup.

	* app/Makefile.am
	* app/errorconsole.[ch]: removed...

	* app/gui/Makefile.am
	* app/gui/error-console-dialog.[ch]: ...added here. Lots of cleanup,
	create a vbox instead of a dialog.

	* app/gui/dialogs-constructors.c
	* app/gui/dialogs.c: added a dockable for the error console.

	* app/errors.c
	* app/gui/gui.c
	* app/gui/menus.c: changed accordingly.

	* app/widgets/gimpcontainerview.c: conntect "extended_clicked" to
	the "extended_clicked" callback, not "clicked".

	* app/widgets/gimplayerlistview.c: set the layer option box'
	spacing in "style_set".

	* app/widgets/gimplistitem.c: argh.

	* themes/Default/gtkrc: changed the default theme to set a smaller
	font only for the dockable because that's where saving screen
	estate really makes sense. May need some further tweaking.
parent 028f5e2d
2001-08-07 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpbutton.[ch]: cleanup.
* app/Makefile.am
* app/errorconsole.[ch]: removed...
* app/gui/Makefile.am
* app/gui/error-console-dialog.[ch]: ...added here. Lots of cleanup,
create a vbox instead of a dialog.
* app/gui/dialogs-constructors.c
* app/gui/dialogs.c: added a dockable for the error console.
* app/errors.c
* app/gui/gui.c
* app/gui/menus.c: changed accordingly.
* app/widgets/gimpcontainerview.c: conntect "extended_clicked" to
the "extended_clicked" callback, not "clicked".
* app/widgets/gimplayerlistview.c: set the layer option box'
spacing in "style_set".
* app/widgets/gimplistitem.c: argh.
* themes/Default/gtkrc: changed the default theme to set a smaller
font only for the dockable because that's where saving screen
estate really makes sense. May need some further tweaking.
2001-08-06 Daniel Egger <egger@suse.de>
* autogen.sh: Fix error message to reflect that one needs
......
......@@ -16,8 +16,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
devices.h \
docindex.c \
docindex.h \
errorconsole.c \
errorconsole.h \
gimpprogress.c \
gimpprogress.h \
nav_window.c \
......
......@@ -57,11 +57,8 @@
#include "color-area.h"
#include "colormap-dialog.h"
#include "dialogs.h"
#include "devices.h"
#include "dialogs-constructors.h"
#include "docindex.h"
#include "errorconsole.h"
#include "gdisplay.h"
#include "error-console-dialog.h"
#include "gradient-editor.h"
#include "gradient-select.h"
#include "gradients-commands.h"
......@@ -79,6 +76,8 @@
#include "toolbox.h"
#include "app_procs.h"
#include "devices.h"
#include "docindex.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "module_db.h"
......@@ -207,13 +206,6 @@ dialogs_palette_select_get (GimpDialogFactory *factory,
return palette_dialog_create ();
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context)
{
return error_console_create ();
}
GtkWidget *
dialogs_document_index_get (GimpDialogFactory *factory,
GimpContext *context)
......@@ -705,9 +697,9 @@ dialogs_path_list_view_new (GimpDialogFactory *factory,
view = paths_dialog_create ();
g_signal_connect (G_OBJECT (view), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&view);
g_object_weak_ref (G_OBJECT (view),
(GDestroyNotify) gtk_widget_destroyed,
&view);
dockable = dialogs_dockable_new (view,
"Path List", "Paths",
......@@ -746,6 +738,34 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
}
/* misc dockables */
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = error_console_create ();
g_object_weak_ref (G_OBJECT (view),
(GDestroyNotify) gtk_widget_destroyed,
&view);
dockable = dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
return dockable;
}
/* editor dialogs */
void
......
......@@ -45,7 +45,6 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:gradient-select-dialog", dialogs_gradient_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:palette-select-dialog", dialogs_palette_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:error-console-dialog", dialogs_error_console_get, TRUE, TRUE, TRUE, TRUE },
{ "gimp:document-index-dialog", dialogs_document_index_get, TRUE, TRUE, TRUE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE, TRUE },
{ "gimp:input-devices-dialog", dialogs_input_devices_get, TRUE, FALSE, FALSE, TRUE },
......@@ -83,7 +82,9 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE, TRUE },
{ "gimp:indexed-palette", dialogs_indexed_palette_new, FALSE, FALSE, FALSE, TRUE }
{ "gimp:indexed-palette", dialogs_indexed_palette_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, TRUE, FALSE, FALSE, TRUE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));
......
......@@ -28,12 +28,15 @@
#include <gtk/gtk.h>
#include "core/core-types.h"
#include "widgets/widgets-types.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "gui/dialogs.h"
#include "gui/error-console-dialog.h"
#include "appenv.h"
#include "errorconsole.h"
#include "errors.h"
#ifdef G_OS_WIN32
......@@ -56,6 +59,8 @@ gimp_message_log_func (const gchar *log_domain,
break;
case ERROR_CONSOLE:
gimp_dialog_factory_dialog_raise (global_dock_factory,
"gimp:error-console");
error_console_add ((gchar *) message);
break;
......
......@@ -36,6 +36,8 @@ libappgui_a_SOURCES = @STRIP_BEGIN@ \
dialogs-constructors.h \
edit-commands.c \
edit-commands.h \
error-console-dialog.c \
error-console-dialog.h \
file-commands.c \
file-commands.h \
file-dialog-utils.c \
......
......@@ -57,11 +57,8 @@
#include "color-area.h"
#include "colormap-dialog.h"
#include "dialogs.h"
#include "devices.h"
#include "dialogs-constructors.h"
#include "docindex.h"
#include "errorconsole.h"
#include "gdisplay.h"
#include "error-console-dialog.h"
#include "gradient-editor.h"
#include "gradient-select.h"
#include "gradients-commands.h"
......@@ -79,6 +76,8 @@
#include "toolbox.h"
#include "app_procs.h"
#include "devices.h"
#include "docindex.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "module_db.h"
......@@ -207,13 +206,6 @@ dialogs_palette_select_get (GimpDialogFactory *factory,
return palette_dialog_create ();
}
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context)
{
return error_console_create ();
}
GtkWidget *
dialogs_document_index_get (GimpDialogFactory *factory,
GimpContext *context)
......@@ -705,9 +697,9 @@ dialogs_path_list_view_new (GimpDialogFactory *factory,
view = paths_dialog_create ();
g_signal_connect (G_OBJECT (view), "destroy",
G_CALLBACK (gtk_widget_destroyed),
&view);
g_object_weak_ref (G_OBJECT (view),
(GDestroyNotify) gtk_widget_destroyed,
&view);
dockable = dialogs_dockable_new (view,
"Path List", "Paths",
......@@ -746,6 +738,34 @@ dialogs_indexed_palette_new (GimpDialogFactory *factory,
}
/* misc dockables */
GtkWidget *
dialogs_error_console_get (GimpDialogFactory *factory,
GimpContext *context)
{
static GtkWidget *view = NULL;
GtkWidget *dockable;
if (view)
return NULL;
view = error_console_create ();
g_object_weak_ref (G_OBJECT (view),
(GDestroyNotify) gtk_widget_destroyed,
&view);
dockable = dialogs_dockable_new (view,
"Error Console", "Errors",
NULL,
NULL);
return dockable;
}
/* editor dialogs */
void
......
......@@ -45,7 +45,6 @@ static const GimpDialogFactoryEntry toplevel_entries[] =
{ "gimp:pattern-select-dialog", dialogs_pattern_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:gradient-select-dialog", dialogs_gradient_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:palette-select-dialog", dialogs_palette_select_get, TRUE, TRUE, FALSE, TRUE },
{ "gimp:error-console-dialog", dialogs_error_console_get, TRUE, TRUE, TRUE, TRUE },
{ "gimp:document-index-dialog", dialogs_document_index_get, TRUE, TRUE, TRUE, TRUE },
{ "gimp:preferences-dialog", dialogs_preferences_get, TRUE, FALSE, FALSE, TRUE },
{ "gimp:input-devices-dialog", dialogs_input_devices_get, TRUE, FALSE, FALSE, TRUE },
......@@ -83,7 +82,9 @@ static const GimpDialogFactoryEntry dock_entries[] =
{ "gimp:layer-list", dialogs_layer_list_view_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:channel-list", dialogs_channel_list_view_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:path-list", dialogs_path_list_view_new, TRUE, FALSE, FALSE, TRUE },
{ "gimp:indexed-palette", dialogs_indexed_palette_new, FALSE, FALSE, FALSE, TRUE }
{ "gimp:indexed-palette", dialogs_indexed_palette_new, FALSE, FALSE, FALSE, TRUE },
{ "gimp:error-console", dialogs_error_console_get, TRUE, FALSE, FALSE, TRUE }
};
static const gint n_dock_entries = (sizeof (dock_entries) /
sizeof (dock_entries[0]));
......
......@@ -58,186 +58,169 @@
#include "libgimp/gimpintl.h"
enum
typedef enum
{
ERRORS_ALL,
ERRORS_SELECTION
};
} ErrorScope;
static GtkWidget *error_console = NULL;
static GtkWidget *text_view = NULL;
static GtkTextBuffer *text_buffer = NULL;
/* local function prototypes */
static void error_console_destroy_callback (gpointer data);
static gboolean text_clicked_callback (GtkWidget *widget,
GdkEventButton *event,
GtkMenu *menu);
static void error_console_clear_callback (GtkWidget *widget,
GtkTextBuffer *buffer);
static void error_console_write_all_callback (GtkWidget *widget,
GtkTextBuffer *buffer);
static void error_console_write_selection_callback (GtkWidget *widget,
GtkTextBuffer *buffer);
static void
error_console_close_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (error_console);
static void error_console_create_file_dialog (GtkTextBuffer *buffer,
ErrorScope textscope);
static void error_console_file_ok_callback (GtkWidget *widget,
gpointer data);
static gboolean error_console_write_file (GtkTextBuffer *text_buffer,
const gchar *path,
ErrorScope textscope);
/* FIXME: interact with preferences */
message_handler = MESSAGE_BOX;
}
static void
error_console_clear_callback (GtkWidget *widget,
gpointer data)
{
GtkTextBuffer *buffer;
GtkTextIter start_iter;
GtkTextIter end_iter;
/* private variables */
buffer = (GtkTextBuffer *) data;
static GtkWidget *error_console = NULL;
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
}
/* public functions */
GtkWidget *
error_console_create (void)
{
GtkTextBuffer *text_buffer;
GtkWidget *text_view;
GtkWidget *scrolled_window;
GtkWidget *menu;
GtkWidget *menuitem;
void
error_console_free (void)
{
if (error_console)
{
gtk_widget_destroy (error_console);
error_console = NULL;
}
}
return error_console;
static gboolean
error_console_write_file (const gchar *path,
gint textscope)
{
GtkTextIter start_iter;
GtkTextIter end_iter;
gint fd;
gint text_length;
gint bytes_written;
gchar *text_contents;
text_buffer = gtk_text_buffer_new (NULL);
fd = open (path, O_WRONLY | O_CREAT | O_APPEND, S_IRUSR | S_IWUSR);
if (fd == -1)
return FALSE;
error_console = gtk_vbox_new (FALSE, 0);
if (textscope == ERRORS_ALL)
{
gtk_text_buffer_get_bounds (text_buffer, &start_iter, &end_iter);
}
else
{
gtk_text_buffer_get_selection_bounds (text_buffer, &start_iter, &end_iter);
}
g_object_set_data (G_OBJECT (error_console), "text-buffer", text_buffer);
text_contents = gtk_text_buffer_get_text (text_buffer,
&start_iter, &end_iter, TRUE);
g_object_weak_ref (G_OBJECT (error_console), error_console_destroy_callback,
NULL);
text_length = strlen (text_contents);
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_add (GTK_CONTAINER (error_console), scrolled_window);
gtk_widget_show (scrolled_window);
if (text_contents && (text_length > 0))
{
bytes_written = write (fd, text_contents, text_length);
g_free (text_contents);
close (fd);
if (bytes_written != text_length)
return FALSE;
else
return TRUE;
}
menu = gtk_menu_new ();
close (fd);
menuitem = gtk_menu_item_new_with_label (_("Clear Console"));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
return TRUE;
}
g_signal_connect (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_clear_callback),
text_buffer);
static void
error_console_file_ok_callback (GtkWidget *widget,
gpointer data)
{
GtkWidget *filesel;
const gchar *filename;
gint textscope;
menuitem = gtk_menu_item_new ();
gtk_widget_set_sensitive (menuitem, FALSE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
filesel = (GtkWidget *) data;
filename = gtk_file_selection_get_filename (GTK_FILE_SELECTION (filesel));
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
textscope = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (filesel),
"text-scope"));
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
if (! error_console_write_file (filename, textscope))
{
gchar *message;
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_all_callback),
text_buffer);
menuitem = gtk_menu_item_new_with_label (_("Write selection to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
message = g_strdup_printf (_("Error opening file %s: %s"),
filename, g_strerror (errno));
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_write_selection_callback),
text_buffer);
g_message (message);
/* The output text widget */
text_view = gtk_text_view_new_with_buffer (text_buffer);
g_object_unref (G_OBJECT (text_buffer));
g_free (message);
}
else
{
gtk_widget_destroy (filesel);
}
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
gtk_widget_show (text_view);
g_signal_connect (G_OBJECT (text_view), "button_press_event",
G_CALLBACK (text_clicked_callback),
menu);
/* FIXME: interact with preferences */
message_handler = ERROR_CONSOLE;
return error_console;
}
static void
error_console_menu_callback (gint textscope)
void
error_console_add (const gchar *errormsg)
{
GtkWidget *filesel;
if (! gtk_text_buffer_get_selection_bounds (text_buffer, NULL, NULL) &&
textscope == ERRORS_SELECTION)
if (! error_console)
{
g_message (_("Can't save, nothing selected!"));
g_warning ("error_console_add(): error_console widget is NULL");
message_handler = MESSAGE_BOX;
g_message (errormsg);
return;
}
filesel = gtk_file_selection_new (_("Save error log to file..."));
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_window_set_wmclass (GTK_WINDOW (filesel), "save_errors", "Gimp");
if (errormsg)
{
GtkTextBuffer *buffer;
GtkTextIter end;
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
gtk_container_set_border_width (GTK_CONTAINER (GTK_FILE_SELECTION (filesel)->button_area), 2);
buffer = g_object_get_data (G_OBJECT (error_console), "text-buffer");
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button),
"clicked",
G_CALLBACK (gtk_widget_destroy),
filesel);
gtk_text_buffer_get_end_iter (buffer, &end);
gtk_text_buffer_place_cursor (buffer, &end);
g_object_set_data (G_OBJECT (filesel), "text-scope",
GINT_TO_POINTER (textscope));
g_signal_connect (G_OBJECT (GTK_FILE_SELECTION (filesel)->ok_button),
"clicked",
G_CALLBACK (error_console_file_ok_callback),
filesel);
gtk_text_buffer_insert_at_cursor (buffer, errormsg, -1);
gtk_text_buffer_insert_at_cursor (buffer, "\n", -1);
}
}
g_signal_connect_swapped (G_OBJECT (GTK_FILE_SELECTION (filesel)->cancel_button),
"delete_event",
G_CALLBACK (gtk_widget_destroy),
filesel);
/* Connect the "F1" help key */
gimp_help_connect (filesel,
gimp_standard_help_func,
"dialogs/error_console.html");
/* private functions */
gtk_widget_show (filesel);
static void
error_console_destroy_callback (gpointer data)
{
error_console = NULL;
/* FIXME: interact with preferences */
message_handler = MESSAGE_BOX;
}
static gboolean
text_clicked_callback (GtkWidget *widget,
GdkEventButton *event,
gpointer data)
GtkMenu *menu)
{
GtkMenu *menu = (GtkMenu *) data;
menu = (GtkMenu *) data;
switch (event->button)
{
case 1:
......@@ -251,7 +234,7 @@ text_clicked_callback (GtkWidget *widget,
/* wheelmouse support */
case 4:
{
GtkAdjustment *adj = GTK_TEXT_VIEW (text_view)->vadjustment;
GtkAdjustment *adj = GTK_TEXT_VIEW (widget)->vadjustment;
gdouble new_value = adj->value - adj->page_increment / 2;
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
......@@ -260,7 +243,7 @@ text_clicked_callback (GtkWidget *widget,
case 5:
{
GtkAdjustment *adj = GTK_TEXT_VIEW (text_view)->vadjustment;
GtkAdjustment *adj = GTK_TEXT_VIEW (widget)->vadjustment;
gdouble new_value = adj->value + adj->page_increment / 2;
new_value = CLAMP (new_value, adj->lower, adj->upper - adj->page_size);
gtk_adjustment_set_value (adj, new_value);
......@@ -274,110 +257,155 @@ text_clicked_callback (GtkWidget *widget,
return TRUE;
}
GtkWidget *
error_console_create (void)
static void
error_console_clear_callback (GtkWidget *widget,
GtkTextBuffer *buffer)
{
GtkWidget *scrolled_window;
GtkWidget *menu;
GtkWidget *menuitem;
GtkTextIter start_iter;
GtkTextIter end_iter;
if (error_console)
return error_console;
gtk_text_buffer_get_start_iter (buffer, &start_iter);
gtk_text_buffer_get_end_iter (buffer, &end_iter);
text_buffer = gtk_text_buffer_new (NULL);
gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
}
error_console = gimp_dialog_new (_("GIMP Error Console"), "error_console",
gimp_standard_help_func,
"dialogs/error_console.html",
GTK_WIN_POS_NONE,
TRUE, TRUE, FALSE,
static void
error_console_write_all_callback (GtkWidget *widget,
GtkTextBuffer *buffer)
{
error_console_create_file_dialog (buffer, ERRORS_ALL);
}
GTK_STOCK_CLEAR, error_console_clear_callback,
text_buffer, NULL, NULL, FALSE, FALSE,
GTK_STOCK_CLOSE, error_console_close_callback,
text_buffer, NULL, NULL, TRUE, TRUE,
static void
error_console_write_selection_callback (GtkWidget *widget,
GtkTextBuffer *buffer)
{
error_console_create_file_dialog (buffer, ERRORS_SELECTION);
}
NULL);
static void
error_console_create_file_dialog (GtkTextBuffer *buffer,
ErrorScope textscope)
{
GtkFileSelection *filesel;
/* The next line should disappear when setting the size works in SM */
gtk_widget_set_usize (error_console, 250, 300);
if (! gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL) &&
textscope == ERRORS_SELECTION)
{
g_message (_("Can't save, nothing selected!"));
return;
}
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
GTK_POLICY_AUTOMATIC,
GTK_POLICY_AUTOMATIC);
gtk_container_set_border_width (GTK_CONTAINER (scrolled_window), 4);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (error_console)->vbox),
scrolled_window);
gtk_widget_show (scrolled_window);
filesel =
GTK_FILE_SELECTION (gtk_file_selection_new (_("Save error log to file...")));
menu = gtk_menu_new ();
g_object_set_data (G_OBJECT (filesel), "text-buffer",
buffer);
g_object_set_data (G_OBJECT (filesel), "text-scope",
GINT_TO_POINTER (textscope));
menuitem = gtk_menu_item_new_with_label (_("Write all errors to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_window_set_wmclass (GTK_WINDOW (filesel), "save_errors", "Gimp");
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_menu_callback),
GINT_TO_POINTER (ERRORS_ALL));
menuitem = gtk_menu_item_new_with_label (_("Write selection to file..."));
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
gtk_widget_show (menuitem);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
gtk_container_set_border_width (GTK_CONTAINER (filesel->button_area), 2);
g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
G_CALLBACK (error_console_menu_callback),
GINT_TO_POINTER (ERRORS_SELECTION));
g_signal_connect_swapped (G_OBJECT (filesel->cancel_button), "clicked",
G_CALLBACK (gtk_widget_destroy),
filesel);
/* The output text widget */
text_view = gtk_text_view_new_with_buffer (text_buffer);
g_object_unref (G_OBJECT (text_buffer));
g_signal_connect_swapped (G_OBJECT (filesel), "delete_event",
G_CALLBACK (gtk_widget_destroy),
filesel);
gtk_text_view_set_editable (GTK_TEXT_VIEW (text_view), FALSE);
gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text_view), GTK_WRAP_WORD);
gtk_container_add (GTK_CONTAINER (scrolled_window), text_view);
gtk_widget_show (text_view);
g_signal_connect (G_OBJECT (filesel->ok_button), "clicked",
G_CALLBACK (error_console_file_ok_callback),
filesel);
g_signal_connect (G_OBJECT (text_view), "button_press_event",
G_CALLBACK (text_clicked_callback),
GTK_MENU (menu));
/* Connect the "F1" help key */
gimp_help_connect (GTK_WIDGET (filesel),
gimp_standard_help_func,
"dialogs/error_console.html");
gtk_widget_show (error_console);
gtk_widget_show (GTK_WIDGET (filesel));
}