gimp r25718 - in trunk: . app/tools



Author: mitch
Date: Tue May 20 14:17:13 2008
New Revision: 25718
URL: http://svn.gnome.org/viewvc/gimp?rev=25718&view=rev

Log:
2008-05-20  Michael Natterer  <mitch gimp org>

	* app/tools/Makefile.am
	* app/tools/gimpimagemaptool-settings.[ch]: new files containing
	all the recent settings and settings load/save GUI and code.  Got
	rid of shortcut loading/saving using shift+click. Added default
	implementations of ::settings_load() and ::settings_save().
	The GUI is currently horrible, work in progress!

	* app/tools/gimpimagemaptool.c: removed the settings code here.

	* app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c: don't
	pack the load and save buttons, this is done generically for all
	tools now.

	* app/tools/gimpbrightnesscontrasttool.c
	* app/tools/gimpcolorbalancetool.c
	* app/tools/gimpcolorizetool.c
	* app/tools/gimphuesaturationtool.c
	* app/tools/gimpposterizetool.c
	* app/tools/gimpthresholdtool.c: set the load/save related members
	of GimpImageMapToolClass.



Added:
   trunk/app/tools/gimpimagemaptool-settings.c
   trunk/app/tools/gimpimagemaptool-settings.h
Modified:
   trunk/ChangeLog
   trunk/app/tools/Makefile.am
   trunk/app/tools/gimpbrightnesscontrasttool.c
   trunk/app/tools/gimpcolorbalancetool.c
   trunk/app/tools/gimpcolorizetool.c
   trunk/app/tools/gimpcurvestool.c
   trunk/app/tools/gimphuesaturationtool.c
   trunk/app/tools/gimpimagemaptool.c
   trunk/app/tools/gimplevelstool.c
   trunk/app/tools/gimpposterizetool.c
   trunk/app/tools/gimpthresholdtool.c

Modified: trunk/app/tools/Makefile.am
==============================================================================
--- trunk/app/tools/Makefile.am	(original)
+++ trunk/app/tools/Makefile.am	Tue May 20 14:17:13 2008
@@ -90,6 +90,8 @@
 	gimpimagemapoptions.h		\
 	gimpimagemaptool.c		\
 	gimpimagemaptool.h		\
+	gimpimagemaptool-settings.c	\
+	gimpimagemaptool-settings.h	\
 	gimpinkoptions-gui.c		\
 	gimpinkoptions-gui.h		\
 	gimpinktool.c			\

Modified: trunk/app/tools/gimpbrightnesscontrasttool.c
==============================================================================
--- trunk/app/tools/gimpbrightnesscontrasttool.c	(original)
+++ trunk/app/tools/gimpbrightnesscontrasttool.c	Tue May 20 14:17:13 2008
@@ -122,18 +122,23 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_brightness_contrast_tool_finalize;
+  object_class->finalize           = gimp_brightness_contrast_tool_finalize;
 
-  tool_class->initialize       = gimp_brightness_contrast_tool_initialize;
-  tool_class->button_press     = gimp_brightness_contrast_tool_button_press;
-  tool_class->button_release   = gimp_brightness_contrast_tool_button_release;
-  tool_class->motion           = gimp_brightness_contrast_tool_motion;
-
-  im_tool_class->shell_desc    = _("Adjust Brightness and Contrast");
-
-  im_tool_class->get_operation = gimp_brightness_contrast_tool_get_operation;
-  im_tool_class->map           = gimp_brightness_contrast_tool_map;
-  im_tool_class->dialog        = gimp_brightness_contrast_tool_dialog;
+  tool_class->initialize           = gimp_brightness_contrast_tool_initialize;
+  tool_class->button_press         = gimp_brightness_contrast_tool_button_press;
+  tool_class->button_release       = gimp_brightness_contrast_tool_button_release;
+  tool_class->motion               = gimp_brightness_contrast_tool_motion;
+
+  im_tool_class->shell_desc        = _("Adjust Brightness and Contrast");
+  im_tool_class->settings_name     = "brightness-contrast";
+  im_tool_class->load_dialog_title = _("Load Brightness-Contrast settings");
+  im_tool_class->load_button_tip   = _("Load brightness-contrast settings from file");
+  im_tool_class->save_dialog_title = _("Save Brightness-Contrast settings");
+  im_tool_class->save_button_tip   = _("Save brightness-contrast settings to file");
+
+  im_tool_class->get_operation     = gimp_brightness_contrast_tool_get_operation;
+  im_tool_class->map               = gimp_brightness_contrast_tool_map;
+  im_tool_class->dialog            = gimp_brightness_contrast_tool_dialog;
 }
 
 static void

Modified: trunk/app/tools/gimpcolorbalancetool.c
==============================================================================
--- trunk/app/tools/gimpcolorbalancetool.c	(original)
+++ trunk/app/tools/gimpcolorbalancetool.c	Tue May 20 14:17:13 2008
@@ -106,16 +106,21 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_color_balance_tool_finalize;
+  object_class->finalize           = gimp_color_balance_tool_finalize;
 
-  tool_class->initialize       = gimp_color_balance_tool_initialize;
+  tool_class->initialize           = gimp_color_balance_tool_initialize;
 
-  im_tool_class->shell_desc    = _("Adjust Color Balance");
-
-  im_tool_class->get_operation = gimp_color_balance_tool_get_operation;
-  im_tool_class->map           = gimp_color_balance_tool_map;
-  im_tool_class->dialog        = gimp_color_balance_tool_dialog;
-  im_tool_class->reset         = gimp_color_balance_tool_reset;
+  im_tool_class->shell_desc        = _("Adjust Color Balance");
+  im_tool_class->settings_name     = "color-balance";
+  im_tool_class->load_dialog_title = _("Load Color Balance Settings");
+  im_tool_class->load_button_tip   = _("Load color balance settings from file");
+  im_tool_class->save_dialog_title = _("Save Color Balance Settings");
+  im_tool_class->save_button_tip   = _("Save color balance settings to file");
+
+  im_tool_class->get_operation     = gimp_color_balance_tool_get_operation;
+  im_tool_class->map               = gimp_color_balance_tool_map;
+  im_tool_class->dialog            = gimp_color_balance_tool_dialog;
+  im_tool_class->reset             = gimp_color_balance_tool_reset;
 }
 
 static void

