From 176fb24579d57f8c115d989fe25a46da0ea2bbcf Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 28 Aug 2008 14:30:47 +0000 Subject: [PATCH] allow to disable the Wilber image shown at the top of the toolbox. 2008-08-28 Sven Neumann * app/config/gimpguiconfig.[ch]: allow to disable the Wilber image shown at the top of the toolbox. * app/widgets/gimptoolbox.c: honor the new gimprc option. * app/config/gimprc-blurbs.h: document the old and new toolbox preferences. svn path=/trunk/; revision=26800 --- ChangeLog | 10 +++++ app/config/gimpguiconfig.c | 14 ++++++- app/config/gimpguiconfig.h | 1 + app/config/gimprc-blurbs.h | 14 +++++-- app/widgets/gimptoolbox.c | 77 +++++++++++++++++++++++++------------- 5 files changed, 85 insertions(+), 31 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a63e1aac5..3b976537ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-08-28 Sven Neumann + + * app/config/gimpguiconfig.[ch]: allow to disable the Wilber image + shown at the top of the toolbox. + + * app/widgets/gimptoolbox.c: honor the new gimprc option. + + * app/config/gimprc-blurbs.h: document the old and new toolbox + preferences. + 2008-08-28 Michael Natterer * app/tools/gimprectangletool.c: some tiny formatting fixes. diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c index 5c1e7a683f..85ceac5ed8 100644 --- a/app/config/gimpguiconfig.c +++ b/app/config/gimpguiconfig.c @@ -70,6 +70,7 @@ enum PROP_TOOLBOX_COLOR_AREA, PROP_TOOLBOX_FOO_AREA, PROP_TOOLBOX_IMAGE_AREA, + PROP_TOOLBOX_WILBER, PROP_THEME_PATH, PROP_THEME, PROP_USE_HELP, @@ -196,6 +197,11 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass) TOOLBOX_IMAGE_AREA_BLURB, FALSE, GIMP_PARAM_STATIC_STRINGS); + GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TOOLBOX_WILBER, + "toolbox-wilber", + TOOLBOX_WILBER_BLURB, + TRUE, + GIMP_PARAM_STATIC_STRINGS); path = gimp_config_build_data_path ("themes"); GIMP_CONFIG_INSTALL_PROP_PATH (object_class, PROP_THEME_PATH, "theme-path", THEME_PATH_BLURB, @@ -347,7 +353,10 @@ gimp_gui_config_set_property (GObject *object, case PROP_TOOLBOX_IMAGE_AREA: gui_config->toolbox_image_area = g_value_get_boolean (value); break; - case PROP_THEME_PATH: + case PROP_TOOLBOX_WILBER: + gui_config->toolbox_wilber = g_value_get_boolean (value); + break; + case PROP_THEME_PATH: g_free (gui_config->theme_path); gui_config->theme_path = g_value_dup_string (value); break; @@ -462,6 +471,9 @@ gimp_gui_config_get_property (GObject *object, case PROP_TOOLBOX_IMAGE_AREA: g_value_set_boolean (value, gui_config->toolbox_image_area); break; + case PROP_TOOLBOX_WILBER: + g_value_set_boolean (value, gui_config->toolbox_wilber); + break; case PROP_THEME_PATH: g_value_set_string (value, gui_config->theme_path); break; diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h index 6e53ed6d4f..a54c4eee95 100644 --- a/app/config/gimpguiconfig.h +++ b/app/config/gimpguiconfig.h @@ -58,6 +58,7 @@ struct _GimpGuiConfig gboolean toolbox_color_area; gboolean toolbox_foo_area; gboolean toolbox_image_area; + gboolean toolbox_wilber; gchar *theme_path; gchar *theme; gboolean use_help; diff --git a/app/config/gimprc-blurbs.h b/app/config/gimprc-blurbs.h index 95df4cb7c5..7fbb69857e 100644 --- a/app/config/gimprc-blurbs.h +++ b/app/config/gimprc-blurbs.h @@ -386,9 +386,17 @@ N_("When the amount of pixel data exceeds this limit, GIMP will start to " \ "work on images that wouldn't fit into memory otherwise. If you have a " \ "lot of RAM, you may want to set this to a higher value.") -#define TOOLBOX_COLOR_AREA_BLURB NULL -#define TOOLBOX_FOO_AREA_BLURB NULL -#define TOOLBOX_IMAGE_AREA_BLURB NULL +#define TOOLBOX_COLOR_AREA_BLURB \ +N_("Show the current foreground and background colors in the toolbox.") + +#define TOOLBOX_FOO_AREA_BLURB \ +N_("Show the currently selected brush, pattern and gradient in the toolbox.") + +#define TOOLBOX_IMAGE_AREA_BLURB \ +N_("Show the currently active image in the toolbox.") + +#define TOOLBOX_WILBER_BLURB \ +"Show the GIMP mascot at the top of the toolbox." #define TOOLBOX_WINDOW_HINT_BLURB \ N_("The window type hint that is set on the toolbox. This may affect " \ diff --git a/app/widgets/gimptoolbox.c b/app/widgets/gimptoolbox.c index 4ea95a27ad..a83beb7a97 100644 --- a/app/widgets/gimptoolbox.c +++ b/app/widgets/gimptoolbox.c @@ -97,34 +97,38 @@ static GtkWidget * toolbox_create_foo_area (GimpToolbox *toolbox, static GtkWidget * toolbox_create_image_area (GimpToolbox *toolbox, GimpContext *context); -static void toolbox_area_notify (GimpGuiConfig *config, - GParamSpec *pspec, - GtkWidget *area); -static void toolbox_tool_changed (GimpContext *context, - GimpToolInfo *tool_info, - gpointer data); +static void toolbox_area_notify (GimpGuiConfig *config, + GParamSpec *pspec, + GtkWidget *area); +static void toolbox_wilber_notify (GimpGuiConfig *config, + GParamSpec *pspec, + GtkWidget *wilber); -static void toolbox_tool_reorder (GimpContainer *container, - GimpToolInfo *tool_info, - gint index, - GtkWidget *wrap_box); -static void toolbox_tool_visible_notify (GimpToolInfo *tool_info, - GParamSpec *pspec, - GtkWidget *button); +static void toolbox_tool_changed (GimpContext *context, + GimpToolInfo *tool_info, + gpointer data); -static void toolbox_tool_button_toggled (GtkWidget *widget, - GimpToolInfo *tool_info); -static gboolean toolbox_tool_button_press (GtkWidget *widget, - GdkEventButton *bevent, - GimpToolbox *toolbox); +static void toolbox_tool_reorder (GimpContainer *container, + GimpToolInfo *tool_info, + gint index, + GtkWidget *wrap_box); +static void toolbox_tool_visible_notify (GimpToolInfo *tool_info, + GParamSpec *pspec, + GtkWidget *button); -static gboolean toolbox_check_device (GtkWidget *widget, - GdkEvent *event, - Gimp *gimp); +static void toolbox_tool_button_toggled (GtkWidget *widget, + GimpToolInfo *tool_info); +static gboolean toolbox_tool_button_press (GtkWidget *widget, + GdkEventButton *bevent, + GimpToolbox *toolbox); -static void toolbox_paste_received (GtkClipboard *clipboard, - const gchar *text, - gpointer data); +static gboolean toolbox_check_device (GtkWidget *widget, + GdkEvent *event, + Gimp *gimp); + +static void toolbox_paste_received (GtkClipboard *clipboard, + const gchar *text, + gpointer data); G_DEFINE_TYPE (GimpToolbox, gimp_toolbox, GIMP_TYPE_IMAGE_DOCK) @@ -210,11 +214,17 @@ gimp_toolbox_constructor (GType type, gtk_frame_set_shadow_type (GTK_FRAME (toolbox->header), GTK_SHADOW_NONE); gtk_box_pack_start (GTK_BOX (toolbox->vbox), toolbox->header, FALSE, FALSE, 0); - gtk_widget_show (toolbox->header); + + if (config->toolbox_wilber) + gtk_widget_show (toolbox->header); gimp_help_set_help_data (toolbox->header, _("Drop image files here to open them"), NULL); + g_signal_connect_object (config, "notify::toolbox-wilber", + G_CALLBACK (toolbox_wilber_notify), + toolbox->header, 0); + toolbox->tool_wbox = gtk_hwrap_box_new (FALSE); gtk_wrap_box_set_justify (GTK_WRAP_BOX (toolbox->tool_wbox), GTK_JUSTIFY_TOP); gtk_wrap_box_set_line_justify (GTK_WRAP_BOX (toolbox->tool_wbox), @@ -498,7 +508,8 @@ gimp_toolbox_expose_event (GtkWidget *widget, GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - if (gdk_rectangle_intersect (&event->area, + if (GTK_WIDGET_VISIBLE (toolbox->header) && + gdk_rectangle_intersect (&event->area, &toolbox->header->allocation, &clip_rect)) { @@ -586,7 +597,8 @@ gimp_toolbox_set_geometry (GimpToolbox *toolbox) gtk_widget_set_size_request (toolbox->header, -1, - button_requisition.height * PANGO_SCALE_SMALL); + button_requisition.height * + PANGO_SCALE_SMALL); border_width = gtk_container_get_border_width (GTK_CONTAINER (main_vbox)); @@ -831,6 +843,17 @@ toolbox_area_notify (GimpGuiConfig *config, g_object_set (area, "visible", visible, NULL); } +static void +toolbox_wilber_notify (GimpGuiConfig *config, + GParamSpec *pspec, + GtkWidget *wilber) +{ + gboolean visible; + + g_object_get (config, pspec->name, &visible, NULL); + g_object_set (wilber, "visible", visible, NULL); +} + static void toolbox_tool_changed (GimpContext *context, GimpToolInfo *tool_info,