[gimp] app: add icon size auto-guess from monitor resolution.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: add icon size auto-guess from monitor resolution.
- Date: Tue, 21 Mar 2017 16:53:06 +0000 (UTC)
commit d339aef75c457777a0bac53748d90a9130f4ac27
Author: Jehan <jehan girinstud io>
Date: Fri Mar 17 05:52:20 2017 +0100
app: add icon size auto-guess from monitor resolution.
Current code only guess resolution for a single monitor. Ideally
the widget sizes could be different depending on the window where a
given widget is on. But that's a start.
app/config/config-enums.h | 11 +++--
app/config/gimpguiconfig.c | 82 +++++++++++++++++++++++++++++++++++-
app/config/gimpguiconfig.h | 3 +
app/widgets/gimpdockbook.c | 24 ++++-------
app/widgets/gimpeditor.c | 24 +++++------
app/widgets/gimpiconsizescale.c | 88 +++++++++++++++++++++++----------------
app/widgets/gimptoolpalette.c | 26 +++++------
7 files changed, 173 insertions(+), 85 deletions(-)
---
diff --git a/app/config/config-enums.h b/app/config/config-enums.h
index 7f05e9d..f75c0eb 100644
--- a/app/config/config-enums.h
+++ b/app/config/config-enums.h
@@ -84,11 +84,12 @@ GType gimp_icon_size_get_type (void) G_GNUC_CONST;
typedef enum
{
- GIMP_ICON_SIZE_DEFAULT, /*< desc="Default size" > */
- GIMP_ICON_SIZE_SMALL, /*< desc="Small size" > */
- GIMP_ICON_SIZE_MEDIUM, /*< desc="Medium size" > */
- GIMP_ICON_SIZE_LARGE, /*< desc="Large size" > */
- GIMP_ICON_SIZE_HUGE /*< desc="Huge size" > */
+ GIMP_ICON_SIZE_AUTO, /*< desc="Guess ideal size" > */
+ GIMP_ICON_SIZE_THEME, /*< desc="Theme-set size" > */
+ GIMP_ICON_SIZE_SMALL, /*< desc="Small size" > */
+ GIMP_ICON_SIZE_MEDIUM, /*< desc="Medium size" > */
+ GIMP_ICON_SIZE_LARGE, /*< desc="Large size" > */
+ GIMP_ICON_SIZE_HUGE /*< desc="Huge size" > */
} GimpIconSize;
diff --git a/app/config/gimpguiconfig.c b/app/config/gimpguiconfig.c
index 3e31ff8..2ffb732 100644
--- a/app/config/gimpguiconfig.c
+++ b/app/config/gimpguiconfig.c
@@ -27,6 +27,8 @@
#include "config-types.h"
+#include "core/gimpmarshal.h"
+
#include "gimprc-blurbs.h"
#include "gimpguiconfig.h"
@@ -45,6 +47,12 @@
enum
{
+ SIZE_CHANGED,
+ LAST_SIGNAL
+};
+
+enum
+{
PROP_0,
PROP_MOVE_TOOL_CHANGES_ACTIVE,
PROP_FILTER_TOOL_MAX_RECENT,
@@ -114,11 +122,15 @@ static void gimp_gui_config_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
+static void monitor_resolution_changed (GimpDisplayConfig *display_config,
+ GParamSpec *pspec,
+ GimpGuiConfig *gui_config);
G_DEFINE_TYPE (GimpGuiConfig, gimp_gui_config, GIMP_TYPE_DISPLAY_CONFIG)
#define parent_class gimp_gui_config_parent_class
+static guint signals[LAST_SIGNAL] = { 0, };
static void
gimp_gui_config_class_init (GimpGuiConfigClass *klass)
@@ -126,6 +138,15 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
gchar *path;
+ signals[SIZE_CHANGED] =
+ g_signal_new ("size-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpGuiConfigClass, size_changed),
+ NULL, NULL,
+ gimp_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
object_class->finalize = gimp_gui_config_finalize;
object_class->set_property = gimp_gui_config_set_property;
object_class->get_property = gimp_gui_config_get_property;
@@ -310,7 +331,7 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
"icon-size",
ICON_SIZE_BLURB,
GIMP_TYPE_ICON_SIZE,
- GIMP_ICON_SIZE_DEFAULT,
+ GIMP_ICON_SIZE_AUTO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_HELP,
@@ -619,7 +640,26 @@ gimp_gui_config_set_property (GObject *object,
gui_config->icon_theme = g_value_dup_string (value);
break;
case PROP_ICON_SIZE:
- gui_config->icon_size = g_value_get_enum (value);
+ {
+ GimpIconSize size = g_value_get_enum (value);
+
+ g_signal_handlers_disconnect_by_func (GIMP_DISPLAY_CONFIG (gui_config),
+ G_CALLBACK (monitor_resolution_changed),
+ gui_config);
+ if (size == GIMP_ICON_SIZE_AUTO)
+ {
+ g_signal_connect (GIMP_DISPLAY_CONFIG (gui_config),
+ "notify::monitor-xresolution",
+ G_CALLBACK (monitor_resolution_changed),
+ gui_config);
+ g_signal_connect (GIMP_DISPLAY_CONFIG (gui_config),
+ "notify::monitor-yresolution",
+ G_CALLBACK (monitor_resolution_changed),
+ gui_config);
+ }
+ gui_config->icon_size = size;
+ g_signal_emit (gui_config, signals[SIZE_CHANGED], 0);
+ }
break;
case PROP_USE_HELP:
gui_config->use_help = g_value_get_boolean (value);
@@ -850,3 +890,41 @@ gimp_gui_config_get_property (GObject *object,
break;
}
}
+
+static void
+monitor_resolution_changed (GimpDisplayConfig *display_config,
+ GParamSpec *pspec,
+ GimpGuiConfig *gui_config)
+{
+ if (gui_config->icon_size == GIMP_ICON_SIZE_AUTO)
+ {
+ g_signal_emit (gui_config, signals[SIZE_CHANGED], 0);
+ }
+}
+
+GimpIconSize
+gimp_gui_config_detect_icon_size (GimpGuiConfig *gui_config)
+{
+ GimpIconSize size = gui_config->icon_size;
+
+ if (size == GIMP_ICON_SIZE_AUTO)
+ {
+ GimpDisplayConfig *display_config;
+
+ display_config = GIMP_DISPLAY_CONFIG (gui_config);
+
+ if (display_config->monitor_xres < 100.0 ||
+ display_config->monitor_yres < 100.0)
+ size = GIMP_ICON_SIZE_SMALL;
+ else if (display_config->monitor_xres < 192.0 ||
+ display_config->monitor_yres < 192.0)
+ size = GIMP_ICON_SIZE_MEDIUM;
+ else if (display_config->monitor_xres < 300.0 ||
+ display_config->monitor_yres < 300.0)
+ size = GIMP_ICON_SIZE_LARGE;
+ else
+ size = GIMP_ICON_SIZE_HUGE;
+ }
+
+ return size;
+}
diff --git a/app/config/gimpguiconfig.h b/app/config/gimpguiconfig.h
index b9e5952..d4c6c6c 100644
--- a/app/config/gimpguiconfig.h
+++ b/app/config/gimpguiconfig.h
@@ -92,10 +92,13 @@ struct _GimpGuiConfig
struct _GimpGuiConfigClass
{
GimpDisplayConfigClass parent_class;
+
+ void (* size_changed) (GimpGuiConfig *config);
};
GType gimp_gui_config_get_type (void) G_GNUC_CONST;
+GimpIconSize gimp_gui_config_detect_icon_size (GimpGuiConfig *config);
#endif /* GIMP_GUI_CONFIG_H__ */
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index f39605f..6b19c91 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -182,8 +182,7 @@ static void gimp_dockbook_help_func (const gchar *h
gpointer help_data);
static const gchar *gimp_dockbook_get_tab_style_name (GimpTabStyle tab_style);
-static void gimp_dockbook_tab_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
+static void gimp_dockbook_config_size_changed (GimpGuiConfig *config,
GimpDockbook *dockbook);
@@ -342,7 +341,7 @@ gimp_dockbook_finalize (GObject *object)
if (dockbook->p->dock)
{
g_signal_handlers_disconnect_by_func (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
- G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ G_CALLBACK (gimp_dockbook_config_size_changed),
dockbook);
dockbook->p->dock = NULL;
}
@@ -910,13 +909,13 @@ gimp_dockbook_set_dock (GimpDockbook *dockbook,
if (dockbook->p->dock && gimp_dock_get_context (dockbook->p->dock))
g_signal_handlers_disconnect_by_func (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
- G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ G_CALLBACK (gimp_dockbook_config_size_changed),
dockbook);
dockbook->p->dock = dock;
if (dock)
g_signal_connect (gimp_dock_get_context (dockbook->p->dock)->gimp->config,
- "notify::icon-size",
- G_CALLBACK (gimp_dockbook_tab_icon_size_notify),
+ "size-changed",
+ G_CALLBACK (gimp_dockbook_config_size_changed),
dockbook);
}
@@ -1612,9 +1611,7 @@ gimp_dockbook_get_tab_icon_size (GimpDockbook *dockbook)
gimp = gimp_dock_get_context (dockbook->p->dock)->gimp;
- g_object_get (GIMP_GUI_CONFIG (gimp->config),
- "icon-size", &size, NULL);
-
+ size = gimp_gui_config_detect_icon_size (GIMP_GUI_CONFIG (gimp->config));
/* Match GimpIconSize with GtkIconSize. */
switch (size)
{
@@ -1653,9 +1650,7 @@ gimp_dockbook_get_tab_border (GimpDockbook *dockbook)
"tab-border", &tab_border,
NULL);
- g_object_get (GIMP_GUI_CONFIG (gimp->config),
- "icon-size", &size, NULL);
-
+ size = gimp_gui_config_detect_icon_size (GIMP_GUI_CONFIG (gimp->config));
/* Match GimpIconSize with GtkIconSize. */
switch (size)
{
@@ -1759,9 +1754,8 @@ gimp_dockbook_get_tab_style_name (GimpTabStyle tab_style)
}
static void
-gimp_dockbook_tab_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
- GimpDockbook *dockbook)
+gimp_dockbook_config_size_changed (GimpGuiConfig *config,
+ GimpDockbook *dockbook)
{
gimp_dockbook_recreate_tab_widgets (dockbook, TRUE);
}
diff --git a/app/widgets/gimpeditor.c b/app/widgets/gimpeditor.c
index c49e1b4..9770add 100644
--- a/app/widgets/gimpeditor.c
+++ b/app/widgets/gimpeditor.c
@@ -106,8 +106,7 @@ static void gimp_editor_get_styling (GimpEditor *editor,
GtkIconSize *button_icon_size,
gint *button_spacing,
GtkReliefStyle *button_relief);
-static void gimp_editor_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
+static void gimp_editor_config_size_changed (GimpGuiConfig *config,
GimpEditor *editor);
@@ -255,8 +254,8 @@ gimp_editor_constructed (GObject *object)
editor->priv->popup_data,
FALSE);
g_signal_connect (editor->priv->ui_manager->gimp->config,
- "notify::icon-size",
- G_CALLBACK (gimp_editor_icon_size_notify),
+ "size-changed",
+ G_CALLBACK (gimp_editor_config_size_changed),
editor);
}
}
@@ -281,7 +280,7 @@ gimp_editor_dispose (GObject *object)
if (editor->priv->ui_manager)
{
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
- G_CALLBACK (gimp_editor_icon_size_notify),
+ G_CALLBACK (gimp_editor_config_size_changed),
editor);
g_object_unref (editor->priv->ui_manager);
editor->priv->ui_manager = NULL;
@@ -385,7 +384,7 @@ gimp_editor_style_set (GtkWidget *widget,
if (editor->priv->ui_manager)
config = GIMP_GUI_CONFIG (editor->priv->ui_manager->gimp->config);
- gimp_editor_icon_size_notify (config, NULL, editor);
+ gimp_editor_config_size_changed (config, editor);
}
static GimpUIManager *
@@ -459,7 +458,7 @@ gimp_editor_create_menu (GimpEditor *editor,
if (editor->priv->ui_manager)
{
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
- G_CALLBACK (gimp_editor_icon_size_notify),
+ G_CALLBACK (gimp_editor_config_size_changed),
editor);
g_object_unref (editor->priv->ui_manager);
}
@@ -469,8 +468,8 @@ gimp_editor_create_menu (GimpEditor *editor,
popup_data,
FALSE);
g_signal_connect (editor->priv->ui_manager->gimp->config,
- "notify::icon-size",
- G_CALLBACK (gimp_editor_icon_size_notify),
+ "size-changed",
+ G_CALLBACK (gimp_editor_config_size_changed),
editor);
if (editor->priv->ui_path)
@@ -928,7 +927,7 @@ gimp_editor_get_styling (GimpEditor *editor,
/* Check if we should override theme styling. */
if (config)
{
- g_object_get (config, "icon-size", &size, NULL);
+ size = gimp_gui_config_detect_icon_size (config);
switch (size)
{
case GIMP_ICON_SIZE_SMALL:
@@ -956,9 +955,8 @@ gimp_editor_get_styling (GimpEditor *editor,
}
static void
-gimp_editor_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
- GimpEditor *editor)
+gimp_editor_config_size_changed (GimpGuiConfig *config,
+ GimpEditor *editor)
{
gint content_spacing;
GtkIconSize button_icon_size;
diff --git a/app/widgets/gimpiconsizescale.c b/app/widgets/gimpiconsizescale.c
index ad9f4e6..541eaa7 100644
--- a/app/widgets/gimpiconsizescale.c
+++ b/app/widgets/gimpiconsizescale.c
@@ -50,7 +50,7 @@ struct _GimpIconSizeScalePrivate
Gimp *gimp;
GtkWidget *scale;
- GtkWidget *checkbox;
+ GtkWidget *combo;
};
#define GET_PRIVATE(scale) \
@@ -78,8 +78,8 @@ static void gimp_icon_size_scale_icon_size_notify (GimpGuiConfig *config,
GParamSpec *pspec,
GtkWidget *size_scale);
-/* Signals on the checkbox. */
-static void gimp_icon_size_scale_checkbox_toggled (GtkToggleButton *checkbox,
+/* Signals on the combo. */
+static void gimp_icon_size_scale_combo_changed (GtkComboBox *combo,
GimpGuiConfig *config);
/* Signals on the GtkScale. */
static void gimp_icon_size_scale_value_changed (GtkRange *range,
@@ -119,9 +119,15 @@ static void
gimp_icon_size_scale_init (GimpIconSizeScale *object)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
+ GtkWidget *box;
- private->checkbox = gtk_check_button_new_with_label (_("Override theme icon sizes"));
- gtk_frame_set_label_widget (GTK_FRAME (object), private->checkbox);
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
+ gtk_frame_set_label_widget (GTK_FRAME (object), box);
+ private->combo = gimp_int_combo_box_new (_("Guess icon size from resolution"), 0,
+ _("Use icon size from the theme"), 1,
+ _("Custom icon size"), 2, NULL);
+ gtk_box_pack_start (GTK_BOX (box), private->combo, FALSE, FALSE, 0);
+ gtk_widget_show (box);
private->scale = gtk_hscale_new_with_range (0.0, 3.0, 1.0);
/* 'draw_value' updates round_digits. So set it first. */
@@ -138,8 +144,8 @@ gimp_icon_size_scale_constructed (GObject *object)
G_OBJECT_CLASS (parent_class)->constructed (object);
- g_signal_connect (private->checkbox, "toggled",
- G_CALLBACK (gimp_icon_size_scale_checkbox_toggled),
+ g_signal_connect (private->combo, "changed",
+ G_CALLBACK (gimp_icon_size_scale_combo_changed),
private->gimp->config);
g_signal_connect (private->gimp->config, "notify::icon-theme",
@@ -161,7 +167,7 @@ gimp_icon_size_scale_constructed (GObject *object)
gimp_icon_size_scale_icon_size_notify (GIMP_GUI_CONFIG (private->gimp->config),
NULL, private->scale);
- gtk_widget_show (private->checkbox);
+ gtk_widget_show (private->combo);
gtk_widget_show (private->scale);
}
@@ -309,25 +315,25 @@ gimp_icon_size_scale_icon_theme_notify (GimpGuiConfig *config,
markup);
if (update_value)
{
- GimpIconSize *size;
+ GimpIconSize size;
g_object_get (config, "icon-size", &size, NULL);
- if (size == GIMP_ICON_SIZE_DEFAULT)
+ if (size == GIMP_ICON_SIZE_THEME || size == GIMP_ICON_SIZE_AUTO)
{
g_signal_handlers_block_by_func (scale,
G_CALLBACK (gimp_icon_size_scale_value_changed),
config);
}
- if (has_dialog)
- gtk_range_set_value (scale, 3.0);
- else if (has_dnd)
- gtk_range_set_value (scale, 2.0);
+ if (has_small_toolbar)
+ gtk_range_set_value (scale, 0.0);
else if (has_large_toolbar)
gtk_range_set_value (scale, 1.0);
+ else if (has_dnd)
+ gtk_range_set_value (scale, 2.0);
else
- gtk_range_set_value (scale, 0.0);
- if (size == GIMP_ICON_SIZE_DEFAULT)
+ gtk_range_set_value (scale, 3.0);
+ if (size == GIMP_ICON_SIZE_THEME || size == GIMP_ICON_SIZE_AUTO)
{
g_signal_handlers_unblock_by_func (scale,
G_CALLBACK (gimp_icon_size_scale_value_changed),
@@ -341,10 +347,14 @@ gimp_icon_size_scale_icon_size_notify (GimpGuiConfig *config,
GParamSpec *pspec,
GtkWidget *size_scale)
{
- GtkWidget *frame = gtk_widget_get_parent (size_scale);
- GtkWidget *checkbox = gtk_frame_get_label_widget (GTK_FRAME (frame));
- GimpIconSize size;
- gdouble value = 1.0;
+ GimpIconSizeScalePrivate *private;
+ GtkWidget *frame = gtk_widget_get_parent (size_scale);
+ GtkWidget *combo;
+ GimpIconSize size;
+ gdouble value = 1.0;
+
+ private = GET_PRIVATE (frame);
+ combo = private->combo;
g_object_get (config, "icon-size", &size, NULL);
@@ -362,22 +372,24 @@ gimp_icon_size_scale_icon_size_notify (GimpGuiConfig *config,
case GIMP_ICON_SIZE_HUGE:
value = 3.0;
break;
- default: /* GIMP_ICON_SIZE_DEFAULT */
+ default: /* GIMP_ICON_SIZE_THEME */
break;
}
- g_signal_handlers_block_by_func (checkbox,
- G_CALLBACK (gimp_icon_size_scale_checkbox_toggled),
+ g_signal_handlers_block_by_func (combo,
+ G_CALLBACK (gimp_icon_size_scale_combo_changed),
config);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (checkbox),
- size != GIMP_ICON_SIZE_DEFAULT);
- g_signal_handlers_unblock_by_func (checkbox,
- G_CALLBACK (gimp_icon_size_scale_checkbox_toggled),
+ gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (combo),
+ (size == GIMP_ICON_SIZE_AUTO)? 0 :
+ (size == GIMP_ICON_SIZE_THEME)? 1 : 2);
+ g_signal_handlers_unblock_by_func (combo,
+ G_CALLBACK (gimp_icon_size_scale_combo_changed),
config);
gtk_widget_set_sensitive (GTK_WIDGET (size_scale),
- size != GIMP_ICON_SIZE_DEFAULT);
+ size != GIMP_ICON_SIZE_THEME &&
+ size != GIMP_ICON_SIZE_AUTO);
- if (size != GIMP_ICON_SIZE_DEFAULT)
+ if (size != GIMP_ICON_SIZE_THEME && size != GIMP_ICON_SIZE_AUTO)
{
g_signal_handlers_block_by_func (size_scale,
G_CALLBACK (gimp_icon_size_scale_value_changed),
@@ -390,14 +402,17 @@ gimp_icon_size_scale_icon_size_notify (GimpGuiConfig *config,
}
static void
-gimp_icon_size_scale_checkbox_toggled (GtkToggleButton *checkbox,
- GimpGuiConfig *config)
+gimp_icon_size_scale_combo_changed (GtkComboBox *combo,
+ GimpGuiConfig *config)
{
- GtkWidget *frame = gtk_widget_get_parent (GTK_WIDGET (checkbox));
- GtkWidget *scale = gtk_bin_get_child (GTK_BIN (frame));
+ GtkWidget *frame;
+ GtkWidget *scale;
GimpIconSize size;
- if (gtk_toggle_button_get_active (checkbox))
+ frame = gtk_widget_get_parent (gtk_widget_get_parent (GTK_WIDGET (combo)));
+ scale = gtk_bin_get_child (GTK_BIN (frame));
+
+ if (gtk_combo_box_get_active (combo) == 2)
{
gdouble value = gtk_range_get_value (GTK_RANGE (scale));
@@ -412,10 +427,11 @@ gimp_icon_size_scale_checkbox_toggled (GtkToggleButton *checkbox,
}
else
{
- size = GIMP_ICON_SIZE_DEFAULT;
+ size = (gtk_combo_box_get_active (combo) == 0) ?
+ GIMP_ICON_SIZE_AUTO : GIMP_ICON_SIZE_THEME;
}
gtk_widget_set_sensitive (GTK_WIDGET (scale),
- gtk_toggle_button_get_active (checkbox));
+ gtk_combo_box_get_active (combo) == 2);
g_signal_handlers_block_by_func (config,
G_CALLBACK (gimp_icon_size_scale_icon_size_notify),
diff --git a/app/widgets/gimptoolpalette.c b/app/widgets/gimptoolpalette.c
index 25c6456..05be163 100644
--- a/app/widgets/gimptoolpalette.c
+++ b/app/widgets/gimptoolpalette.c
@@ -86,8 +86,7 @@ static gboolean gimp_tool_palette_tool_button_press (GtkWidget *widget,
GdkEventButton *bevent,
GimpToolPalette *palette);
-static void gimp_tool_palette_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
+static void gimp_tool_palette_config_size_changed (GimpGuiConfig *config,
GimpToolPalette *palette);
G_DEFINE_TYPE (GimpToolPalette, gimp_tool_palette, GTK_TYPE_TOOL_PALETTE)
@@ -142,7 +141,7 @@ gimp_tool_palette_finalize (GObject *object)
if (context)
g_signal_handlers_disconnect_by_func (context->gimp->config,
- G_CALLBACK (gimp_tool_palette_icon_size_notify),
+ G_CALLBACK (gimp_tool_palette_config_size_changed),
palette);
}
@@ -217,8 +216,8 @@ gimp_tool_palette_style_set (GtkWidget *widget,
"button-relief", &relief,
NULL);
- gimp_tool_palette_icon_size_notify (GIMP_GUI_CONFIG (gimp->config),
- NULL, GIMP_TOOL_PALETTE (widget));
+ gimp_tool_palette_config_size_changed (GIMP_GUI_CONFIG (gimp->config),
+ GIMP_TOOL_PALETTE (widget));
for (list = gimp_get_tool_info_iter (gimp);
list;
list = g_list_next (list))
@@ -321,7 +320,7 @@ gimp_tool_palette_set_toolbox (GimpToolPalette *palette,
{
context = gimp_toolbox_get_context (private->toolbox);
g_signal_handlers_disconnect_by_func (GIMP_GUI_CONFIG (context->gimp->config),
- G_CALLBACK (gimp_tool_palette_icon_size_notify),
+ G_CALLBACK (gimp_tool_palette_config_size_changed),
palette);
}
private->toolbox = toolbox;
@@ -382,11 +381,11 @@ gimp_tool_palette_set_toolbox (GimpToolPalette *palette,
/* Update the toolbox icon size on config change. */
g_signal_connect (GIMP_GUI_CONFIG (context->gimp->config),
- "notify::icon-size",
- G_CALLBACK (gimp_tool_palette_icon_size_notify),
+ "size-changed",
+ G_CALLBACK (gimp_tool_palette_config_size_changed),
palette);
- gimp_tool_palette_icon_size_notify (GIMP_GUI_CONFIG (context->gimp->config),
- NULL, palette);
+ gimp_tool_palette_config_size_changed (GIMP_GUI_CONFIG (context->gimp->config),
+ palette);
}
gboolean
@@ -507,14 +506,13 @@ gimp_tool_palette_tool_button_press (GtkWidget *widget,
}
static void
-gimp_tool_palette_icon_size_notify (GimpGuiConfig *config,
- GParamSpec *pspec,
- GimpToolPalette *palette)
+gimp_tool_palette_config_size_changed (GimpGuiConfig *config,
+ GimpToolPalette *palette)
{
GimpIconSize size;
GtkIconSize tool_icon_size;
- g_object_get (config, "icon-size", &size, NULL);
+ size = gimp_gui_config_detect_icon_size (config);
/* Match GimpIconSize with GtkIconSize for the toolbox icons. */
switch (size)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]