Modified: trunk/app/tools/gimpcolorizetool.c
==============================================================================
--- trunk/app/tools/gimpcolorizetool.c	(original)
+++ trunk/app/tools/gimpcolorizetool.c	Tue May 20 14:17:13 2008
@@ -101,15 +101,20 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_colorize_tool_finalize;
+  object_class->finalize           = gimp_colorize_tool_finalize;
 
-  tool_class->initialize       = gimp_colorize_tool_initialize;
+  tool_class->initialize           = gimp_colorize_tool_initialize;
 
-  im_tool_class->shell_desc    = _("Colorize the Image");
-
-  im_tool_class->get_operation = gimp_colorize_tool_get_operation;
-  im_tool_class->map           = gimp_colorize_tool_map;
-  im_tool_class->dialog        = gimp_colorize_tool_dialog;
+  im_tool_class->shell_desc        = _("Colorize the Image");
+  im_tool_class->settings_name     = "colorize";
+  im_tool_class->load_dialog_title = _("Load Colorize Settings");
+  im_tool_class->load_button_tip   = _("Load colorize settings from file");
+  im_tool_class->save_dialog_title = _("Save Colorsize Settings");
+  im_tool_class->save_button_tip   = _("Save colorize settings to file");
+
+  im_tool_class->get_operation     = gimp_colorize_tool_get_operation;
+  im_tool_class->map               = gimp_colorize_tool_map;
+  im_tool_class->dialog            = gimp_colorize_tool_dialog;
 }
 
 static void

Modified: trunk/app/tools/gimpcurvestool.c
==============================================================================
--- trunk/app/tools/gimpcurvestool.c	(original)
+++ trunk/app/tools/gimpcurvestool.c	Tue May 20 14:17:13 2008
@@ -422,7 +422,6 @@
   GtkWidget        *table;
   GtkWidget        *button;
   GtkWidget        *bar;
-  gint              padding;
 
   vbox = image_map_tool->main_vbox;
 
@@ -546,24 +545,6 @@
   gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
   gtk_widget_show (hbox);
 
-  /*  Horizontal button box for load / save */
-  frame = gimp_frame_new (_("All Channels"));
-  gtk_box_pack_start (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
-  gtk_widget_show (frame);
-
-  bbox = gtk_hbutton_box_new ();
-  gtk_box_set_spacing (GTK_BOX (bbox), 4);
-  gtk_container_add (GTK_CONTAINER (frame), bbox);
-  gtk_widget_show (bbox);
-
-  gtk_box_pack_start (GTK_BOX (bbox), image_map_tool->load_button,
-                      FALSE, FALSE, 0);
-  gtk_widget_show (image_map_tool->load_button);
-
-  gtk_box_pack_start (GTK_BOX (bbox), image_map_tool->save_button,
-                      FALSE, FALSE, 0);
-  gtk_widget_show (image_map_tool->save_button);
-
   /*  The radio box for selecting the curve type  */
   frame = gimp_frame_new (_("Curve Type"));
   gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
@@ -574,13 +555,6 @@
                                   G_CALLBACK (curves_curve_type_callback),
                                   tool,
                                   &tool->curve_type);
-
-  gtk_widget_style_get (bbox, "child-internal-pad-x", &padding, NULL);
-
-  gimp_enum_stock_box_set_child_padding (hbox, padding, -1);
-
-  gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
-
   gtk_container_add (GTK_CONTAINER (frame), hbox);
   gtk_widget_show (hbox);
 }

Modified: trunk/app/tools/gimphuesaturationtool.c
==============================================================================
--- trunk/app/tools/gimphuesaturationtool.c	(original)
+++ trunk/app/tools/gimphuesaturationtool.c	Tue May 20 14:17:13 2008
@@ -114,16 +114,21 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_hue_saturation_tool_finalize;
+  object_class->finalize           = gimp_hue_saturation_tool_finalize;
 
-  tool_class->initialize       = gimp_hue_saturation_tool_initialize;
+  tool_class->initialize           = gimp_hue_saturation_tool_initialize;
 
-  im_tool_class->shell_desc    = _("Adjust Hue / Lightness / Saturation");
-
-  im_tool_class->get_operation = gimp_hue_saturation_tool_get_operation;
-  im_tool_class->map           = gimp_hue_saturation_tool_map;
-  im_tool_class->dialog        = gimp_hue_saturation_tool_dialog;
-  im_tool_class->reset         = gimp_hue_saturation_tool_reset;
+  im_tool_class->shell_desc        = _("Adjust Hue / Lightness / Saturation");
+  im_tool_class->settings_name     = "hue-saturation";
+  im_tool_class->load_dialog_title = _("Load Hue-Saturation Settings");
+  im_tool_class->load_button_tip   = _("Load hue-saturation settings from file");
+  im_tool_class->save_dialog_title = _("Save Hue-Saturation Settings");
+  im_tool_class->save_button_tip   = _("Save hue-saturation settings to file");
+
+  im_tool_class->get_operation     = gimp_hue_saturation_tool_get_operation;
+  im_tool_class->map               = gimp_hue_saturation_tool_map;
+  im_tool_class->dialog            = gimp_hue_saturation_tool_dialog;
+  im_tool_class->reset             = gimp_hue_saturation_tool_reset;
 }
 
 static void

