factored out some code to a utility function.

2006-03-10  Sven Neumann  <ven@gimp.org>

	* app/widgets/gimpaction.c: factored out some code to a utility
	function.

	* app/config/gimpguiconfig.[ch]
	* app/config/gimprc-blurbs.h
	* app/dialogs/preferences-dialog.c
	* app/gui/gui.c
	* app/plug-in/plug-in-run.c
	* libgimp/gimp.c
	* libgimpbase/gimpprotocol.[ch]: renamed tool_tips to tooltips in
	variables and in the gimprc.

	* app/config/gimpbaseconfig.[ch]: removed stingy_memory_use from
	the GimpBaseConfig struct.
This commit is contained in:
Sven Neumann 2006-03-10 16:40:09 +00:00 committed by Sven Neumann
parent 49b1d06896
commit 872d9506e5
15 changed files with 105 additions and 63 deletions

View File

@ -1,3 +1,20 @@
2006-03-10 Sven Neumann <ven@gimp.org>
* app/widgets/gimpaction.c: factored out some code to a utility
function.
* app/config/gimpguiconfig.[ch]
* app/config/gimprc-blurbs.h
* app/dialogs/preferences-dialog.c
* app/gui/gui.c
* app/plug-in/plug-in-run.c
* libgimp/gimp.c
* libgimpbase/gimpprotocol.[ch]: renamed tool_tips to tooltips in
variables and in the gimprc.
* app/config/gimpbaseconfig.[ch]: removed stingy_memory_use from
the GimpBaseConfig struct.
2006-03-10 Sven Neumann <sven@gimp.org> 2006-03-10 Sven Neumann <sven@gimp.org>
* modules/colorsel_water.c: remove color if Shift is pressed. * modules/colorsel_water.c: remove color if Shift is pressed.

View File

@ -41,9 +41,11 @@ enum
PROP_0, PROP_0,
PROP_TEMP_PATH, PROP_TEMP_PATH,
PROP_SWAP_PATH, PROP_SWAP_PATH,
PROP_STINGY_MEMORY_USE,
PROP_NUM_PROCESSORS, PROP_NUM_PROCESSORS,
PROP_TILE_CACHE_SIZE PROP_TILE_CACHE_SIZE,
/* ignored, only for backward compatibility: */
PROP_STINGY_MEMORY_USE
}; };
@ -84,10 +86,6 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
"${gimp_dir}", "${gimp_dir}",
GIMP_PARAM_STATIC_STRINGS | GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_RESTART); GIMP_CONFIG_PARAM_RESTART);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE,
"stingy-memory-use", NULL,
FALSE,
GIMP_CONFIG_PARAM_IGNORE);
GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_NUM_PROCESSORS, GIMP_CONFIG_INSTALL_PROP_UINT (object_class, PROP_NUM_PROCESSORS,
"num-processors", NUM_PROCESSORS_BLURB, "num-processors", NUM_PROCESSORS_BLURB,
1, GIMP_MAX_NUM_THREADS, 2, 1, GIMP_MAX_NUM_THREADS, 2,
@ -98,6 +96,12 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass)
1 << 28, /* 256MB */ 1 << 28, /* 256MB */
GIMP_PARAM_STATIC_STRINGS | GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_CONFIRM); GIMP_CONFIG_PARAM_CONFIRM);
/* only for backward compatibility: */
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_STINGY_MEMORY_USE,
"stingy-memory-use", NULL,
FALSE,
GIMP_CONFIG_PARAM_IGNORE);
} }
static void static void
@ -134,15 +138,17 @@ gimp_base_config_set_property (GObject *object,
g_free (base_config->swap_path); g_free (base_config->swap_path);
base_config->swap_path = g_value_dup_string (value); base_config->swap_path = g_value_dup_string (value);
break; break;
case PROP_STINGY_MEMORY_USE:
base_config->stingy_memory_use = g_value_get_boolean (value);
break;
case PROP_NUM_PROCESSORS: case PROP_NUM_PROCESSORS:
base_config->num_processors = g_value_get_uint (value); base_config->num_processors = g_value_get_uint (value);
break; break;
case PROP_TILE_CACHE_SIZE: case PROP_TILE_CACHE_SIZE:
base_config->tile_cache_size = g_value_get_uint64 (value); base_config->tile_cache_size = g_value_get_uint64 (value);
break; break;
case PROP_STINGY_MEMORY_USE:
/* ignored */
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break; break;
@ -165,15 +171,17 @@ gimp_base_config_get_property (GObject *object,
case PROP_SWAP_PATH: case PROP_SWAP_PATH:
g_value_set_string (value, base_config->swap_path); g_value_set_string (value, base_config->swap_path);
break; break;
case PROP_STINGY_MEMORY_USE:
g_value_set_boolean (value, base_config->stingy_memory_use);
break;
case PROP_NUM_PROCESSORS: case PROP_NUM_PROCESSORS:
g_value_set_uint (value, base_config->num_processors); g_value_set_uint (value, base_config->num_processors);
break; break;
case PROP_TILE_CACHE_SIZE: case PROP_TILE_CACHE_SIZE:
g_value_set_uint64 (value, base_config->tile_cache_size); g_value_set_uint64 (value, base_config->tile_cache_size);
break; break;
case PROP_STINGY_MEMORY_USE:
/* ignored */
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break; break;

View File

@ -40,7 +40,6 @@ struct _GimpBaseConfig
gchar *temp_path; gchar *temp_path;
gchar *swap_path; gchar *swap_path;
gboolean stingy_memory_use; /* unused */
guint num_processors; guint num_processors;
guint64 tile_cache_size; guint64 tile_cache_size;
}; };

