Commit 62b5c77c authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

app/config/gimpguiconfig.[ch] added gimprc option "show-help-button".

2004-10-04  Sven Neumann  <sven@gimp.org>

        * app/config/gimpguiconfig.[ch]
        * app/config/gimprc-blurbs.h: added gimprc option "show-help-button".

        * app/dialogs/preferences-dialog.c: added a GUI for it.

        * app/dialogs/file-save-dialog.c
        * app/dialogs/image-new-dialog.c
        * app/dialogs/quit-dialog.c
        * app/display/gimpdisplayshell-close.c
        * app/widgets/gimphelp-ids.h: don't set help-ids on confirmation
        dialogs.

        * libgimpbase/gimpprotocol.[ch]
        * libgimp/gimp.[ch]: added boolean "show_help_button" to the
        config message.

        * app/plug-in/plug-in-run.c: pass the new preference to the plug-in.

        * libgimpwidgets/gimpdialog.[ch]: added new function that allows to
        set whether new dialogs should get a help button added.

        * app/gui/gui.c
        * libgimp/gimpui.c: call gimp_dialogs_show_help_button() according
        to the gimprc settings.
parent 4872d236
2004-10-04 Sven Neumann <sven@gimp.org>
* app/config/gimpguiconfig.[ch]
* app/config/gimprc-blurbs.h: added gimprc option "show-help-button".
* app/dialogs/preferences-dialog.c: added a GUI for it.
* app/dialogs/file-save-dialog.c
* app/dialogs/image-new-dialog.c
* app/dialogs/quit-dialog.c
* app/display/gimpdisplayshell-close.c
* app/widgets/gimphelp-ids.h: don't set help-ids on confirmation
dialogs.
* libgimpbase/gimpprotocol.[ch]
* libgimp/gimp.[ch]: added boolean "show_help_button" to the
config message.
* app/plug-in/plug-in-run.c: pass the new preference to the plug-in.
* libgimpwidgets/gimpdialog.[ch]: added new function that allows to
set whether new dialogs should get a help button added.
* app/gui/gui.c
* libgimp/gimpui.c: call gimp_dialogs_show_help_button() according
to the gimprc settings.
2004-10-04 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-interface.c (script_fu_about): set
......
......@@ -83,6 +83,7 @@ enum
PROP_THEME_PATH,
PROP_THEME,
PROP_USE_HELP,
PROP_SHOW_HELP_BUTTON,
PROP_HELP_LOCALES,
PROP_HELP_BROWSER,
PROP_WEB_BROWSER,
......@@ -228,6 +229,10 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
"use-help", USE_HELP_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_SHOW_HELP_BUTTON,
"show-help-button", SHOW_HELP_BUTTON_BLURB,
TRUE,
0);
GIMP_CONFIG_INSTALL_PROP_STRING (object_class, PROP_HELP_LOCALES,
"help-locales", HELP_LOCALES_BLURB,
"",
......@@ -349,6 +354,9 @@ gimp_gui_config_set_property (GObject *object,
case PROP_USE_HELP:
gui_config->use_help = g_value_get_boolean (value);
break;
case PROP_SHOW_HELP_BUTTON:
gui_config->show_help_button = g_value_get_boolean (value);
break;
case PROP_HELP_LOCALES:
g_free (gui_config->help_locales);
gui_config->help_locales = g_value_dup_string (value);
......@@ -449,6 +457,9 @@ gimp_gui_config_get_property (GObject *object,
case PROP_USE_HELP:
g_value_set_boolean (value, gui_config->use_help);
break;
case PROP_SHOW_HELP_BUTTON:
g_value_set_boolean (value, gui_config->show_help_button);
break;
case PROP_HELP_LOCALES:
g_value_set_string (value, gui_config->help_locales);
break;
......
......@@ -61,6 +61,7 @@ struct _GimpGuiConfig
gchar *theme_path;
gchar *theme;
gboolean use_help;
gboolean show_help_button;
gchar *help_locales;
GimpHelpBrowserType help_browser;
gchar *web_browser;
......
......@@ -270,6 +270,11 @@ N_("Save the positions and sizes of the main dialogs when the GIMP exits.")
N_("When enabled, all paint tools will show a preview of the current " \
"brush's outline.")
#define SHOW_HELP_BUTTON_BLURB \
N_("When enabled, dialogs will show a help button that gives access to " \
"the related help page. Without this button, the help page can still " \
"be reached by pressing F1.")
#define SHOW_PAINT_TOOL_CURSOR_BLURB \
N_("When enabled, the cursor will be shown over the image while " \
"using a paint tool.")
......
......@@ -167,8 +167,7 @@ file_save_overwrite (GtkWidget *save_dialog,
query_box = gimp_query_boolean_box (_("File exists!"),
save_dialog,
gimp_standard_help_func,
GIMP_HELP_FILE_SAVE_OVERWRITE,
gimp_standard_help_func, NULL,
GIMP_STOCK_QUESTION,
message,
_("Replace"), GTK_STOCK_CANCEL,
......
......@@ -93,8 +93,7 @@ image_new_dialog_new (Gimp *gimp)
dialog->dialog = gimp_dialog_new (_("Create a New Image"),
"gimp-image-new",
NULL, 0,
gimp_standard_help_func,
GIMP_HELP_FILE_NEW,
gimp_standard_help_func, GIMP_HELP_FILE_NEW,
GIMP_STOCK_RESET, RESPONSE_RESET,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......@@ -273,8 +272,7 @@ image_new_confirm_dialog (ImageNewDialog *dialog)
dialog->confirm_dialog =
gimp_query_boolean_box (_("Confirm Image Size"),
dialog->dialog,
gimp_standard_help_func,
GIMP_HELP_FILE_NEW_CONFIRM,
gimp_standard_help_func, NULL,
GIMP_STOCK_INFO,
text,
GTK_STOCK_OK, GTK_STOCK_CANCEL,
......
......@@ -1500,6 +1500,9 @@ prefs_dialog_new (Gimp *gimp,
prefs_check_button_add (object, "show-tool-tips",
_("Show tool _tips"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "show-help-button",
_("Show help _buttons"),
GTK_BOX (vbox2));
prefs_check_button_add (object, "show-tips",
_("Show tips on _startup"),
GTK_BOX (vbox2));
......
......@@ -73,8 +73,7 @@ quit_dialog_new (Gimp *gimp)
dialog = gimp_dialog_new (_("Quit The GIMP"), "gimp-quit",
NULL, 0,
gimp_standard_help_func,
GIMP_HELP_FILE_QUIT_CONFIRM,
gimp_standard_help_func, NULL,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
_("_Discard Changes"), GTK_RESPONSE_OK,
......
......@@ -118,8 +118,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
dialog = gimp_dialog_new (title,
"gimp-display-shell-close",
GTK_WIDGET (shell), 0,
gimp_standard_help_func,
GIMP_HELP_FILE_CLOSE_CONFIRM,
gimp_standard_help_func, NULL,
_("Close _without Saving"), GTK_RESPONSE_CLOSE,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
......
......@@ -99,6 +99,9 @@ static gboolean gui_exit_after_callback (Gimp *gimp,
static void gui_show_tooltips_notify (GimpGuiConfig *gui_config,
GParamSpec *pspec,
Gimp *gimp);
static void gui_show_help_button_notify (GimpGuiConfig *gui_config,
GParamSpec *pspec,
Gimp *gimp);
static void gui_tearoff_menus_notify (GimpGuiConfig *gui_config,
GParamSpec *pspec,
GtkUIManager *manager);
......@@ -362,6 +365,16 @@ gui_restore_callback (Gimp *gimp,
G_CALLBACK (gui_show_tooltips_notify),
gimp);
gimp_dialogs_show_help_button (gui_config->use_help &&
gui_config->show_help_button);
g_signal_connect (gui_config, "notify::use-help",
G_CALLBACK (gui_show_help_button_notify),
gimp);
g_signal_connect (gui_config, "notify::show-help-button",
G_CALLBACK (gui_show_help_button_notify),
gimp);
g_signal_connect (gimp_get_user_context (gimp), "display_changed",
G_CALLBACK (gui_display_changed),
gimp);
......@@ -483,6 +496,10 @@ gui_exit_after_callback (Gimp *gimp,
if (gimp->be_verbose)
g_print ("EXIT: gui_exit_after_callback\n");
g_signal_handlers_disconnect_by_func (gimp->config,
gui_show_help_button_notify,
gimp);
g_signal_handlers_disconnect_by_func (gimp->config,
gui_show_tooltips_notify,
gimp);
......@@ -521,6 +538,15 @@ gui_show_tooltips_notify (GimpGuiConfig *gui_config,
gimp_help_disable_tooltips ();
}
static void
gui_show_help_button_notify (GimpGuiConfig *gui_config,
GParamSpec *param_spec,
Gimp *gimp)
{
gimp_dialogs_show_help_button (gui_config->use_help &&
gui_config->show_help_button);
}
static void
gui_tearoff_menus_notify (GimpGuiConfig *gui_config,
GParamSpec *pspec,
......
......@@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp,
if (plug_in)
{
GPConfig config;
GPProcRun proc_run;
gint monitor;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
if (! plug_in_open (plug_in))
{
......@@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp,
goto done;
}
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button);
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
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.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;
......
......@@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp,
if (plug_in)
{
GPConfig config;
GPProcRun proc_run;
gint monitor;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
if (! plug_in_open (plug_in))
{
......@@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp,
goto done;
}
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button);
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
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.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;
......
......@@ -93,9 +93,11 @@ plug_in_run (Gimp *gimp,
if (plug_in)
{
GPConfig config;
GPProcRun proc_run;
gint monitor;
GimpDisplayConfig *display_config = GIMP_DISPLAY_CONFIG (gimp->config);
GimpGuiConfig *gui_config = GIMP_GUI_CONFIG (gimp->config);
GPConfig config;
GPProcRun proc_run;
gint monitor;
if (! plug_in_open (plug_in))
{
......@@ -103,26 +105,27 @@ plug_in_run (Gimp *gimp,
goto done;
}
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_size;
config.check_type = GIMP_DISPLAY_CONFIG (gimp->config)->transparency_type;
config.gimp_reserved_3 = 0;
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
config.gimp_reserved_7 = 0;
config.gimp_reserved_8 = 0;
config.install_cmap = gimp->config->install_cmap;
config.show_tool_tips = GIMP_GUI_CONFIG (gimp->config)->show_tool_tips;
config.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
config.version = GIMP_PROTOCOL_VERSION;
config.tile_width = TILE_WIDTH;
config.tile_height = TILE_HEIGHT;
config.shm_ID = plug_in_shm_get_ID (gimp);
config.check_size = display_config->transparency_size;
config.check_type = display_config->transparency_type;
config.show_help_button = (gui_config->use_help &&
gui_config->show_help_button);
config.gimp_reserved_4 = 0;
config.gimp_reserved_5 = 0;
config.gimp_reserved_6 = 0;
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.min_colors = CLAMP (gimp->config->min_colors, 27, 256);
config.gdisp_ID = gdisp_ID;
config.app_name = (gchar *) g_get_application_name ();
config.wm_class = (gchar *) gimp_get_program_class (gimp);
config.display_name = gimp_get_display_name (gimp, gdisp_ID, &monitor);
config.monitor_number = monitor;
proc_run.name = proc_rec->name;
proc_run.nparams = argc;
......
......@@ -26,7 +26,6 @@
#define GIMP_HELP_MAIN "gimp-main"
#define GIMP_HELP_FILE_NEW "gimp-file-new"
#define GIMP_HELP_FILE_NEW_CONFIRM "gimp-file-new-confirm"
#define GIMP_HELP_FILE_OPEN "gimp-file-open"
#define GIMP_HELP_FILE_OPEN_AS_LAYER "gimp-file-open-as-layer"
#define GIMP_HELP_FILE_OPEN_LOCATION "gimp-file-open-location"
......@@ -37,12 +36,9 @@
#define GIMP_HELP_FILE_SAVE_A_COPY "gimp-file-save-a-copy"
#define GIMP_HELP_FILE_SAVE_AS_TEMPLATE "gimp-file-save-as-template"
#define GIMP_HELP_FILE_SAVE_BY_EXTENSION "gimp-file-save-by-extension"
#define GIMP_HELP_FILE_SAVE_OVERWRITE "gimp-file-save-overwrite"
#define GIMP_HELP_FILE_REVERT "gimp-file-revert"
#define GIMP_HELP_FILE_CLOSE "gimp-file-close"
#define GIMP_HELP_FILE_CLOSE_CONFIRM "gimp-file-close-confirm"
#define GIMP_HELP_FILE_QUIT "gimp-file-quit"
#define GIMP_HELP_FILE_QUIT_CONFIRM "gimp-file-quit-confirm"
#define GIMP_HELP_EDIT_UNDO "gimp-edit-undo"
#define GIMP_HELP_EDIT_REDO "gimp-edit-redo"
......
......@@ -35,6 +35,7 @@ gimp_gamma
gimp_install_cmap
gimp_min_colors
gimp_show_tool_tips
gimp_show_help_button
gimp_check_size
gimp_check_type
gimp_default_display
......@@ -159,6 +160,7 @@ gimp_invert
gimp_curves_spline
gimp_curves_explicit
gimp_color_balance
gimp_colorize
gimp_histogram
gimp_hue_saturation
gimp_threshold
......
......@@ -327,6 +327,14 @@ all other GIMP Library headers.
@Returns:
<!-- ##### FUNCTION gimp_show_help_button ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gimp_check_size ##### -->
<para>
......
......@@ -126,6 +126,18 @@ Functions for manipulating color, including curves and histograms.
@Returns:
<!-- ##### FUNCTION gimp_colorize ##### -->
<para>
</para>
@drawable_ID:
@hue:
@saturation:
@lightness:
@Returns:
<!-- ##### FUNCTION gimp_histogram ##### -->
<para>
......
......@@ -33,7 +33,7 @@ The communication protocol between GIMP and it's plug-ins.
@shm_ID:
@check_size:
@check_type:
@gimp_reserved_3:
@show_help_button:
@gimp_reserved_4:
@gimp_reserved_5:
@gimp_reserved_6:
......
......@@ -384,6 +384,7 @@ gimp_dialog_new
gimp_dialog_new_valist
gimp_dialog_add_buttons_valist
gimp_dialog_run
gimp_dialogs_show_help_button
<SUBSECTION Standard>
GIMP_TYPE_DIALOG
GIMP_DIALOG
......
......@@ -79,3 +79,11 @@ dialog-related stuff.
@Returns:
<!-- ##### FUNCTION gimp_dialogs_show_help_button ##### -->
<para>
</para>
@show:
......@@ -176,6 +176,7 @@ static guchar *_shm_addr = NULL;
static gdouble _gamma_val = 1.0;
static gboolean _install_cmap = FALSE;
static gboolean _show_tool_tips = TRUE;
static gboolean _show_help_button = TRUE;
static GimpCheckSize _check_size = GIMP_CHECK_SIZE_MEDIUM_CHECKS;
static GimpCheckType _check_type = GIMP_CHECK_TYPE_GRAY_CHECKS;
static gint _min_colors = 144;
......@@ -185,14 +186,14 @@ static gchar *_display_name = NULL;
static gint _monitor_number = 0;
static const gchar *progname = NULL;
static guint8 write_buffer[WRITE_BUFFER_SIZE];
static guint write_buffer_index = 0;
static guint8 write_buffer[WRITE_BUFFER_SIZE];
static guint write_buffer_index = 0;
static GimpStackTraceMode stack_trace_mode = GIMP_STACK_TRACE_NEVER;
static GHashTable *temp_proc_ht = NULL;
static GHashTable *temp_proc_ht = NULL;
static guint gimp_debug_flags = 0;
static guint gimp_debug_flags = 0;
static const GDebugKey gimp_debug_keys[] =
{
......@@ -1113,6 +1114,22 @@ gimp_show_tool_tips (void)
return _show_tool_tips;
}
/**
* gimp_show_help_button:
*
* Returns whether or not GimpDialog should automatically add a help
* button if help_func and help_id are given.
*
* Return value: the show_help_button boolean
*
* Since: GIMP 2.2
**/
gboolean
gimp_show_help_button (void)
{
return _show_help_button;
}
/**
* gimp_check_size:
*
......@@ -1634,18 +1651,19 @@ gimp_config (GPConfig *config)
gimp_quit ();
}
_tile_width = config->tile_width;
_tile_height = config->tile_height;
_shm_ID = config->shm_ID;
_check_size = config->check_size;
_check_type = config->check_type;
_install_cmap = config->install_cmap;
_show_tool_tips = config->show_tool_tips;
_min_colors = config->min_colors;
_gdisp_ID = config->gdisp_ID;
_wm_class = g_strdup (config->wm_class);
_display_name = g_strdup (config->display_name);
_monitor_number = config->monitor_number;
_tile_width = config->tile_width;
_tile_height = config->tile_height;
_shm_ID = config->shm_ID;
_check_size = config->check_size;
_check_type = config->check_type;
_install_cmap = config->install_cmap;
_show_tool_tips = config->show_tool_tips;
_show_help_button = config->show_help_button;
_min_colors = config->min_colors;
_gdisp_ID = config->gdisp_ID;
_wm_class = g_strdup (config->wm_class);
_display_name = g_strdup (config->display_name);
_monitor_number = config->monitor_number;
if (config->app_name)
g_set_application_name (config->app_name);
......
......@@ -461,6 +461,7 @@ EXPORTS
gimp_shear
gimp_shm_ID
gimp_shm_addr
gimp_show_help_button
gimp_show_tool_tips
gimp_smudge
gimp_smudge_default
......
......@@ -315,6 +315,7 @@ gdouble gimp_gamma (void) G_GNUC_CONST;
gboolean gimp_install_cmap (void) G_GNUC_CONST;
gint gimp_min_colors (void) G_GNUC_CONST;
gboolean gimp_show_tool_tips (void) G_GNUC_CONST;
gboolean gimp_show_help_button (void) G_GNUC_CONST;
GimpCheckSize gimp_check_size (void) G_GNUC_CONST;
GimpCheckType gimp_check_type (void) G_GNUC_CONST;
gint32 gimp_default_display (void) G_GNUC_CONST;
......
......@@ -114,6 +114,8 @@ gimp_ui_init (const gchar *prog_name,
if (! gimp_show_tool_tips ())
gimp_help_disable_tooltips ();
gimp_dialogs_show_help_button (gimp_show_help_button ());
initialized = TRUE;
}
......
......@@ -472,7 +472,7 @@ _gp_config_read (GIOChannel *channel,
(guint8 *) &config->check_type, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_3, 1, user_data))
(guint8 *) &config->show_help_button, 1, user_data))
goto cleanup;
if (! wire_read_int8 (channel,
(guint8 *) &config->gimp_reserved_4, 1, user_data))
......@@ -545,7 +545,7 @@ _gp_config_write (GIOChannel *channel,
return;
if (! wire_write_int8 (channel, (guint8*) &config->check_type, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_3, 1, user_data))
if (! wire_write_int8 (channel, (guint8*) &config->show_help_button, 1, user_data))
return;
if (! wire_write_int8 (channel, (guint8*) &config->gimp_reserved_4, 1, user_data))
return;
......
......@@ -68,7 +68,7 @@ struct _GPConfig
gint32 shm_ID;
gint8 check_size;
gint8 check_type;
gint8 gimp_reserved_3;
gint8 show_help_button;
gint8 gimp_reserved_4;
gint8 gimp_reserved_5;
gint8 gimp_reserved_6;
......@@ -86,9 +86,9 @@ struct _GPConfig
struct _GPTileReq
{
gint32 drawable_ID;
guint32 tile_num;
guint32 shadow;
gint32 drawable_ID;
guint32 tile_num;
guint32 shadow;
};
struct _GPTileData
......
......@@ -56,9 +56,11 @@ static void gimp_dialog_get_property (GObject *object,
static gboolean gimp_dialog_delete_event (GtkWidget *widget,
GdkEventAny *event);
static void gimp_dialog_close (GtkDialog *dialog);
static void gimp_dialog_help (GObject *dialog);
static GtkDialogClass *parent_class = NULL;
static GtkDialogClass *parent_class = NULL;
static gboolean show_help_button = TRUE;
GType
......@@ -145,6 +147,23 @@ gimp_dialog_constructor (GType type,
if (help_func)
gimp_help_connect (GTK_WIDGET (object), help_func, help_id, object);
if (show_help_button && help_func && help_id)
{
GtkDialog *dialog = GTK_DIALOG (object);
GtkWidget *button = gtk_button_new_from_stock (GTK_STOCK_HELP);
gtk_box_pack_end (GTK_BOX (dialog->action_area), button, FALSE, TRUE, 0);
gtk_button_box_set_child_secondary (GTK_BUTTON_BOX (dialog->action_area),
button, TRUE);
gtk_widget_show (button);
g_signal_connect_object (button, "clicked",
G_CALLBACK (gimp_dialog_help),
dialog, G_CONNECT_SWAPPED);
g_object_set_data (object, "gimp-dialog-help-button", button);
}
return object;
}
......@@ -227,6 +246,15 @@ gimp_dialog_close (GtkDialog *dialog)
}
}
static void
gimp_dialog_help (GObject *dialog)
{
GimpHelpFunc help_func = g_object_get_data (dialog, "gimp-dialog-help-func");
if (help_func)
help_func (g_object_get_data (dialog, "gimp-dialog-help-id"), dialog);
}
/**
* gimp_dialog_new:
......@@ -367,13 +395,22 @@ gimp_dialog_add_buttons_valist (GimpDialog *dialog,
{
response_id = va_arg (args, gint);
gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id);
/* suppress a help button if we added one already */
if ((response_id != GTK_RESPONSE_HELP) ||
(! g_object_get_data (G_OBJECT (dialog), "gimp-dialog-help-button")))
{
gtk_dialog_add_button (GTK_DIALOG (dialog), button_text, response_id);
}
if (response_id == GTK_RESPONSE_OK)
gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
{
gtk_dialog_set_default_response (GTK_DIALOG (dialog),
GTK_RESPONSE_OK);
}
}
}
typedef struct
{
GtkDialog *dialog;
......@@ -485,3 +522,17 @@ gimp_dialog_run (GimpDialog *dialog)
return ri.response_id;