Added: trunk/app/tools/gimpimagemaptool-settings.c
==============================================================================
--- (empty file)
+++ trunk/app/tools/gimpimagemaptool-settings.c	Tue May 20 14:17:13 2008
@@ -0,0 +1,436 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpimagemaptool-settings.c
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#include "config.h"
+
+#include <errno.h>
+
+#include <glib/gstdio.h>
+#include <gegl.h>
+#include <gtk/gtk.h>
+
+#include "libgimpbase/gimpbase.h"
+#include "libgimpconfig/gimpconfig.h"
+#include "libgimpwidgets/gimpwidgets.h"
+
+#include "tools-types.h"
+
+#include "core/gimp.h"
+#include "core/gimpcontext.h"
+#include "core/gimplist.h"
+#include "core/gimptoolinfo.h"
+
+#include "widgets/gimpcontainercombobox.h"
+#include "widgets/gimpcontainerview.h"
+
+#include "gimpimagemapoptions.h"
+#include "gimpimagemaptool.h"
+#include "gimpimagemaptool-settings.h"
+
+#include "gimp-intl.h"
+
+
+/*  local function prototypes  */
+
+static void   gimp_image_map_tool_recent_selected (GimpContainerView *view,
+                                                   GimpViewable      *object,
+                                                   gpointer           insert_data,
+                                                   GimpImageMapTool  *tool);
+
+static void   gimp_image_map_tool_load_clicked    (GtkWidget         *widget,
+                                                   GimpImageMapTool  *tool);
+static void   gimp_image_map_tool_save_clicked    (GtkWidget         *widget,
+                                                   GimpImageMapTool  *tool);
+
+static void   gimp_image_map_tool_settings_dialog (GimpImageMapTool  *im_tool,
+                                                   const gchar       *title,
+                                                   gboolean           save);
+
+static gboolean gimp_image_map_tool_settings_load (GimpImageMapTool  *tool,
+                                                   const gchar       *filename);
+static gboolean gimp_image_map_tool_settings_save (GimpImageMapTool  *tool,
+                                                   const gchar       *filename);
+
+
+/*  public functions  */
+
+gboolean
+gimp_image_map_tool_dialog_add_settings (GimpImageMapTool *image_map_tool)
+{
+  GimpImageMapToolClass *klass;
+  GimpToolInfo          *tool_info;
+  GtkWidget             *hbox;
+  GtkWidget             *label;
+  GtkWidget             *combo;
+
+  klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (image_map_tool);
+
+  tool_info = GIMP_TOOL (image_map_tool)->tool_info;
+
+  if (gimp_container_num_children (klass->recent_settings) == 0)
+    {
+      gchar  *filename;
+      GError *error = NULL;
+
+      filename = gimp_tool_info_build_options_filename (tool_info,
+                                                        ".settings");
+
+      if (tool_info->gimp->be_verbose)
+        g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
+
+      if (! gimp_config_deserialize_file (GIMP_CONFIG (klass->recent_settings),
+                                          filename,
+                                          NULL, &error))
+        {
+          if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
+            gimp_message (tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
+                          "%s", error->message);
+
+          g_clear_error (&error);
+        }
+
+      gimp_list_reverse (GIMP_LIST (klass->recent_settings));
+
+      g_free (filename);
+    }
+
+  hbox = gtk_hbox_new (FALSE, 4);
+  gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (hbox);
+
+  label = gtk_label_new (_("Recent Settings:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+  gtk_widget_show (label);
+
+  combo = gimp_container_combo_box_new (klass->recent_settings,
+                                        GIMP_CONTEXT (tool_info->tool_options),
+                                        16, 0);
+  gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
+  gtk_widget_show (combo);
+
+  gimp_help_set_help_data (combo, _("Pick a setting from the list"),
+                           NULL);
+
+  g_signal_connect_after (combo, "select-item",
+                          G_CALLBACK (gimp_image_map_tool_recent_selected),
+                          image_map_tool);
+
+  /*  The load/save hbox  */
+
+  hbox = gtk_hbox_new (FALSE, 4);
+  gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (hbox);
+
+  image_map_tool->load_button = g_object_new (GIMP_TYPE_BUTTON,
+                                              "label",         GTK_STOCK_OPEN,
+                                              "use-stock",     TRUE,
+                                              "use-underline", TRUE,
+                                              NULL);
+  gtk_box_pack_start (GTK_BOX (hbox), image_map_tool->load_button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (image_map_tool->load_button);
+
+  g_signal_connect (image_map_tool->load_button, "clicked",
+                    G_CALLBACK (gimp_image_map_tool_load_clicked),
+                    image_map_tool);
+
+  if (klass->load_button_tip)
+    gimp_help_set_help_data (image_map_tool->load_button,
+                             klass->load_button_tip, NULL);
+
+  image_map_tool->save_button = g_object_new (GIMP_TYPE_BUTTON,
+                                              "label",         GTK_STOCK_SAVE,
+                                              "use-stock",     TRUE,
+                                              "use-underline", TRUE,
+                                              NULL);
+  gtk_box_pack_start (GTK_BOX (hbox), image_map_tool->save_button,
+                      FALSE, FALSE, 0);
+  gtk_widget_show (image_map_tool->save_button);
+
+  g_signal_connect (image_map_tool->save_button, "clicked",
+                    G_CALLBACK (gimp_image_map_tool_save_clicked),
+                    image_map_tool);
+
+  if (klass->save_button_tip)
+    gimp_help_set_help_data (image_map_tool->save_button,
+                             klass->save_button_tip, NULL);
+
+  return TRUE;
+}
+
+gboolean
+gimp_image_map_tool_real_settings_load (GimpImageMapTool *tool,
+                                        const gchar      *filename,
+                                        GError          **error)
+{
+  gboolean success;
+
+  if (GIMP_TOOL (tool)->tool_info->gimp->be_verbose)
+    g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
+
+  success = gimp_config_deserialize_file (GIMP_CONFIG (tool->config),
+                                          filename,
+                                          NULL, error);
+
+  return success;
+}
+
+gboolean
+gimp_image_map_tool_real_settings_save (GimpImageMapTool *tool,
+                                        const gchar      *filename,
+                                        GError          **error)
+{
+  GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
+  gchar                 *header;
+  gchar                 *footer;
+  gboolean               success;
+
+  header = g_strdup_printf ("GIMP %s tool settings",   klass->settings_name);
+  footer = g_strdup_printf ("end of %s tool settings", klass->settings_name);
+
+  if (GIMP_TOOL (tool)->tool_info->gimp->be_verbose)
+    g_print ("Writing '%s'\n", gimp_filename_to_utf8 (filename));
+
+  success = gimp_config_serialize_to_file (GIMP_CONFIG (tool->config),
+                                           filename,
+                                           header, footer,
+                                           NULL, error);
+
+  g_free (header);
+  g_free (footer);
+
+  return success;
+}
+
+
+/*  private functions  */
+
+static void
+gimp_image_map_tool_recent_selected (GimpContainerView *view,
+                                     GimpViewable      *object,
+                                     gpointer           insert_data,
+                                     GimpImageMapTool  *tool)
+{
+  if (object)
+    {
+      gimp_config_copy (GIMP_CONFIG (object),
+                        GIMP_CONFIG (tool->config), 0);
+
+      gimp_container_view_select_item (view, NULL);
+    }
+}
+
+static void
+gimp_image_map_tool_load_clicked (GtkWidget        *widget,
+                                  GimpImageMapTool *tool)
+{
+  GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
+
+  gimp_image_map_tool_settings_dialog (tool, klass->load_dialog_title, FALSE);
+}
+
+static void
+gimp_image_map_tool_save_clicked (GtkWidget        *widget,
+                                  GimpImageMapTool *tool)
+{
+  GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
+
+  gimp_image_map_tool_settings_dialog (tool, klass->save_dialog_title, TRUE);
+}
+
+static void
+settings_dialog_response (GtkWidget        *dialog,
+                          gint              response_id,
+                          GimpImageMapTool *tool)
+{
+  gboolean save;
+
+  save = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "save"));
+
+  if (response_id == GTK_RESPONSE_OK)
+    {
+      gchar *filename;
+
+      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
+
+      if (save)
+        gimp_image_map_tool_settings_save (tool, filename);
+      else
+        gimp_image_map_tool_settings_load (tool, filename);
+
+      g_free (filename);
+    }
+
+  if (save)
+    gtk_widget_set_sensitive (tool->load_button, TRUE);
+  else
+    gtk_widget_set_sensitive (tool->save_button, TRUE);
+
+  gtk_widget_destroy (dialog);
+}
+
+static void
+gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
+                                     const gchar      *title,
+                                     gboolean          save)
+{
+  GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
+  GtkFileChooser      *chooser;
+  const gchar         *settings_name;
+  gchar               *folder;
+
+  settings_name = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name;
+
+  g_return_if_fail (settings_name != NULL);
+
+  if (tool->settings_dialog)
+    {
+      gtk_window_present (GTK_WINDOW (tool->settings_dialog));
+      return;
+    }
+
+  if (save)
+    gtk_widget_set_sensitive (tool->load_button, FALSE);
+  else
+    gtk_widget_set_sensitive (tool->save_button, FALSE);
+
+  tool->settings_dialog =
+    gtk_file_chooser_dialog_new (title, GTK_WINDOW (tool->shell),
+                                 save ?
+                                 GTK_FILE_CHOOSER_ACTION_SAVE :
+                                 GTK_FILE_CHOOSER_ACTION_OPEN,
+
+                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+                                 save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
+                                 GTK_RESPONSE_OK,
+
+                                 NULL);
+
+  chooser = GTK_FILE_CHOOSER (tool->settings_dialog);
+
+  g_object_set_data (G_OBJECT (chooser), "save", GINT_TO_POINTER (save));
+
+  gtk_window_set_role (GTK_WINDOW (chooser), "gimp-load-save-settings");
+  gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
+
+  g_object_add_weak_pointer (G_OBJECT (chooser),
+                             (gpointer) &tool->settings_dialog);
+
+  gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
+
+  gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
+
+  if (save)
+    gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
+
+  g_signal_connect (chooser, "response",
+                    G_CALLBACK (settings_dialog_response),
+                    tool);
+  g_signal_connect (chooser, "delete-event",
+                    G_CALLBACK (gtk_true),
+                    NULL);
+
+  folder = g_build_filename (gimp_directory (), settings_name, NULL);
+
+  if (g_file_test (folder, G_FILE_TEST_IS_DIR))
+    {
+      gtk_file_chooser_add_shortcut_folder (chooser, folder, NULL);
+    }
+  else
+    {
+      g_free (folder);
+      folder = g_strdup (g_get_home_dir ());
+    }
+
+  if (options->settings)
+    gtk_file_chooser_set_filename (chooser, options->settings);
+  else
+    gtk_file_chooser_set_current_folder (chooser, folder);
+
+  g_free (folder);
+
+  gimp_help_connect (tool->settings_dialog, gimp_standard_help_func,
+                     GIMP_TOOL (tool)->tool_info->help_id, NULL);
+
+  gtk_widget_show (tool->settings_dialog);
+}
+
+static gboolean
+gimp_image_map_tool_settings_load (GimpImageMapTool *tool,
+                                   const gchar      *filename)
+{
+  GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
+  GError                *error      = NULL;
+
+  g_return_val_if_fail (tool_class->settings_load != NULL, FALSE);
+
+  if (! tool_class->settings_load (tool, filename, &error))
+    {
+      gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
+                    GIMP_MESSAGE_ERROR, error->message);
+      g_clear_error (&error);
+
+      return FALSE;
+    }
+
+  gimp_image_map_tool_preview (tool);
+
+  g_object_set (GIMP_TOOL_GET_OPTIONS (tool),
+                "settings", filename,
+                NULL);
+
+  return TRUE;
+}
+
+static gboolean
+gimp_image_map_tool_settings_save (GimpImageMapTool *tool,
+                                   const gchar      *filename)
+{
+  GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
+  GError                *error      = NULL;
+  gchar                 *display_name;
+
+  g_return_val_if_fail (tool_class->settings_save != NULL, FALSE);
+
+  if (! tool_class->settings_save (tool, filename, &error))
+    {
+      gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
+                    GIMP_MESSAGE_ERROR, error->message);
+      g_clear_error (&error);
+
+      return FALSE;
+    }
+
+  display_name = g_filename_display_name (filename);
+  gimp_message (GIMP_TOOL (tool)->tool_info->gimp,
+                G_OBJECT (GIMP_TOOL (tool)->display),
+                GIMP_MESSAGE_INFO,
+                _("Settings saved to '%s'"),
+                display_name);
+  g_free (display_name);
+
+  g_object_set (GIMP_TOOL_GET_OPTIONS (tool),
+                "settings", filename,
+                NULL);
+
+  return TRUE;
+}