View File

@ -49,14 +49,13 @@ enum
PROP_0, PROP_0,
PROP_DEFAULT_THRESHOLD, PROP_DEFAULT_THRESHOLD,
PROP_MOVE_TOOL_CHANGES_ACTIVE, PROP_MOVE_TOOL_CHANGES_ACTIVE,
PROP_INFO_WINDOW_PER_DISPLAY,
PROP_TRUST_DIRTY_FLAG, PROP_TRUST_DIRTY_FLAG,
PROP_SAVE_DEVICE_STATUS, PROP_SAVE_DEVICE_STATUS,
PROP_SAVE_SESSION_INFO, PROP_SAVE_SESSION_INFO,
PROP_RESTORE_SESSION, PROP_RESTORE_SESSION,
PROP_SAVE_TOOL_OPTIONS, PROP_SAVE_TOOL_OPTIONS,
PROP_SHOW_TIPS, PROP_SHOW_TIPS,
PROP_SHOW_TOOL_TIPS, PROP_SHOW_TOOLTIPS,
PROP_TEAROFF_MENUS, PROP_TEAROFF_MENUS,
PROP_CAN_CHANGE_ACCELS, PROP_CAN_CHANGE_ACCELS,
PROP_SAVE_ACCELS, PROP_SAVE_ACCELS,
@ -77,7 +76,11 @@ enum
PROP_TOOLBOX_WINDOW_HINT, PROP_TOOLBOX_WINDOW_HINT,
PROP_DOCK_WINDOW_HINT, PROP_DOCK_WINDOW_HINT,
PROP_TRANSIENT_DOCKS, PROP_TRANSIENT_DOCKS,
PROP_CURSOR_FORMAT PROP_CURSOR_FORMAT,
/* ignored, only for backward compatibility: */
PROP_INFO_WINDOW_PER_DISPLAY,
PROP_SHOW_TOOL_TIPS
}; };
@ -116,12 +119,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
MOVE_TOOL_CHANGES_ACTIVE_BLURB, MOVE_TOOL_CHANGES_ACTIVE_BLURB,
FALSE, FALSE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY,
"info-window-per-display",
NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_IGNORE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TRUST_DIRTY_FLAG, GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TRUST_DIRTY_FLAG,
"trust-dirty-flag", "trust-dirty-flag",
TRUST_DIRTY_FLAG_BLURB, TRUST_DIRTY_FLAG_BLURB,
@ -150,8 +147,8 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
"show-tips", SHOW_TIPS_BLURB, "show-tips", SHOW_TIPS_BLURB,
TRUE, TRUE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS, GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLTIPS,
"show-tool-tips", SHOW_TOOL_TIPS_BLURB, "show-tooltips", SHOW_TOOLTIPS_BLURB,
TRUE, TRUE,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS, GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TEAROFF_MENUS,
@ -256,6 +253,19 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GIMP_TYPE_CURSOR_FORMAT, GIMP_TYPE_CURSOR_FORMAT,
GIMP_CURSOR_FORMAT_PIXBUF, GIMP_CURSOR_FORMAT_PIXBUF,
GIMP_PARAM_STATIC_STRINGS); GIMP_PARAM_STATIC_STRINGS);
/* only for backward compatibility: */
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_INFO_WINDOW_PER_DISPLAY,
"info-window-per-display",
NULL,
FALSE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_IGNORE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS,
"show-tool-tips", NULL,
TRUE,
GIMP_PARAM_STATIC_STRINGS |
GIMP_CONFIG_PARAM_IGNORE);
} }
static void static void
@ -292,9 +302,6 @@ gimp_gui_config_set_property (GObject *object,
case PROP_MOVE_TOOL_CHANGES_ACTIVE: case PROP_MOVE_TOOL_CHANGES_ACTIVE:
gui_config->move_tool_changes_active = g_value_get_boolean (value); gui_config->move_tool_changes_active = g_value_get_boolean (value);
break; break;
case PROP_INFO_WINDOW_PER_DISPLAY:
gui_config->info_window_per_display = g_value_get_boolean (value);
break;
case PROP_TRUST_DIRTY_FLAG: case PROP_TRUST_DIRTY_FLAG:
gui_config->trust_dirty_flag = g_value_get_boolean (value); gui_config->trust_dirty_flag = g_value_get_boolean (value);
break; break;
@ -313,8 +320,8 @@ gimp_gui_config_set_property (GObject *object,
case PROP_SHOW_TIPS: case PROP_SHOW_TIPS:
gui_config->show_tips = g_value_get_boolean (value); gui_config->show_tips = g_value_get_boolean (value);
break; break;
case PROP_SHOW_TOOL_TIPS: case PROP_SHOW_TOOLTIPS:
gui_config->show_tool_tips = g_value_get_boolean (value); gui_config->show_tooltips = g_value_get_boolean (value);
break; break;
case PROP_TEAROFF_MENUS: case PROP_TEAROFF_MENUS:
gui_config->tearoff_menus = g_value_get_boolean (value); gui_config->tearoff_menus = g_value_get_boolean (value);
@ -384,6 +391,11 @@ gimp_gui_config_set_property (GObject *object,
gui_config->cursor_format = g_value_get_enum (value); gui_config->cursor_format = g_value_get_enum (value);
break; break;
case PROP_INFO_WINDOW_PER_DISPLAY:
case PROP_SHOW_TOOL_TIPS:
/* ignored */
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break; break;
@ -406,9 +418,6 @@ gimp_gui_config_get_property (GObject *object,
case PROP_MOVE_TOOL_CHANGES_ACTIVE: case PROP_MOVE_TOOL_CHANGES_ACTIVE:
g_value_set_boolean (value, gui_config->move_tool_changes_active); g_value_set_boolean (value, gui_config->move_tool_changes_active);
break; break;
case PROP_INFO_WINDOW_PER_DISPLAY:
g_value_set_boolean (value, gui_config->info_window_per_display);
break;
case PROP_TRUST_DIRTY_FLAG: case PROP_TRUST_DIRTY_FLAG:
g_value_set_boolean (value, gui_config->trust_dirty_flag); g_value_set_boolean (value, gui_config->trust_dirty_flag);
break; break;
@ -427,8 +436,8 @@ gimp_gui_config_get_property (GObject *object,
case PROP_SHOW_TIPS: case PROP_SHOW_TIPS:
g_value_set_boolean (value, gui_config->show_tips); g_value_set_boolean (value, gui_config->show_tips);
break; break;
case PROP_SHOW_TOOL_TIPS: case PROP_SHOW_TOOLTIPS:
g_value_set_boolean (value, gui_config->show_tool_tips); g_value_set_boolean (value, gui_config->show_tooltips);
break; break;
case PROP_TEAROFF_MENUS: case PROP_TEAROFF_MENUS:
g_value_set_boolean (value, gui_config->tearoff_menus); g_value_set_boolean (value, gui_config->tearoff_menus);
@ -494,6 +503,11 @@ gimp_gui_config_get_property (GObject *object,
g_value_set_enum (value, gui_config->cursor_format); g_value_set_enum (value, gui_config->cursor_format);
break; break;
case PROP_INFO_WINDOW_PER_DISPLAY:
case PROP_SHOW_TOOL_TIPS:
/* ignored */
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break; break;

View File

@ -42,14 +42,13 @@ struct _GimpGuiConfig
gint default_threshold; gint default_threshold;
gboolean move_tool_changes_active; gboolean move_tool_changes_active;
gboolean info_window_per_display; /* unused */
gboolean trust_dirty_flag; gboolean trust_dirty_flag;
gboolean save_device_status; gboolean save_device_status;
gboolean save_session_info; gboolean save_session_info;
gboolean restore_session; gboolean restore_session;
gboolean save_tool_options; gboolean save_tool_options;
gboolean show_tips; gboolean show_tips;
gboolean show_tool_tips; gboolean show_tooltips;
gboolean tearoff_menus; gboolean tearoff_menus;
gboolean can_change_accels; gboolean can_change_accels;
gboolean save_accels; gboolean save_accels;

View File

@ -333,8 +333,8 @@ N_("When enabled, the sample points are visible by default. This can also be " \
#define SHOW_TIPS_BLURB \ #define SHOW_TIPS_BLURB \
N_("Enable displaying a handy GIMP tip on startup.") N_("Enable displaying a handy GIMP tip on startup.")
#define SHOW_TOOL_TIPS_BLURB \ #define SHOW_TOOLTIPS_BLURB \
N_("Enable tooltips display.") N_("Show a tooltip when the pointer hovers over an item.")
#define SWAP_PATH_BLURB \ #define SWAP_PATH_BLURB \
N_("Sets the swap file location. GIMP uses a tile based memory allocation " \ N_("Sets the swap file location. GIMP uses a tile based memory allocation " \

View File

@ -1574,8 +1574,8 @@ prefs_dialog_new (Gimp *gimp,
/* General */ /* General */
vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE);
prefs_check_button_add (object, "show-tool-tips", prefs_check_button_add (object, "show-tooltips",
_("Show tool _tips"), _("Show _tooltips"),
GTK_BOX (vbox2)); GTK_BOX (vbox2));
prefs_check_button_add (object, "show-help-button", prefs_check_button_add (object, "show-help-button",
_("Show help _buttons"), _("Show help _buttons"),

View File

@ -363,10 +363,10 @@ gui_restore_callback (Gimp *gimp,
G_CALLBACK (gui_image_disconnect), G_CALLBACK (gui_image_disconnect),
gimp); gimp);
if (! gui_config->show_tool_tips) if (! gui_config->show_tooltips)
gimp_help_disable_tooltips (); gimp_help_disable_tooltips ();
g_signal_connect (gui_config, "notify::show-tool-tips", g_signal_connect (gui_config, "notify::show-tooltips",
G_CALLBACK (gui_show_tooltips_notify), G_CALLBACK (gui_show_tooltips_notify),
gimp); gimp);
@ -555,7 +555,7 @@ gui_show_tooltips_notify (GimpGuiConfig *gui_config,
GParamSpec *param_spec, GParamSpec *param_spec,
Gimp *gimp) Gimp *gimp)
{ {
if (gui_config->show_tool_tips) if (gui_config->show_tooltips)
gimp_help_enable_tooltips (); gimp_help_enable_tooltips ();
else else
gimp_help_disable_tooltips (); gimp_help_disable_tooltips ();

View File

@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_7 = 0; config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0; config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap; config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = gui_config->show_tool_tips; config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID; config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name (); config.app_name = (gchar *) g_get_application_name ();

View File

@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_7 = 0; config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0; config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap; config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = gui_config->show_tool_tips; config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID; config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name (); config.app_name = (gchar *) g_get_application_name ();

View File

@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp,
config.gimp_reserved_7 = 0; config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0; config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap; config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = gui_config->show_tool_tips; config.show_tooltips = gui_config->show_tooltips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256); config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID; config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name (); config.app_name = (gchar *) g_get_application_name ();

View File

@ -222,6 +222,23 @@ gimp_action_name_compare (GimpAction *action1,
/* private functions */ /* private functions */
static void
gimp_action_set_proxy_tooltip (GimpAction *action,
GtkWidget *proxy)
{
gchar *tooltip;
g_object_get (action, "tooltip", &tooltip, NULL);
if (tooltip)
{
gimp_help_set_help_data (proxy, tooltip,
g_object_get_qdata (G_OBJECT (proxy),
GIMP_HELP_ID));
g_free (tooltip);
}
}
static void static void
gimp_action_set_proxy (GimpAction *action, gimp_action_set_proxy (GimpAction *action,
GtkWidget *proxy) GtkWidget *proxy)
@ -235,19 +252,7 @@ gimp_action_set_proxy (GimpAction *action,
*/ */
if (action->viewable) if (action->viewable)
{ {
gchar *tooltip = NULL; gimp_action_set_proxy_tooltip (action, proxy);
g_object_get (action, "tooltip", &tooltip, NULL);
if (tooltip)
{
const gchar *help_id;
help_id = g_object_get_qdata (G_OBJECT (proxy), GIMP_HELP_ID);
gimp_help_set_help_data (proxy, tooltip, help_id);
g_free (tooltip);
}
} }
if (action->color) if (action->color)

View File

@ -1690,7 +1690,7 @@ gimp_config (GPConfig *config)
_check_size = config->check_size; _check_size = config->check_size;
_check_type = config->check_type; _check_type = config->check_type;
_install_cmap = config->install_cmap; _install_cmap = config->install_cmap;
_show_tool_tips = config->show_tool_tips; _show_tool_tips = config->show_tooltips;
_show_help_button = config->show_help_button; _show_help_button = config->show_help_button;
_min_colors = config->min_colors; _min_colors = config->min_colors;
_gdisp_ID = config->gdisp_ID; _gdisp_ID = config->gdisp_ID;

View File

@ -519,7 +519,7 @@ _gp_config_read (GIOChannel *channel,
(guint8 *) &config->install_cmap, 1, user_data)) (guint8 *) &config->install_cmap, 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_int8 (channel, if (! _gimp_wire_read_int8 (channel,
(guint8 *) &config->show_tool_tips, 1, user_data)) (guint8 *) &config->show_tooltips, 1, user_data))
goto cleanup; goto cleanup;
if (! _gimp_wire_read_int32 (channel, if (! _gimp_wire_read_int32 (channel,
(guint32 *) &config->min_colors, 1, user_data)) (guint32 *) &config->min_colors, 1, user_data))
@ -609,7 +609,7 @@ _gp_config_write (GIOChannel *channel,
user_data)) user_data))
return; return;
if (! _gimp_wire_write_int8 (channel, if (! _gimp_wire_write_int8 (channel,
(const guint8 *) &config->show_tool_tips, 1, (const guint8 *) &config->show_tooltips, 1,
user_data)) user_data))
return; return;
if (! _gimp_wire_write_int32 (channel, if (! _gimp_wire_write_int32 (channel,

View File

@ -75,7 +75,7 @@ struct _GPConfig
gint8 gimp_reserved_7; gint8 gimp_reserved_7;
gint8 gimp_reserved_8; gint8 gimp_reserved_8;
gint8 install_cmap; gint8 install_cmap;
gint8 show_tool_tips; gint8 show_tooltips;
gint32 min_colors; gint32 min_colors;
gint32 gdisp_ID; gint32 gdisp_ID;
gchar *app_name; gchar *app_name;