[gimp] app: general review and cleanup in actions/*-commands.c
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: general review and cleanup in actions/*-commands.c
- Date: Sun, 25 Sep 2016 20:19:08 +0000 (UTC)
commit 9a9899e542685d6b5a76128090643a9cb299d046
Author: Michael Natterer <mitch gimp org>
Date: Sun Sep 25 22:18:37 2016 +0200
app: general review and cleanup in actions/*-commands.c
app/actions/channels-commands.c | 1 -
app/actions/cursor-info-commands.c | 9 ----
app/actions/data-commands.c | 11 ++---
app/actions/dock-commands.c | 2 +
app/actions/dockable-commands.c | 3 +
app/actions/drawable-commands.c | 4 +-
app/actions/error-console-commands.c | 72 +++++++++++++---------------
app/actions/fonts-commands.c | 4 --
app/actions/gradients-commands.c | 87 ++++++++++++++++++----------------
app/actions/image-commands.c | 17 ++++---
app/actions/layers-commands.c | 63 ++++++++++--------------
app/actions/sample-points-commands.c | 7 ---
app/actions/text-editor-commands.c | 59 ++++++++++------------
app/actions/text-tool-commands.c | 76 +++++++++++++----------------
app/actions/vectors-commands.c | 5 +--
app/actions/windows-commands.c | 38 +++++++-------
16 files changed, 208 insertions(+), 250 deletions(-)
---
diff --git a/app/actions/channels-commands.c b/app/actions/channels-commands.c
index 8e2d51d..3fe1551 100644
--- a/app/actions/channels-commands.c
+++ b/app/actions/channels-commands.c
@@ -297,7 +297,6 @@ channels_duplicate_cmd_callback (GtkAction *action,
}
gimp_image_add_channel (image, new_channel, parent, -1, TRUE);
-
gimp_image_flush (image);
}
diff --git a/app/actions/cursor-info-commands.c b/app/actions/cursor-info-commands.c
index 2439a85..6ff2e82 100644
--- a/app/actions/cursor-info-commands.c
+++ b/app/actions/cursor-info-commands.c
@@ -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 */
diff --git a/app/actions/data-commands.c b/app/actions/data-commands.c
index 7fd395a..1bb6e16 100644
--- a/app/actions/data-commands.c
+++ b/app/actions/data-commands.c
@@ -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));
diff --git a/app/actions/dock-commands.c b/app/actions/dock-commands.c
index 0855d7e..d2fcc68 100644
--- a/app/actions/dock-commands.c
+++ b/app/actions/dock-commands.c
@@ -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);
}
}
diff --git a/app/actions/dockable-commands.c b/app/actions/dockable-commands.c
index ef41c09..b8bf69d 100644
--- a/app/actions/dockable-commands.c
+++ b/app/actions/dockable-commands.c
@@ -283,6 +283,9 @@ dockable_show_button_bar_cmd_callback (GtkAction *action,
}
}
+
+/* private functions */
+
static GimpDockable *
dockable_get_current (GimpDockbook *dockbook)
{
diff --git a/app/actions/drawable-commands.c b/app/actions/drawable-commands.c
index 7b3fd79..ba64263 100644
--- a/app/actions/drawable-commands.c
+++ b/app/actions/drawable-commands.c
@@ -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)
diff --git a/app/actions/error-console-commands.c b/app/actions/error-console-commands.c
index 36703cd..a337a59 100644
--- a/app/actions/error-console-commands.c
+++ b/app/actions/error-console-commands.c
@@ -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))
diff --git a/app/actions/fonts-commands.c b/app/actions/fonts-commands.c
index 713327e..0178ff4 100644
--- a/app/actions/fonts-commands.c
+++ b/app/actions/fonts-commands.c
@@ -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 */
diff --git a/app/actions/gradients-commands.c b/app/actions/gradients-commands.c
index 7625ecc..a213897 100644
--- a/app/actions/gradients-commands.c
+++ b/app/actions/gradients-commands.c
@@ -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"),
diff --git a/app/actions/image-commands.c b/app/actions/image-commands.c
index 3ae34fc..06fbb28 100644
--- a/app/actions/image-commands.c
+++ b/app/actions/image-commands.c
@@ -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;
}
}
diff --git a/app/actions/layers-commands.c b/app/actions/layers-commands.c
index 2e14e9a..b146bdf 100644
--- a/app/actions/layers-commands.c
+++ b/app/actions/layers-commands.c
@@ -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;
diff --git a/app/actions/sample-points-commands.c b/app/actions/sample-points-commands.c
index ae41cbc..9205880 100644
--- a/app/actions/sample-points-commands.c
+++ b/app/actions/sample-points-commands.c
@@ -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 */
diff --git a/app/actions/text-editor-commands.c b/app/actions/text-editor-commands.c
index 9bece54..069e0f5 100644
--- a/app/actions/text-editor-commands.c
+++ b/app/actions/text-editor-commands.c
@@ -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
diff --git a/app/actions/text-tool-commands.c b/app/actions/text-tool-commands.c
index 4e74fc6..65956d8 100644
--- a/app/actions/text-tool-commands.c
+++ b/app/actions/text-tool-commands.c
@@ -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);
+ gtk_window_set_role (GTK_WINDOW (dialog), "gimp-text-load-file");
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_MOUSE);
- gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
+ g_signal_connect (dialog, "response",
+ G_CALLBACK (text_tool_load_dialog_response),
+ text_tool);
+ g_signal_connect (dialog, "delete-event",
+ G_CALLBACK (gtk_true),
+ NULL);
- g_signal_connect (chooser, "response",
- G_CALLBACK (text_tool_load_dialog_response),
- text_tool);
- g_signal_connect (chooser, "delete-event",
- G_CALLBACK (gtk_true),
- NULL);
+ dialogs_attach_dialog (G_OBJECT (text_tool),
+ "gimp-text-file-dialog", dialog);
+ }
- gtk_widget_show (GTK_WIDGET (chooser));
+ gtk_window_present (GTK_WINDOW (dialog));
}
void
@@ -205,11 +199,9 @@ text_tool_load_dialog_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_load (tool->buffer, file, &error))
{
gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (dialog),
diff --git a/app/actions/vectors-commands.c b/app/actions/vectors-commands.c
index 411c696..a700a5b 100644
--- a/app/actions/vectors-commands.c
+++ b/app/actions/vectors-commands.c
@@ -210,10 +210,8 @@ vectors_new_last_vals_cmd_callback (GtkAction *action,
config = GIMP_DIALOG_CONFIG (image->gimp->config);
vectors = gimp_vectors_new (image, config->vectors_new_name);
-
gimp_image_add_vectors (image, vectors,
GIMP_IMAGE_ACTIVE_PARENT, -1, TRUE);
-
gimp_image_flush (image);
}
@@ -276,7 +274,6 @@ vectors_duplicate_cmd_callback (GtkAction *action,
new_vectors = GIMP_VECTORS (gimp_item_duplicate (GIMP_ITEM (vectors),
G_TYPE_FROM_INSTANCE (vectors)));
-
/* use the actual parent here, not GIMP_IMAGE_ACTIVE_PARENT because
* the latter would add a duplicated group inside itself instead of
* above it
@@ -284,7 +281,6 @@ vectors_duplicate_cmd_callback (GtkAction *action,
gimp_image_add_vectors (image, new_vectors,
gimp_vectors_get_parent (vectors), -1,
TRUE);
-
gimp_image_flush (image);
}
@@ -777,6 +773,7 @@ vectors_lock_position_cmd_callback (GtkAction *action,
}
}
+
/* private functions */
static void
diff --git a/app/actions/windows-commands.c b/app/actions/windows-commands.c
index 2244910..4a3f88c 100644
--- a/app/actions/windows-commands.c
+++ b/app/actions/windows-commands.c
@@ -53,16 +53,16 @@ void
windows_hide_docks_cmd_callback (GtkAction *action,
gpointer data)
{
- gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
Gimp *gimp;
+ gboolean active;
return_if_no_gimp (gimp, data);
- if (GIMP_GUI_CONFIG (gimp->config)->hide_docks == active)
- return;
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- g_object_set (gimp->config,
- "hide-docks", active,
- NULL);
+ if (active != GIMP_GUI_CONFIG (gimp->config)->hide_docks)
+ g_object_set (gimp->config,
+ "hide-docks", active,
+ NULL);
}
void
@@ -70,32 +70,32 @@ windows_set_tabs_position_cmd_callback (GtkAction *action,
GtkAction *current,
gpointer data)
{
- GimpPosition value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- Gimp *gimp;
+ Gimp *gimp;
+ GimpPosition value;
return_if_no_gimp (gimp, data);
- if (GIMP_GUI_CONFIG (gimp->config)->tabs_position == value)
- return;
+ value = gtk_radio_action_get_current_value (GTK_RADIO_ACTION (action));
- g_object_set (gimp->config,
- "tabs-position", value,
- NULL);
+ if (value != GIMP_GUI_CONFIG (gimp->config)->tabs_position)
+ g_object_set (gimp->config,
+ "tabs-position", value,
+ NULL);
}
void
windows_use_single_window_mode_cmd_callback (GtkAction *action,
gpointer data)
{
- gboolean active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
Gimp *gimp;
+ gboolean active;
return_if_no_gimp (gimp, data);
- if (GIMP_GUI_CONFIG (gimp->config)->single_window_mode == active)
- return;
+ active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
- g_object_set (gimp->config,
- "single-window-mode", active,
- NULL);
+ if (active != GIMP_GUI_CONFIG (gimp->config)->single_window_mode)
+ g_object_set (gimp->config,
+ "single-window-mode", active,
+ NULL);
}
void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]