Added: trunk/app/tools/gimpimagemaptool-settings.h
==============================================================================
--- (empty file)
+++ trunk/app/tools/gimpimagemaptool-settings.h	Tue May 20 14:17:13 2008
@@ -0,0 +1,35 @@
+/* GIMP - The GNU Image Manipulation Program
+ * Copyright (C) 1995 Spencer Kimball and Peter Mattis
+ *
+ * gimpimagemaptool-settings.h
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GIMP_IMAGE_MAP_TOOL_SETTINGS_H__
+#define __GIMP_IMAGE_MAP_TOOL_SETTINGS_H__
+
+
+gboolean gimp_image_map_tool_dialog_add_settings (GimpImageMapTool *image_map_tool);
+
+gboolean gimp_image_map_tool_real_settings_load  (GimpImageMapTool *tool,
+                                                  const gchar      *filename,
+                                                  GError          **error);
+gboolean gimp_image_map_tool_real_settings_save  (GimpImageMapTool *tool,
+                                                  const gchar      *filename,
+                                                  GError          **error);
+
+
+#endif /* __GIMP_IMAGE_MAP_TOOL_SETTINGS_H__ */

Modified: trunk/app/tools/gimpimagemaptool.c
==============================================================================
--- trunk/app/tools/gimpimagemaptool.c	(original)
+++ trunk/app/tools/gimpimagemaptool.c	Tue May 20 14:17:13 2008
@@ -18,9 +18,6 @@
 
 #include "config.h"
 
