mirror of https://github.com/GNOME/gimp.git
app: properly resize the GimpFgBgEditor when changing icon size.
This is the needed improvements I was talking about in commit 00fbcbea0b
. Right
now, when changing the icon size, the FG/BG color widget was not immediately
resizing. It needed a restart of GIMP.
Now it will properly react to "style-updated" signal, but also to "theme"
property of GimpGuiConfig.
The reset of the color icon pixbufs is also needed when GimpFgBgEditor size is
re-allocated.
This commit is contained in:
parent
dfbaf4d501
commit
624493af4b
|
@ -83,6 +83,8 @@ static void
|
|||
gint *minimum_width,
|
||||
gint *natural_width);
|
||||
|
||||
static void gimp_fg_bg_editor_size_allocate (GtkWidget *editor,
|
||||
GtkAllocation *allocation);
|
||||
static void gimp_fg_bg_editor_style_updated (GtkWidget *widget);
|
||||
static gboolean gimp_fg_bg_editor_draw (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
|
@ -190,6 +192,7 @@ gimp_fg_bg_editor_class_init (GimpFgBgEditorClass *klass)
|
|||
|
||||
widget_class->get_request_mode = gimp_fg_bg_editor_get_request_mode;
|
||||
widget_class->get_preferred_width_for_height = gimp_fg_bg_editor_get_preferred_width_for_height;
|
||||
widget_class->size_allocate = gimp_fg_bg_editor_size_allocate;
|
||||
widget_class->style_updated = gimp_fg_bg_editor_style_updated;
|
||||
widget_class->draw = gimp_fg_bg_editor_draw;
|
||||
widget_class->button_press_event = gimp_fg_bg_editor_button_press;
|
||||
|
@ -311,6 +314,15 @@ gimp_fg_bg_editor_get_preferred_width_for_height (GtkWidget *widget,
|
|||
*natural_width = height;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_fg_bg_editor_size_allocate (GtkWidget *widget,
|
||||
GtkAllocation *allocation)
|
||||
{
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
gimp_fg_bg_editor_style_updated (widget);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_fg_bg_editor_style_updated (GtkWidget *widget)
|
||||
{
|
||||
|
|
|
@ -121,10 +121,18 @@ static void gimp_toolbox_book_added (GimpDock *dock,
|
|||
GimpDockbook *dockbook);
|
||||
static void gimp_toolbox_book_removed (GimpDock *dock,
|
||||
GimpDockbook *dockbook);
|
||||
|
||||
static void gimp_toolbox_notify_theme (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
GimpToolbox *toolbox);
|
||||
|
||||
static void gimp_toolbox_palette_style_updated (GtkWidget *palette,
|
||||
GimpToolbox *toolbox);
|
||||
|
||||
static void gimp_toolbox_wilber_style_updated (GtkWidget *widget,
|
||||
GimpToolbox *toolbox);
|
||||
static gboolean gimp_toolbox_draw_wilber (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static gboolean gimp_toolbox_draw_wilber (GtkWidget *widget,
|
||||
cairo_t *cr);
|
||||
static GtkWidget * toolbox_create_color_area (GimpToolbox *toolbox,
|
||||
GimpContext *context);
|
||||
static GtkWidget * toolbox_create_foo_area (GimpToolbox *toolbox,
|
||||
|
@ -564,6 +572,33 @@ gimp_toolbox_set_drag_handler (GimpToolbox *toolbox,
|
|||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_toolbox_notify_theme (GimpGuiConfig *config,
|
||||
GParamSpec *pspec,
|
||||
GimpToolbox *toolbox)
|
||||
{
|
||||
gimp_toolbox_palette_style_updated (GTK_WIDGET (toolbox->p->tool_palette), toolbox);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_toolbox_palette_style_updated (GtkWidget *widget,
|
||||
GimpToolbox *toolbox)
|
||||
{
|
||||
GtkIconSize tool_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
gint icon_width = 40;
|
||||
gint icon_height = 38;
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"tool-icon-size", &tool_icon_size,
|
||||
NULL);
|
||||
gtk_icon_size_lookup (tool_icon_size, &icon_width, &icon_height);
|
||||
|
||||
gtk_widget_set_size_request (toolbox->p->color_area,
|
||||
(gint) (icon_width * 1.75),
|
||||
(gint) (icon_height * 1.75));
|
||||
gtk_widget_queue_resize (toolbox->p->color_area);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_toolbox_wilber_style_updated (GtkWidget *widget,
|
||||
GimpToolbox *toolbox)
|
||||
|
@ -614,6 +649,13 @@ toolbox_create_color_area (GimpToolbox *toolbox,
|
|||
"margin-bottom", 2,
|
||||
NULL);
|
||||
|
||||
g_signal_connect (toolbox->p->tool_palette, "style-updated",
|
||||
G_CALLBACK (gimp_toolbox_palette_style_updated),
|
||||
toolbox);
|
||||
g_signal_connect_after (GIMP_GUI_CONFIG (toolbox->p->context->gimp->config),
|
||||
"notify::theme",
|
||||
G_CALLBACK (gimp_toolbox_notify_theme),
|
||||
toolbox);
|
||||
return col_area;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue