Commit 9a9899e5 authored by Michael Natterer's avatar Michael Natterer 😴

app: general review and cleanup in actions/*-commands.c

parent c01a2513
......@@ -297,7 +297,6 @@ channels_duplicate_cmd_callback (GtkAction *action,
}
gimp_image_add_channel (image, new_channel, parent, -1, TRUE);
gimp_image_flush (image);
}
......
......@@ -17,23 +17,14 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
#include "display/gimpcursorview.h"
#include "cursor-info-commands.h"
#include "gimp-intl.h"
/* public functions */
......
......@@ -71,7 +71,7 @@ data_open_as_image_cmd_callback (GtkAction *action,
if (data && gimp_data_get_file (data))
{
GFile *file = gimp_data_get_file (data);
GFile *file = gimp_data_get_file (data);
GtkWidget *widget = GTK_WIDGET (view);
GimpImage *image;
GimpPDBStatusType status;
......@@ -138,8 +138,7 @@ data_duplicate_cmd_callback (GtkAction *action,
gimp_context_get_by_type (context,
gimp_data_factory_view_get_children_type (view));
if (data && gimp_data_factory_view_have (view,
GIMP_OBJECT (data)))
if (data && gimp_data_factory_view_have (view, GIMP_OBJECT (data)))
{
GimpData *new_data;
......@@ -235,8 +234,7 @@ data_delete_cmd_callback (GtkAction *action,
if (data &&
gimp_data_is_deletable (data) &&
gimp_data_factory_view_have (view,
GIMP_OBJECT (data)))
gimp_data_factory_view_have (view, GIMP_OBJECT (data)))
{
GimpDataFactory *factory;
GtkWidget *dialog;
......@@ -278,8 +276,7 @@ data_edit_cmd_callback (GtkAction *action,
gimp_context_get_by_type (context,
gimp_data_factory_view_get_children_type (view));
if (data && gimp_data_factory_view_have (view,
GIMP_OBJECT (data)))
if (data && gimp_data_factory_view_have (view, GIMP_OBJECT (data)))
{
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (view));
gint monitor = gimp_widget_get_monitor (GTK_WIDGET (view));
......
......@@ -59,6 +59,7 @@ dock_toggle_image_menu_cmd_callback (GtkAction *action,
if (dock_window)
{
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gimp_dock_window_set_show_image_menu (dock_window, active);
}
}
......@@ -76,6 +77,7 @@ dock_toggle_auto_cmd_callback (GtkAction *action,
if (dock_window)
{
gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
gimp_dock_window_set_auto_follow_active (dock_window, active);
}
}
......@@ -283,6 +283,9 @@ dockable_show_button_bar_cmd_callback (GtkAction *action,
}
}
/* private functions */
static GimpDockable *
dockable_get_current (GimpDockbook *dockbook)
{
......
......@@ -107,7 +107,8 @@ drawable_levels_stretch_cmd_callback (GtkAction *action,
{
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("White Balance operates only on RGB color layers."));
_("White Balance operates only on RGB color "
"layers."));
return;
}
......@@ -206,7 +207,6 @@ drawable_offset_cmd_callback (GtkAction *action,
gtk_window_present (GTK_WINDOW (dialog));
}
void
drawable_linked_cmd_callback (GtkAction *action,
gpointer data)
......
......@@ -75,7 +75,6 @@ error_console_save_cmd_callback (GtkAction *action,
gpointer data)
{
GimpErrorConsole *console = GIMP_ERROR_CONSOLE (data);
GtkFileChooser *chooser;
if (value && ! gtk_text_buffer_get_selection_bounds (console->text_buffer,
NULL, NULL))
......@@ -86,53 +85,50 @@ error_console_save_cmd_callback (GtkAction *action,
return;
}
if (console->file_dialog)
if (! console->file_dialog)
{
gtk_window_present (GTK_WINDOW (console->file_dialog));
return;
}
console->file_dialog =
gtk_file_chooser_dialog_new (_("Save Error Log to File"), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
GtkWidget *dialog;
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
dialog = console->file_dialog =
gtk_file_chooser_dialog_new (_("Save Error Log to File"), NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
NULL);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
gtk_dialog_set_alternative_button_order (GTK_DIALOG (console->file_dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
NULL);
console->save_selection = value;
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_object_add_weak_pointer (G_OBJECT (console->file_dialog),
(gpointer) &console->file_dialog);
console->save_selection = value;
chooser = GTK_FILE_CHOOSER (console->file_dialog);
g_object_add_weak_pointer (G_OBJECT (dialog),
(gpointer) &console->file_dialog);
gtk_window_set_screen (GTK_WINDOW (chooser),
gtk_widget_get_screen (GTK_WIDGET (console)));
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_widget_get_screen (GTK_WIDGET (console)));
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_window_set_role (GTK_WINDOW (dialog), "gimp-save-errors");
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-save-errors");
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
g_signal_connect (dialog, "response",
G_CALLBACK (error_console_save_response),
console);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (chooser, "response",
G_CALLBACK (error_console_save_response),
console);
g_signal_connect (chooser, "delete-event",
G_CALLBACK (gtk_true),
NULL);
gimp_help_connect (GTK_WIDGET (chooser), gimp_standard_help_func,
GIMP_HELP_ERRORS_DIALOG, NULL);
gimp_help_connect (dialog, gimp_standard_help_func,
GIMP_HELP_ERRORS_DIALOG, NULL);
}
gtk_widget_show (GTK_WIDGET (chooser));
gtk_window_present (GTK_WINDOW (console->file_dialog));
}
......@@ -145,11 +141,9 @@ error_console_save_response (GtkWidget *dialog,
{
if (response_id == GTK_RESPONSE_OK)
{
GFile *file;
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
GError *error = NULL;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
if (! gimp_text_buffer_save (GIMP_TEXT_BUFFER (console->text_buffer),
file,
console->save_selection, &error))
......
......@@ -26,13 +26,9 @@
#include "text/gimp-fonts.h"
#include "widgets/gimpfontview.h"
#include "actions.h"
#include "fonts-commands.h"
#include "gimp-intl.h"
/* public functionss */
......
......@@ -32,6 +32,8 @@
#include "widgets/gimpcontainerview.h"
#include "widgets/gimphelp-ids.h"
#include "dialogs/dialogs.h"
#include "gradients-commands.h"
#include "gimp-intl.h"
......@@ -53,64 +55,69 @@ gradients_save_as_pov_ray_cmd_callback (GtkAction *action,
GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (data);
GimpContext *context;
GimpGradient *gradient;
GtkFileChooser *chooser;
gchar *title;
context = gimp_container_view_get_context (editor->view);
GtkWidget *dialog;
context = gimp_container_view_get_context (editor->view);
gradient = gimp_context_get_gradient (context);
if (! gradient)
return;
title = g_strdup_printf (_("Save '%s' as POV-Ray"),
gimp_object_get_name (gradient));
#define SAVE_AS_POV_DIALOG_KEY "gimp-save-as-pov-ray-dialog"
dialog = dialogs_get_dialog (G_OBJECT (gradient), SAVE_AS_POV_DIALOG_KEY);
chooser = GTK_FILE_CHOOSER
(gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
if (! dialog)
{
gchar *title = g_strdup_printf (_("Save '%s' as POV-Ray"),
gimp_object_get_name (gradient));
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
dialog = gtk_file_chooser_dialog_new (title, NULL,
GTK_FILE_CHOOSER_ACTION_SAVE,
NULL));
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_SAVE, GTK_RESPONSE_OK,
gtk_dialog_set_alternative_button_order (GTK_DIALOG (chooser),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
NULL);
g_object_set_data (G_OBJECT (chooser), "gimp", context->gimp);
g_free (title);
g_free (title);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_window_set_screen (GTK_WINDOW (chooser),
gtk_widget_get_screen (GTK_WIDGET (editor)));
g_object_set_data (G_OBJECT (dialog), "gimp", context->gimp);
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-gradient-save-pov");
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
gtk_window_set_screen (GTK_WINDOW (dialog),
gtk_widget_get_screen (GTK_WIDGET (editor)));
gtk_window_set_role (GTK_WINDOW (dialog), "gimp-gradient-save-pov");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
g_signal_connect (chooser, "response",
G_CALLBACK (gradients_save_as_pov_ray_response),
gradient);
g_signal_connect (chooser, "delete-event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (gradients_save_as_pov_ray_response),
gradient);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_true),
NULL);
g_object_ref (gradient);
g_signal_connect_object (dialog, "destroy",
G_CALLBACK (g_object_unref),
g_object_ref (gradient),
G_CONNECT_SWAPPED);
g_signal_connect_object (chooser, "destroy",
G_CALLBACK (g_object_unref),
gradient,
G_CONNECT_SWAPPED);
gimp_help_connect (dialog, gimp_standard_help_func,
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL);
gimp_help_connect (GTK_WIDGET (chooser), gimp_standard_help_func,
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL);
dialogs_attach_dialog (G_OBJECT (gradient),
SAVE_AS_POV_DIALOG_KEY, dialog);
}
gtk_widget_show (GTK_WIDGET (chooser));
gtk_window_present (GTK_WINDOW (dialog));
}
......@@ -123,11 +130,9 @@ gradients_save_as_pov_ray_response (GtkWidget *dialog,
{
if (response_id == GTK_RESPONSE_OK)
{
GFile *file;
GFile *file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
GError *error = NULL;
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
if (! gimp_gradient_save_pov (gradient, file, &error))
{
gimp_message_literal (g_object_get_data (G_OBJECT (dialog), "gimp"),
......
......@@ -244,8 +244,8 @@ image_convert_base_type_cmd_callback (GtkAction *action,
gtk_window_present (GTK_WINDOW (dialog));
}
/* always flush, also when only the indexed dialog was shown, so the
* menu items get updated back to the current image type
/* always flush, also when only the indexed dialog was shown, so
* the menu items get updated back to the current image type
*/
gimp_image_flush (image);
}
......@@ -698,21 +698,23 @@ image_crop_to_selection_cmd_callback (GtkAction *action,
{
GimpImage *image;
GtkWidget *widget;
gint x, y, w, h;
gint x, y;
gint width, height;
return_if_no_image (image, data);
return_if_no_widget (widget, data);
if (! gimp_item_bounds (GIMP_ITEM (gimp_image_get_mask (image)),
&x, &y, &w, &h))
&x, &y, &width, &height))
{
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_WARNING,
_("Cannot crop because the current selection is empty."));
_("Cannot crop because the current selection "
"is empty."));
return;
}
gimp_image_crop (image, action_data_get_context (data),
x, y, w, h, TRUE);
x, y, width, height, TRUE);
gimp_image_flush (image);
}
......@@ -747,7 +749,8 @@ image_crop_to_content_cmd_callback (GtkAction *action,
case GIMP_AUTO_SHRINK_UNSHRINKABLE:
gimp_message_literal (image->gimp,
G_OBJECT (widget), GIMP_MESSAGE_INFO,
_("Cannot crop because the image is already cropped to its content."));
_("Cannot crop because the image is already "
"cropped to its content."));
break;
}
}
......
......@@ -138,7 +138,7 @@ static void layers_add_mask_callback (GtkWidget *dialog,
GimpChannel *channel,
gboolean invert,
gpointer user_data);
static void layers_scale_layer_callback (GtkWidget *dialog,
static void layers_scale_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
......@@ -148,7 +148,7 @@ static void layers_scale_layer_callback (GtkWidget *dialog,
gdouble yresolution,
GimpUnit resolution_unit,
gpointer user_data);
static void layers_resize_layer_callback (GtkWidget *dialog,
static void layers_resize_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
......@@ -395,9 +395,7 @@ layers_new_from_visible_cmd_callback (GtkAction *action,
GIMP_NORMAL_MODE,
profile);
gimp_image_add_layer (image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
......@@ -411,9 +409,7 @@ layers_new_group_cmd_callback (GtkAction *action,
layer = gimp_group_layer_new (image);
gimp_image_add_layer (image, layer,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_add_layer (image, layer, GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
......@@ -513,7 +509,6 @@ layers_duplicate_cmd_callback (GtkAction *action,
gimp_image_add_layer (image, new_layer,
gimp_layer_get_parent (layer), -1,
TRUE);
gimp_image_flush (image);
}
......@@ -601,7 +596,6 @@ layers_text_to_vectors_cmd_callback (GtkAction *action,
gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
}
......@@ -629,7 +623,6 @@ layers_text_along_vectors_cmd_callback (GtkAction *action,
gimp_image_add_vectors (image, new_vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
gimp_image_flush (image);
}
}
......@@ -667,7 +660,7 @@ layers_resize_cmd_callback (GtkAction *action,
gimp_standard_help_func,
GIMP_HELP_LAYER_RESIZE,
layer_resize_unit,
layers_resize_layer_callback,
layers_resize_callback,
NULL);
dialogs_attach_dialog (G_OBJECT (layer), RESIZE_DIALOG_KEY, dialog);
......@@ -723,7 +716,7 @@ layers_scale_cmd_callback (GtkAction *action,
gimp_standard_help_func, GIMP_HELP_LAYER_SCALE,
layer_scale_unit,
layer_scale_interp,
layers_scale_layer_callback,
layers_scale_callback,
display);
dialogs_attach_dialog (G_OBJECT (layer), SCALE_DIALOG_KEY, dialog);
......@@ -765,7 +758,6 @@ layers_crop_to_selection_cmd_callback (GtkAction *action,
width, height, off_x, off_y);
gimp_image_undo_group_end (image);
gimp_image_flush (image);
}
......@@ -890,7 +882,6 @@ layers_mask_add_last_vals_cmd_callback (GtkAction *action,
gimp_channel_invert (GIMP_CHANNEL (mask), FALSE);
gimp_layer_add_mask (layer, mask, TRUE, NULL);
gimp_image_flush (image);
}
......@@ -1242,16 +1233,16 @@ layers_add_mask_callback (GtkWidget *dialog,
}
static void
layers_scale_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution, /* unused */
gdouble yresolution, /* unused */
GimpUnit resolution_unit,/* unused */
gpointer user_data)
layers_scale_callback (GtkWidget *dialog,
GimpViewable *viewable,
gint width,
gint height,
GimpUnit unit,
GimpInterpolationType interpolation,
gdouble xresolution, /* unused */
gdouble yresolution, /* unused */
GimpUnit resolution_unit,/* unused */
gpointer user_data)
{
GimpDisplay *display = GIMP_DISPLAY (user_data);
......@@ -1302,17 +1293,17 @@ layers_scale_layer_callback (GtkWidget *dialog,
}
static void
layers_resize_layer_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
GimpItemSet unused,
gboolean unused2,
gpointer user_data)
layers_resize_callback (GtkWidget *dialog,
GimpViewable *viewable,
GimpContext *context,
gint width,
gint height,
GimpUnit unit,
gint offset_x,
gint offset_y,
GimpItemSet unused,
gboolean unused2,
gpointer user_data)
{
layer_resize_unit = unit;
......
......@@ -17,21 +17,14 @@
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpbase/gimpbase.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpsamplepointeditor.h"
#include "sample-points-commands.h"
#include "gimp-intl.h"
/* public functions */
......
......@@ -51,48 +51,43 @@ text_editor_load_cmd_callback (GtkAction *action,
gpointer data)
{
GimpTextEditor *editor = GIMP_TEXT_EDITOR (data);
GtkFileChooser *chooser;
if (editor->file_dialog)
if (! editor->file_dialog)
{
gtk_window_present (GTK_WINDOW (editor->file_dialog));
return;
}
editor->file_dialog =
gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
GTK_WINDOW (editor),
GTK_FILE_CHOOSER_ACTION_OPEN,
GtkWidget *dialog;
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
dialog = editor->file_dialog =
gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
GTK_WINDOW (editor),
GTK_FILE_CHOOSER_ACTION_OPEN,
NULL);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
chooser = GTK_FILE_CHOOSER (editor->file_dialog);
NULL);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (editor->file_dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
g_object_add_weak_pointer (G_OBJECT (chooser),
(gpointer) &editor->file_dialog);
gtk_window_set_role (GTK_WINDOW (dialog), "gimp-text-load-file");
gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-text-load-file");
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
g_object_add_weak_pointer (G_OBJECT (dialog),
(gpointer) &editor->file_dialog);
gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
g_signal_connect (chooser, "response",
G_CALLBACK (text_editor_load_response),
editor);
g_signal_connect (chooser, "delete-event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (dialog, "response",
G_CALLBACK (text_editor_load_response),
editor);
g_signal_connect (dialog, "delete-event",
G_CALLBACK (gtk_true),
NULL);
}
gtk_widget_show (GTK_WIDGET (chooser));
gtk_window_present (GTK_WINDOW (editor->file_dialog));
}
void
......
......@@ -93,60 +93,54 @@ void
text_tool_load_cmd_callback (GtkAction *action,
gpointer data)
{
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
GtkWidget *dialog;
GtkWidget *parent = NULL;
GtkFileChooser *chooser;
GimpTextTool *text_tool = GIMP_TEXT_TOOL (data);
GtkWidget *dialog;
dialog = dialogs_get_dialog (G_OBJECT (text_tool), "gimp-text-file-dialog");
if (dialog)
if (! dialog)
{
gtk_window_present (GTK_WINDOW (dialog));
return;
}
if (GIMP_TOOL (text_tool)->display)
{
GimpDisplayShell *shell;
shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
GtkWidget *parent = NULL;
parent = gtk_widget_get_toplevel (GTK_WIDGET (shell));
}
if (GIMP_TOOL (text_tool)->display)
{
GimpDisplayShell *shell;
dialog = gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
parent ? GTK_WINDOW (parent) : NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
shell = gimp_display_get_shell (GIMP_TOOL (text_tool)->display);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
parent = gtk_widget_get_toplevel (GTK_WIDGET (shell));
}
NULL);
dialog = gtk_file_chooser_dialog_new (_("Open Text File (UTF-8)"),
parent ? GTK_WINDOW (parent) : NULL,
GTK_FILE_CHOOSER_ACTION_OPEN,
chooser = GTK_FILE_CHOOSER (dialog);
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_OK,
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
NULL);
dialogs_attach_dialog (G_OBJECT (text_tool),
"gimp-text-file-dialog", dialog);
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
GTK_RESPONSE_OK,
GTK_RESPONSE_CANCEL,
-1);
gtk_window_set_role (GTK_WINDOW (chooser), "gimp-text-load-file");
gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);