-#include <errno.h>
-
-#include <glib/gstdio.h>
 #include <gegl.h>
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
@@ -41,8 +38,6 @@
 #include "core/gimpprojection.h"
 #include "core/gimptoolinfo.h"
 
-#include "widgets/gimpcontainercombobox.h"
-#include "widgets/gimpcontainerview.h"
 #include "widgets/gimpdialogfactory.h"
 #include "widgets/gimptooldialog.h"
 #include "widgets/gimpwidgets-utils.h"
@@ -53,6 +48,7 @@
 
 #include "gimpcoloroptions.h"
 #include "gimpimagemaptool.h"
+#include "gimpimagemaptool-settings.h"
 #include "gimptoolcontrol.h"
 #include "tool_manager.h"
 
@@ -98,31 +94,12 @@
                                                   gint              response_id,
                                                   GimpImageMapTool *im_tool);
 
-static void      gimp_image_map_tool_recent_selected  (GimpContainerView *view,
-                                                       GimpViewable      *object,
-                                                       gpointer           insert_data,
-                                                       GimpImageMapTool  *tool);
-
-static void      gimp_image_map_tool_load_clicked     (GtkWidget         *widget,
-                                                       GimpImageMapTool  *tool);
-static void      gimp_image_map_tool_load_ext_clicked (GtkWidget         *widget,
-                                                       GdkModifierType    state,
-                                                       GimpImageMapTool  *tool);
-static void      gimp_image_map_tool_save_clicked     (GtkWidget         *widget,
-                                                       GimpImageMapTool  *tool);
-static void      gimp_image_map_tool_save_ext_clicked (GtkWidget         *widget,
-                                                       GdkModifierType    state,
-                                                       GimpImageMapTool  *tool);
-
-static void      gimp_image_map_tool_settings_dialog  (GimpImageMapTool  *im_tool,
-                                                       const gchar       *title,
-                                                       gboolean           save);
-static void      gimp_image_map_tool_notify_preview   (GObject           *config,
-                                                       GParamSpec        *pspec,
-                                                       GimpImageMapTool  *im_tool);
-static void      gimp_image_map_tool_gegl_notify      (GObject           *config,
-                                                       const GParamSpec  *pspec,
-                                                       GimpImageMapTool  *im_tool);
+static void      gimp_image_map_tool_notify_preview (GObject           *config,
+                                                     GParamSpec        *pspec,
+                                                     GimpImageMapTool  *im_tool);
+static void      gimp_image_map_tool_gegl_notify    (GObject           *config,
+                                                     const GParamSpec  *pspec,
+                                                     GimpImageMapTool  *im_tool);
 
 
 static GimpColorToolClass *parent_class = NULL;
@@ -186,8 +163,8 @@
   klass->map                = NULL;
   klass->dialog             = NULL;
   klass->reset              = NULL;
-  klass->settings_load      = NULL;
-  klass->settings_save      = NULL;
+  klass->settings_load      = gimp_image_map_tool_real_settings_load;
+  klass->settings_save      = gimp_image_map_tool_real_settings_save;
 }
 
 static void
@@ -323,60 +300,7 @@
       gtk_container_add (GTK_CONTAINER (GTK_DIALOG (shell)->vbox), vbox);
 
       if (image_map_tool->config)
