Commit 051c0512 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Bug 569470 – pls, introduce an option 'how many latest presets for color

2009-02-09  Michael Natterer  <mitch@gimp.org>

	Bug 569470 – pls, introduce an option 'how many latest presets for
	color curves should be saved'

	* app/config/gimprc-blurbs.h
	* app/config/gimpguiconfig.[ch]: add integer property
	"image-map-tool-max-recent" which defaults to ten. Adding a GUI
	for this IMO needs discussion, the value of ten seems appropriate.

	* app/widgets/gimpsettingsbox.[ch]
	(gimp_settings_box_add_current): add "gint max_recent" parameter
	and limit the number of recent settings to this number.

	* app/tools/gimpimagemaptool.c (gimp_image_map_tool_response):
	pass the new settings property to above function.


svn path=/trunk/; revision=28004
parent f9c64f09
2009-02-09 Michael Natterer <mitch@gimp.org>
Bug 569470 pls, introduce an option 'how many latest presets for
color curves should be saved'
* app/config/gimprc-blurbs.h
* app/config/gimpguiconfig.[ch]: add integer property
"image-map-tool-max-recent" which defaults to ten. Adding a GUI
for this IMO needs discussion, the value of ten seems appropriate.
* app/widgets/gimpsettingsbox.[ch]
(gimp_settings_box_add_current): add "gint max_recent" parameter
and limit the number of recent settings to this number.
* app/tools/gimpimagemaptool.c (gimp_image_map_tool_response):
pass the new settings property to above function.
2009-02-08 Michael Natterer <mitch@gimp.org>
* app/tools/gimpcurvestool.c (gimp_curves_tool_key_press): if the
......
......@@ -53,6 +53,7 @@ enum
PROP_0,
PROP_DEFAULT_THRESHOLD,
PROP_MOVE_TOOL_CHANGES_ACTIVE,
PROP_IMAGE_MAP_TOOL_MAX_RECENT,
PROP_TRUST_DIRTY_FLAG,
PROP_SAVE_DEVICE_STATUS,
PROP_SAVE_SESSION_INFO,
......@@ -126,6 +127,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
MOVE_TOOL_CHANGES_ACTIVE_BLURB,
FALSE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_IMAGE_MAP_TOOL_MAX_RECENT,
"image-map-tool-max-recent",
IMAGE_MAP_TOOL_MAX_RECENT_BLURB,
0, 255, 10,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TRUST_DIRTY_FLAG,
"trust-dirty-flag",
TRUST_DIRTY_FLAG_BLURB,
......@@ -327,6 +333,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_MOVE_TOOL_CHANGES_ACTIVE:
gui_config->move_tool_changes_active = g_value_get_boolean (value);
break;
case PROP_IMAGE_MAP_TOOL_MAX_RECENT:
gui_config->image_map_tool_max_recent = g_value_get_int (value);
break;
case PROP_TRUST_DIRTY_FLAG:
gui_config->trust_dirty_flag = g_value_get_boolean (value);
break;
......@@ -451,6 +460,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_MOVE_TOOL_CHANGES_ACTIVE:
g_value_set_boolean (value, gui_config->move_tool_changes_active);
break;
case PROP_IMAGE_MAP_TOOL_MAX_RECENT:
g_value_set_int (value, gui_config->image_map_tool_max_recent);
break;
case PROP_TRUST_DIRTY_FLAG:
g_value_set_boolean (value, gui_config->trust_dirty_flag);
break;
......
......@@ -41,6 +41,7 @@ struct _GimpGuiConfig
gint default_threshold;
gboolean move_tool_changes_active;
gint image_map_tool_max_recent;
gboolean trust_dirty_flag;
gboolean save_device_status;
gboolean save_session_info;
......
......@@ -150,6 +150,9 @@ N_("Sets the browser used by the help system.")
"colon-separated list of language identifiers with decreasing priority. " \
"If empty, the language is taken from the user's locale setting."
#define IMAGE_MAP_TOOL_MAX_RECENT_BLURB \
"How many recent settings to keep around in color correction tools"
#define IMAGE_STATUS_FORMAT_BLURB \
N_("Sets the text to appear in image window status bars.")
......
......@@ -29,6 +29,8 @@
#include "tools-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
......@@ -563,7 +565,8 @@ gimp_image_map_tool_response (GtkWidget *widget,
gimp_image_flush (tool->display->image);
if (image_map_tool->config)
gimp_settings_box_add_current (GIMP_SETTINGS_BOX (image_map_tool->settings_box));
gimp_settings_box_add_current (GIMP_SETTINGS_BOX (image_map_tool->settings_box),
GIMP_GUI_CONFIG (tool->tool_info->gimp->config)->image_map_tool_max_recent);
}
tool->display = NULL;
......
......@@ -113,6 +113,8 @@ static void gimp_settings_box_manage_response (GtkWidget *widget,
GimpSettingsBox *box);
static void gimp_settings_box_toplevel_unmap (GtkWidget *toplevel,
GtkWidget *dialog);
static void gimp_settings_box_truncate_list (GimpSettingsBox *box,
gint max_recent);
G_DEFINE_TYPE (GimpSettingsBox, gimp_settings_box, GTK_TYPE_HBOX)
......@@ -828,6 +830,39 @@ gimp_settings_box_toplevel_unmap (GtkWidget *toplevel,
gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_DELETE_EVENT);
}
static void
gimp_settings_box_truncate_list (GimpSettingsBox *box,
gint max_recent)
{
GList *list;
gint n_recent = 0;
list = GIMP_LIST (box->container)->list;
while (list)
{
GimpConfig *config = list->data;
guint t;
list = g_list_next (list);
g_object_get (config,
"time", &t,
NULL);
if (t > 0)
{
n_recent++;
if (n_recent > max_recent)
gimp_container_remove (box->container, GIMP_OBJECT (config));
}
else
{
break;
}
}
}
/* public functions */
......@@ -866,7 +901,8 @@ gimp_settings_box_new (Gimp *gimp,
}
void
gimp_settings_box_add_current (GimpSettingsBox *box)
gimp_settings_box_add_current (GimpSettingsBox *box,
gint max_recent)
{
GimpConfig *config = NULL;
GList *list;
......@@ -903,5 +939,7 @@ gimp_settings_box_add_current (GimpSettingsBox *box)
g_object_unref (config);
}
gimp_settings_box_truncate_list (box, max_recent);
gimp_settings_box_serialize (box);
}
......@@ -81,7 +81,8 @@ GtkWidget * gimp_settings_box_new (Gimp *gimp,
const gchar *default_folder,
const gchar *last_filename);
void gimp_settings_box_add_current (GimpSettingsBox *box);
void gimp_settings_box_add_current (GimpSettingsBox *box,
gint max_recent);
#endif /* __GIMP_SETTINGS_BOX_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment