From 872d9506e52f5a6519e4c325f06c197f0efe329d Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 10 Mar 2006 16:40:09 +0000 Subject: [PATCH] factored out some code to a utility function. 2006-03-10 Sven Neumann * 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. --- ChangeLog | 17 +++++++++ app/config/gimpbaseconfig.c | 32 ++++++++++------ app/config/gimpbaseconfig.h | 1 - app/config/gimpguiconfig.c | 56 +++++++++++++++++----------- app/config/gimpguiconfig.h | 3 +- app/config/gimprc-blurbs.h | 4 +- app/dialogs/preferences-dialog.c | 4 +- app/gui/gui.c | 6 +-- app/plug-in/gimppluginmanager-call.c | 2 +- app/plug-in/gimppluginmanager-run.c | 2 +- app/plug-in/plug-in-run.c | 2 +- app/widgets/gimpaction.c | 31 ++++++++------- libgimp/gimp.c | 2 +- libgimpbase/gimpprotocol.c | 4 +- libgimpbase/gimpprotocol.h | 2 +- 15 files changed, 105 insertions(+), 63 deletions(-) diff --git a/ChangeLog b/ChangeLog index e3a9987d91..aaede8836f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2006-03-10 Sven Neumann + + * 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 * modules/colorsel_water.c: remove color if Shift is pressed. diff --git a/app/config/gimpbaseconfig.c b/app/config/gimpbaseconfig.c index cf15d3cadd..54aa4f5d08 100644 --- a/app/config/gimpbaseconfig.c +++ b/app/config/gimpbaseconfig.c @@ -41,9 +41,11 @@ enum PROP_0, PROP_TEMP_PATH, PROP_SWAP_PATH, - PROP_STINGY_MEMORY_USE, 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_PARAM_STATIC_STRINGS | 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, "num-processors", NUM_PROCESSORS_BLURB, 1, GIMP_MAX_NUM_THREADS, 2, @@ -98,6 +96,12 @@ gimp_base_config_class_init (GimpBaseConfigClass *klass) 1 << 28, /* 256MB */ GIMP_PARAM_STATIC_STRINGS | 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 @@ -134,15 +138,17 @@ gimp_base_config_set_property (GObject *object, g_free (base_config->swap_path); base_config->swap_path = g_value_dup_string (value); break; - case PROP_STINGY_MEMORY_USE: - base_config->stingy_memory_use = g_value_get_boolean (value); - break; case PROP_NUM_PROCESSORS: base_config->num_processors = g_value_get_uint (value); break; case PROP_TILE_CACHE_SIZE: base_config->tile_cache_size = g_value_get_uint64 (value); break; + + case PROP_STINGY_MEMORY_USE: + /* ignored */ + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -165,15 +171,17 @@ gimp_base_config_get_property (GObject *object, case PROP_SWAP_PATH: g_value_set_string (value, base_config->swap_path); break; - case PROP_STINGY_MEMORY_USE: - g_value_set_boolean (value, base_config->stingy_memory_use); - break; case PROP_NUM_PROCESSORS: g_value_set_uint (value, base_config->num_processors); break; case PROP_TILE_CACHE_SIZE: g_value_set_uint64 (value, base_config->tile_cache_size); break; + + case PROP_STINGY_MEMORY_USE: + /* ignored */ + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/app/config/gimpbaseconfig.h b/app/config/gimpbaseconfig.h index 881be57c3c..0897a8d5b1 100644 --- a/app/config/gimpbaseconfig.h +++ b/app/config/gimpbaseconfig.h @@ -40,7 +40,6 @@ struct _GimpBaseConfig gchar *temp_path; gchar *swap_path; - gboolean stingy_memory_use; /* unused */ guint num_processors; guint64 tile_cache_size; }; diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 70e76c8d96..baa21f057e 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -49,14 +49,13 @@ enum PROP_0, PROP_DEFAULT_THRESHOLD, PROP_MOVE_TOOL_CHANGES_ACTIVE, - PROP_INFO_WINDOW_PER_DISPLAY, PROP_TRUST_DIRTY_FLAG, PROP_SAVE_DEVICE_STATUS, PROP_SAVE_SESSION_INFO, PROP_RESTORE_SESSION, PROP_SAVE_TOOL_OPTIONS, PROP_SHOW_TIPS, - PROP_SHOW_TOOL_TIPS, + PROP_SHOW_TOOLTIPS, PROP_TEAROFF_MENUS, PROP_CAN_CHANGE_ACCELS, PROP_SAVE_ACCELS, @@ -77,7 +76,11 @@ enum PROP_TOOLBOX_WINDOW_HINT, PROP_DOCK_WINDOW_HINT, 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, FALSE, 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, "trust-dirty-flag", TRUST_DIRTY_FLAG_BLURB, @@ -150,8 +147,8 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) "show-tips", SHOW_TIPS_BLURB, TRUE, GIMP_PARAM_STATIC_STRINGS); - GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOL_TIPS, - "show-tool-tips", SHOW_TOOL_TIPS_BLURB, + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_TOOLTIPS, + "show-tooltips", SHOW_TOOLTIPS_BLURB, TRUE, GIMP_PARAM_STATIC_STRINGS); 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_CURSOR_FORMAT_PIXBUF, 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 @@ -292,9 +302,6 @@ 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_INFO_WINDOW_PER_DISPLAY: - gui_config->info_window_per_display = g_value_get_boolean (value); - break; case PROP_TRUST_DIRTY_FLAG: gui_config->trust_dirty_flag = g_value_get_boolean (value); break; @@ -313,8 +320,8 @@ gimp_gui_config_set_property (GObject *object, case PROP_SHOW_TIPS: gui_config->show_tips = g_value_get_boolean (value); break; - case PROP_SHOW_TOOL_TIPS: - gui_config->show_tool_tips = g_value_get_boolean (value); + case PROP_SHOW_TOOLTIPS: + gui_config->show_tooltips = g_value_get_boolean (value); break; case PROP_TEAROFF_MENUS: 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); break; + case PROP_INFO_WINDOW_PER_DISPLAY: + case PROP_SHOW_TOOL_TIPS: + /* ignored */ + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; @@ -406,9 +418,6 @@ 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_INFO_WINDOW_PER_DISPLAY: - g_value_set_boolean (value, gui_config->info_window_per_display); - break; case PROP_TRUST_DIRTY_FLAG: g_value_set_boolean (value, gui_config->trust_dirty_flag); break; @@ -427,8 +436,8 @@ gimp_gui_config_get_property (GObject *object, case PROP_SHOW_TIPS: g_value_set_boolean (value, gui_config->show_tips); break; - case PROP_SHOW_TOOL_TIPS: - g_value_set_boolean (value, gui_config->show_tool_tips); + case PROP_SHOW_TOOLTIPS: + g_value_set_boolean (value, gui_config->show_tooltips); break; case PROP_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); break; + case PROP_INFO_WINDOW_PER_DISPLAY: + case PROP_SHOW_TOOL_TIPS: + /* ignored */ + break; + default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index 63595454fc..75f9c89dcb 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -42,14 +42,13 @@ struct _GimpGuiConfig gint default_threshold; gboolean move_tool_changes_active; - gboolean info_window_per_display; /* unused */ gboolean trust_dirty_flag; gboolean save_device_status; gboolean save_session_info; gboolean restore_session; gboolean save_tool_options; gboolean show_tips; - gboolean show_tool_tips; + gboolean show_tooltips; gboolean tearoff_menus; gboolean can_change_accels; gboolean save_accels; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 4310a34aca..c4a2e4eca9 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -333,8 +333,8 @@ N_("When enabled, the sample points are visible by default. This can also be " \ #define SHOW_TIPS_BLURB \ N_("Enable displaying a handy GIMP tip on startup.") -#define SHOW_TOOL_TIPS_BLURB \ -N_("Enable tooltips display.") +#define SHOW_TOOLTIPS_BLURB \ +N_("Show a tooltip when the pointer hovers over an item.") #define SWAP_PATH_BLURB \ N_("Sets the swap file location. GIMP uses a tile based memory allocation " \ diff --git a/app/dialogs/preferences-dialog.c b/app/dialogs/preferences-dialog.c index 92cf2fffe8..42d7f1be63 100644 --- a/app/dialogs/preferences-dialog.c +++ b/app/dialogs/preferences-dialog.c @@ -1574,8 +1574,8 @@ prefs_dialog_new (Gimp *gimp, /* General */ vbox2 = prefs_frame_new (_("General"), GTK_CONTAINER (vbox), FALSE); - prefs_check_button_add (object, "show-tool-tips", - _("Show tool _tips"), + prefs_check_button_add (object, "show-tooltips", + _("Show _tooltips"), GTK_BOX (vbox2)); prefs_check_button_add (object, "show-help-button", _("Show help _buttons"), diff --git a/app/gui/gui.c b/app/gui/gui.c index 4bf797b51a..4fc0dd226d 100644 --- a/app/gui/gui.c +++ b/app/gui/gui.c @@ -363,10 +363,10 @@ gui_restore_callback (Gimp *gimp, G_CALLBACK (gui_image_disconnect), gimp); - if (! gui_config->show_tool_tips) + if (! gui_config->show_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), gimp); @@ -555,7 +555,7 @@ gui_show_tooltips_notify (GimpGuiConfig *gui_config, GParamSpec *param_spec, Gimp *gimp) { - if (gui_config->show_tool_tips) + if (gui_config->show_tooltips) gimp_help_enable_tooltips (); else gimp_help_disable_tooltips (); diff --git a/app/plug-in/gimppluginmanager-call.c b/app/plug-in/gimppluginmanager-call.c index 132f9f6207..47ff9e2f5f 100644 --- a/app/plug-in/gimppluginmanager-call.c +++ b/app/plug-in/gimppluginmanager-call.c @@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp, config.gimp_reserved_7 = 0; config.gimp_reserved_8 = 0; 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.gdisp_ID = gdisp_ID; config.app_name = (gchar *) g_get_application_name (); diff --git a/app/plug-in/gimppluginmanager-run.c b/app/plug-in/gimppluginmanager-run.c index 132f9f6207..47ff9e2f5f 100644 --- a/app/plug-in/gimppluginmanager-run.c +++ b/app/plug-in/gimppluginmanager-run.c @@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp, config.gimp_reserved_7 = 0; config.gimp_reserved_8 = 0; 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.gdisp_ID = gdisp_ID; config.app_name = (gchar *) g_get_application_name (); diff --git a/app/plug-in/plug-in-run.c b/app/plug-in/plug-in-run.c index 132f9f6207..47ff9e2f5f 100644 --- a/app/plug-in/plug-in-run.c +++ b/app/plug-in/plug-in-run.c @@ -119,7 +119,7 @@ plug_in_run (Gimp *gimp, config.gimp_reserved_7 = 0; config.gimp_reserved_8 = 0; 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.gdisp_ID = gdisp_ID; config.app_name = (gchar *) g_get_application_name (); diff --git a/app/widgets/gimpaction.c b/app/widgets/gimpaction.c index d6f9df0ef0..2a82caac49 100644 --- a/app/widgets/gimpaction.c +++ b/app/widgets/gimpaction.c @@ -222,6 +222,23 @@ gimp_action_name_compare (GimpAction *action1, /* 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 gimp_action_set_proxy (GimpAction *action, GtkWidget *proxy) @@ -235,19 +252,7 @@ gimp_action_set_proxy (GimpAction *action, */ if (action->viewable) { - gchar *tooltip = NULL; - - 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); - } + gimp_action_set_proxy_tooltip (action, proxy); } if (action->color) diff --git a/libgimp/gimp.c b/libgimp/gimp.c index e3f88913ec..a261a1d817 100644 --- a/libgimp/gimp.c +++ b/libgimp/gimp.c @@ -1690,7 +1690,7 @@ gimp_config (GPConfig *config) _check_size = config->check_size; _check_type = config->check_type; _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; _min_colors = config->min_colors; _gdisp_ID = config->gdisp_ID; diff --git a/libgimpbase/gimpprotocol.c b/libgimpbase/gimpprotocol.c index 750799f72d..fe4d21c8fc 100644 --- a/libgimpbase/gimpprotocol.c +++ b/libgimpbase/gimpprotocol.c @@ -519,7 +519,7 @@ _gp_config_read (GIOChannel *channel, (guint8 *) &config->install_cmap, 1, user_data)) goto cleanup; if (! _gimp_wire_read_int8 (channel, - (guint8 *) &config->show_tool_tips, 1, user_data)) + (guint8 *) &config->show_tooltips, 1, user_data)) goto cleanup; if (! _gimp_wire_read_int32 (channel, (guint32 *) &config->min_colors, 1, user_data)) @@ -609,7 +609,7 @@ _gp_config_write (GIOChannel *channel, user_data)) return; if (! _gimp_wire_write_int8 (channel, - (const guint8 *) &config->show_tool_tips, 1, + (const guint8 *) &config->show_tooltips, 1, user_data)) return; if (! _gimp_wire_write_int32 (channel, diff --git a/libgimpbase/gimpprotocol.h b/libgimpbase/gimpprotocol.h index ed11b2b8e5..6438ab19d4 100644 --- a/libgimpbase/gimpprotocol.h +++ b/libgimpbase/gimpprotocol.h @@ -75,7 +75,7 @@ struct _GPConfig gint8 gimp_reserved_7; gint8 gimp_reserved_8; gint8 install_cmap; - gint8 show_tool_tips; + gint8 show_tooltips; gint32 min_colors; gint32 gdisp_ID; gchar *app_name;