-        {
-          GtkWidget *hbox;
-          GtkWidget *label;
-          GtkWidget *combo;
-
-          if (gimp_container_num_children (klass->recent_settings) == 0)
-            {
-              gchar  *filename;
-              GError *error = NULL;
-
-              filename = gimp_tool_info_build_options_filename (tool->tool_info,
-                                                                ".settings");
-
-              if (tool->tool_info->gimp->be_verbose)
-                g_print ("Parsing '%s'\n", gimp_filename_to_utf8 (filename));
-
-              if (! gimp_config_deserialize_file (GIMP_CONFIG (klass->recent_settings),
-                                                  filename,
-                                                  NULL, &error))
-                {
-                  if (error->code != GIMP_CONFIG_ERROR_OPEN_ENOENT)
-                    gimp_message (tool->tool_info->gimp, NULL, GIMP_MESSAGE_ERROR,
-                                  "%s", error->message);
-
-                  g_clear_error (&error);
-                }
-
-              gimp_list_reverse (GIMP_LIST (klass->recent_settings));
-
-              g_free (filename);
-            }
-
-          hbox = gtk_hbox_new (FALSE, 4);
-          gtk_box_pack_start (GTK_BOX (image_map_tool->main_vbox), hbox,
-                              FALSE, FALSE, 0);
-          gtk_widget_show (hbox);
-
-          label = gtk_label_new (_("Recent Settings:"));
-          gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
-          gtk_widget_show (label);
-
-          combo = gimp_container_combo_box_new (klass->recent_settings,
-                                                GIMP_CONTEXT (tool_info->tool_options),
-                                                16, 0);
-          gtk_box_pack_start (GTK_BOX (hbox), combo, TRUE, TRUE, 0);
-          gtk_widget_show (combo);
-
-          gimp_help_set_help_data (combo, _("Pick a setting from the list"),
-                                   NULL);
-
-          g_signal_connect_after (combo, "select-item",
-                                  G_CALLBACK (gimp_image_map_tool_recent_selected),
-                                  image_map_tool);
-        }
+        gimp_image_map_tool_dialog_add_settings (image_map_tool);
 
       /*  The preview toggle  */
       toggle = gimp_prop_check_button_new (G_OBJECT (tool_info->tool_options),
@@ -391,64 +315,6 @@
                                G_CALLBACK (gimp_image_map_tool_notify_preview),
                                image_map_tool, 0);
 
-      if (klass->load_dialog_title)
-        {
-          image_map_tool->load_button =
-            g_object_new (GIMP_TYPE_BUTTON,
-                          "label",         GTK_STOCK_OPEN,
-                          "use-stock",     TRUE,
-                          "use-underline", TRUE,
-                          NULL);
-
-          g_signal_connect (image_map_tool->load_button, "clicked",
-                            G_CALLBACK (gimp_image_map_tool_load_clicked),
-                            image_map_tool);
-          g_signal_connect (image_map_tool->load_button, "extended-clicked",
-                            G_CALLBACK (gimp_image_map_tool_load_ext_clicked),
-                            image_map_tool);
-
-          if (klass->load_button_tip)
-            {
-              gchar *str = g_strdup_printf ("%s\n"
-                                            "(%s)  %s",
-                                            klass->load_button_tip,
-                                            gimp_get_mod_string (GDK_SHIFT_MASK),
-                                            _("Quick Load"));
-
-              gimp_help_set_help_data (image_map_tool->load_button, str, NULL);
-              g_free (str);
-            }
-        }
-
-      if (klass->save_dialog_title)
-        {
-          image_map_tool->save_button =
-            g_object_new (GIMP_TYPE_BUTTON,
-                          "label",         GTK_STOCK_SAVE,
-                          "use-stock",     TRUE,
-                          "use-underline", TRUE,
-                          NULL);
-
-          g_signal_connect (image_map_tool->save_button, "clicked",
-                            G_CALLBACK (gimp_image_map_tool_save_clicked),
-                            image_map_tool);
-          g_signal_connect (image_map_tool->save_button, "extended-clicked",
-                            G_CALLBACK (gimp_image_map_tool_save_ext_clicked),
-                            image_map_tool);
-
-          if (klass->save_button_tip)
-            {
-              gchar *str = g_strdup_printf ("%s\n"
-                                            "(%s)  %s",
-                                            klass->save_button_tip,
-                                            gimp_get_mod_string (GDK_SHIFT_MASK),
-                                            _("Quick Save"));
-
-              gimp_help_set_help_data (image_map_tool->save_button, str, NULL);
-              g_free (str);
-            }
-        }
-
       /*  Fill in subclass widgets  */
       gimp_image_map_tool_dialog (image_map_tool);
 
@@ -468,7 +334,7 @@
 
   gtk_widget_show (image_map_tool->shell);
 
-  image_map_tool->drawable  = drawable;
+  image_map_tool->drawable = drawable;
 
   gimp_image_map_tool_create_map (image_map_tool);
 
@@ -633,67 +499,6 @@
                     tool);
 }
 
-static gboolean
-gimp_image_map_tool_settings_load (GimpImageMapTool *tool,
-                                   const gchar      *filename)
-{
-  GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
-  GError                *error      = NULL;
-
-  g_return_val_if_fail (tool_class->settings_load != NULL, FALSE);
-
-  if (! tool_class->settings_load (tool, filename, &error))
-    {
-      gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
-                    GIMP_MESSAGE_ERROR, error->message);
-      g_clear_error (&error);
-
-      return FALSE;
-    }
-
-  gimp_image_map_tool_preview (tool);
-
-  g_object_set (GIMP_TOOL_GET_OPTIONS (tool),
-                "settings", filename,
-                NULL);
-
-  return TRUE;
-}
-
-static gboolean
-gimp_image_map_tool_settings_save (GimpImageMapTool *tool,
-                                   const gchar      *filename)
-{
-  GimpImageMapToolClass *tool_class = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
-  GError                *error      = NULL;
-  gchar                 *display_name;
-
-  g_return_val_if_fail (tool_class->settings_save != NULL, FALSE);
-
-  if (! tool_class->settings_save (tool, filename, &error))
-    {
-      gimp_message (GIMP_TOOL (tool)->tool_info->gimp, G_OBJECT (tool->shell),
-                    GIMP_MESSAGE_ERROR, error->message);
-      g_clear_error (&error);
-
-      return FALSE;
-    }
-
-  display_name = g_filename_display_name (filename);
-  gimp_message (GIMP_TOOL (tool)->tool_info->gimp,
-                G_OBJECT (GIMP_TOOL (tool)->display),
-                GIMP_MESSAGE_INFO,
-                _("Settings saved to '%s'"),
-                display_name);
-  g_free (display_name);
-
-  g_object_set (GIMP_TOOL_GET_OPTIONS (tool),
-                "settings", filename,
-                NULL);
-
-  return TRUE;
-}
-
 static void
 gimp_image_map_tool_flush (GimpImageMap     *image_map,
                            GimpImageMapTool *image_map_tool)
@@ -834,21 +639,6 @@
 }
 
 static void
-gimp_image_map_tool_recent_selected (GimpContainerView *view,
-                                     GimpViewable      *object,
-                                     gpointer           insert_data,
-                                     GimpImageMapTool  *tool)
-{
-  if (object)
-    {
-      gimp_config_copy (GIMP_CONFIG (object),
-                        GIMP_CONFIG (tool->config), 0);
-
-      gimp_container_view_select_item (view, NULL);
-    }
-}
-
-static void
 gimp_image_map_tool_notify_preview (GObject          *config,
                                     GParamSpec       *pspec,
                                     GimpImageMapTool *image_map_tool)
@@ -902,182 +692,6 @@
 }
 
 static void
-settings_dialog_response (GtkWidget        *dialog,
-                          gint              response_id,
-                          GimpImageMapTool *tool)
-{
-  gboolean save;
-
-  save = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (dialog), "save"));
-
-  if (response_id == GTK_RESPONSE_OK)
-    {
-      gchar *filename;
-
-      filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog));
-
-      if (save)
-        gimp_image_map_tool_settings_save (tool, filename);
-      else
-        gimp_image_map_tool_settings_load (tool, filename);
-
-      g_free (filename);
-    }
-
-  if (save)
-    gtk_widget_set_sensitive (tool->load_button, TRUE);
-  else
-    gtk_widget_set_sensitive (tool->save_button, TRUE);
-
-  gtk_widget_destroy (dialog);
-}
-
-static void
-gimp_image_map_tool_load_clicked (GtkWidget        *widget,
-                                  GimpImageMapTool *tool)
-{
-  GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
-
-  gimp_image_map_tool_settings_dialog (tool, klass->load_dialog_title, FALSE);
-}
-
-static void
-gimp_image_map_tool_load_ext_clicked (GtkWidget        *widget,
-                                      GdkModifierType   state,
-                                      GimpImageMapTool *tool)
-{
-  if (state & GDK_SHIFT_MASK)
-    {
-      gchar *filename;
-
-      g_object_get (GIMP_TOOL_GET_OPTIONS (tool),
-                    "settings", &filename,
-                    NULL);
-
-      if (filename)
-        {
-          gimp_image_map_tool_settings_load (tool, filename);
-          g_free (filename);
-        }
-      else
-        {
-          gimp_image_map_tool_load_clicked (widget, tool);
-        }
-    }
-}
-
-static void
-gimp_image_map_tool_save_clicked (GtkWidget        *widget,
-                                  GimpImageMapTool *tool)
-{
-  GimpImageMapToolClass *klass = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool);
-
-  gimp_image_map_tool_settings_dialog (tool, klass->save_dialog_title, TRUE);
-}
-
-static void
-gimp_image_map_tool_save_ext_clicked (GtkWidget        *widget,
-                                      GdkModifierType   state,
-                                      GimpImageMapTool *tool)
-{
-  if (state & GDK_SHIFT_MASK)
-    {
-      gchar *filename;
-
-      g_object_get (GIMP_TOOL_GET_OPTIONS (tool),
-                    "settings", &filename,
-                    NULL);
-
-      if (filename)
-        {
-          gimp_image_map_tool_settings_save (tool, filename);
-          g_free (filename);
-        }
-      else
-        {
-          gimp_image_map_tool_save_clicked (widget, tool);
-        }
-    }
-}
-
-static void
-gimp_image_map_tool_settings_dialog (GimpImageMapTool *tool,
-                                     const gchar      *title,
-                                     gboolean          save)
-{
-  GimpImageMapOptions *options = GIMP_IMAGE_MAP_TOOL_GET_OPTIONS (tool);
-  GtkFileChooser      *chooser;
-  const gchar         *settings_name;
-  gchar               *folder;
-
-  settings_name = GIMP_IMAGE_MAP_TOOL_GET_CLASS (tool)->settings_name;
-
-  g_return_if_fail (settings_name != NULL);
-
-  if (tool->settings_dialog)
-    {
-      gtk_window_present (GTK_WINDOW (tool->settings_dialog));
-      return;
-    }
-
-  if (save)
-    gtk_widget_set_sensitive (tool->load_button, FALSE);
-  else
-    gtk_widget_set_sensitive (tool->save_button, FALSE);
-
-  tool->settings_dialog =
-    gtk_file_chooser_dialog_new (title, GTK_WINDOW (tool->shell),
-                                 save ?
-                                 GTK_FILE_CHOOSER_ACTION_SAVE :
-                                 GTK_FILE_CHOOSER_ACTION_OPEN,
-
-                                 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                                 save ? GTK_STOCK_SAVE : GTK_STOCK_OPEN,
-                                 GTK_RESPONSE_OK,
-
-                                 NULL);
-
-  chooser = GTK_FILE_CHOOSER (tool->settings_dialog);
-
-  g_object_set_data (G_OBJECT (chooser), "save", GINT_TO_POINTER (save));
-
-  gtk_window_set_role (GTK_WINDOW (chooser), "gimp-load-save-settings");
-  gtk_window_set_position (GTK_WINDOW (chooser), GTK_WIN_POS_MOUSE);
-
-  g_object_add_weak_pointer (G_OBJECT (chooser),
-                             (gpointer) &tool->settings_dialog);
-
-  gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
-
-  gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
-
-  if (save)
-    gtk_file_chooser_set_do_overwrite_confirmation (chooser, TRUE);
-
-  g_signal_connect (chooser, "response",
-                    G_CALLBACK (settings_dialog_response),
-                    tool);
-  g_signal_connect (chooser, "delete-event",
-                    G_CALLBACK (gtk_true),
-                    NULL);
-
-  folder = g_build_filename (gimp_directory (), settings_name, NULL);
-  gtk_file_chooser_add_shortcut_folder (chooser, folder, NULL);
-
-  if (options->settings)
-    gtk_file_chooser_set_filename (chooser, options->settings);
-  else
-    gtk_file_chooser_set_current_folder (chooser, folder);
-
-  g_free (folder);
-
-  gimp_help_connect (tool->settings_dialog, gimp_standard_help_func,
-                     GIMP_TOOL (tool)->tool_info->help_id, NULL);
-
-  gtk_widget_show (tool->settings_dialog);
-}
-
-static void
 gimp_image_map_tool_gegl_notify (GObject          *config,
                                  const GParamSpec *pspec,
                                  GimpImageMapTool *im_tool)

Modified: trunk/app/tools/gimplevelstool.c
==============================================================================
--- trunk/app/tools/gimplevelstool.c	(original)
+++ trunk/app/tools/gimplevelstool.c	Tue May 20 14:17:13 2008
@@ -637,19 +637,6 @@
   gtk_container_add (GTK_CONTAINER (frame), hbox);
   gtk_widget_show (hbox);
 
-  hbbox = gtk_hbutton_box_new ();
-  gtk_box_set_spacing (GTK_BOX (hbbox), 4);
-  gtk_box_pack_start (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0);
-  gtk_widget_show (hbbox);
-
-  gtk_box_pack_start (GTK_BOX (hbbox), image_map_tool->load_button,
-                      FALSE, FALSE, 0);
-  gtk_widget_show (image_map_tool->load_button);
-
-  gtk_box_pack_start (GTK_BOX (hbbox), image_map_tool->save_button,
-                      FALSE, FALSE, 0);
-  gtk_widget_show (image_map_tool->save_button);
-
   hbbox = gtk_hbox_new (FALSE, 6);
   gtk_box_pack_end (GTK_BOX (hbox), hbbox, FALSE, FALSE, 0);
   gtk_widget_show (hbbox);

Modified: trunk/app/tools/gimpposterizetool.c
==============================================================================
--- trunk/app/tools/gimpposterizetool.c	(original)
+++ trunk/app/tools/gimpposterizetool.c	Tue May 20 14:17:13 2008
@@ -96,15 +96,20 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_posterize_tool_finalize;
+  object_class->finalize           = gimp_posterize_tool_finalize;
 
-  tool_class->initialize       = gimp_posterize_tool_initialize;
+  tool_class->initialize           = gimp_posterize_tool_initialize;
 
-  im_tool_class->shell_desc    = _("Posterize (Reduce Number of Colors)");
-
-  im_tool_class->get_operation = gimp_posterize_tool_get_operation;
-  im_tool_class->map           = gimp_posterize_tool_map;
-  im_tool_class->dialog        = gimp_posterize_tool_dialog;
+  im_tool_class->shell_desc        = _("Posterize (Reduce Number of Colors)");
+  im_tool_class->settings_name     = "posterize";
+  im_tool_class->load_dialog_title = _("Load Posterize Settings");
+  im_tool_class->load_button_tip   = _("Load posterize settings from file");
+  im_tool_class->save_dialog_title = _("Save Posterize Settings");
+  im_tool_class->save_button_tip   = _("Save posterize settings to file");
+
+  im_tool_class->get_operation     = gimp_posterize_tool_get_operation;
+  im_tool_class->map               = gimp_posterize_tool_map;
+  im_tool_class->dialog            = gimp_posterize_tool_dialog;
 }
 
 static void

Modified: trunk/app/tools/gimpthresholdtool.c
==============================================================================
--- trunk/app/tools/gimpthresholdtool.c	(original)
+++ trunk/app/tools/gimpthresholdtool.c	Tue May 20 14:17:13 2008
@@ -102,15 +102,20 @@
   GimpToolClass         *tool_class    = GIMP_TOOL_CLASS (klass);
   GimpImageMapToolClass *im_tool_class = GIMP_IMAGE_MAP_TOOL_CLASS (klass);
 
-  object_class->finalize       = gimp_threshold_tool_finalize;
+  object_class->finalize           = gimp_threshold_tool_finalize;
 
-  tool_class->initialize       = gimp_threshold_tool_initialize;
+  tool_class->initialize           = gimp_threshold_tool_initialize;
 
-  im_tool_class->shell_desc    = _("Apply Threshold");
-
-  im_tool_class->get_operation = gimp_threshold_tool_get_operation;
-  im_tool_class->map           = gimp_threshold_tool_map;
-  im_tool_class->dialog        = gimp_threshold_tool_dialog;
+  im_tool_class->shell_desc        = _("Apply Threshold");
+  im_tool_class->settings_name     = "threshold";
+  im_tool_class->load_dialog_title = _("Load Threshold Settings");
+  im_tool_class->load_button_tip   = _("Load threshold settings from file");
+  im_tool_class->save_dialog_title = _("Save Threshold Settings");
+  im_tool_class->save_button_tip   = _("Save threshold settings to file");
+
+  im_tool_class->get_operation     = gimp_threshold_tool_get_operation;
+  im_tool_class->map               = gimp_threshold_tool_map;
+  im_tool_class->dialog            = gimp_threshold_tool_dialog;
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]