Commit 6aebd30d authored by Jehan's avatar Jehan

app: remove icon sizing preferences.

With GTK+3, high or low density is taken care by the screen scale
factor. Having a separate preferences for this is redundant, and likely
even wrong.
It may be interesting though to have a new preference later, which would
allow smaller scale icon sizing since some people like their icon
slightly smaller or bigger, and also when you are using screens whose
density is at a limit scale factor. Right now, this can be done through
themes, but a GUI settings may be interesting. If I add such feature,
let's just do it from scratch later.
parent 82f7e8c6
......@@ -159,43 +159,6 @@ gimp_help_browser_type_get_type (void)
return type;
}
GType
gimp_icon_size_get_type (void)
{
static const GEnumValue values[] =
{
{ GIMP_ICON_SIZE_AUTO, "GIMP_ICON_SIZE_AUTO", "auto" },
{ GIMP_ICON_SIZE_THEME, "GIMP_ICON_SIZE_THEME", "theme" },
{ GIMP_ICON_SIZE_SMALL, "GIMP_ICON_SIZE_SMALL", "small" },
{ GIMP_ICON_SIZE_MEDIUM, "GIMP_ICON_SIZE_MEDIUM", "medium" },
{ GIMP_ICON_SIZE_LARGE, "GIMP_ICON_SIZE_LARGE", "large" },
{ GIMP_ICON_SIZE_HUGE, "GIMP_ICON_SIZE_HUGE", "huge" },
{ 0, NULL, NULL }
};
static const GimpEnumDesc descs[] =
{
{ GIMP_ICON_SIZE_AUTO, NC_("icon-size", "Guess ideal size"), NULL },
{ GIMP_ICON_SIZE_THEME, NC_("icon-size", "Theme-set size"), NULL },
{ GIMP_ICON_SIZE_SMALL, NC_("icon-size", "Small size"), NULL },
{ GIMP_ICON_SIZE_MEDIUM, NC_("icon-size", "Medium size"), NULL },
{ GIMP_ICON_SIZE_LARGE, NC_("icon-size", "Large size"), NULL },
{ GIMP_ICON_SIZE_HUGE, NC_("icon-size", "Huge size"), NULL },
{ 0, NULL, NULL }
};
static GType type = 0;
if (G_UNLIKELY (! type))
{
type = g_enum_register_static ("GimpIconSize", values);
gimp_type_set_translation_context (type, "icon-size");
gimp_enum_set_value_descriptions (type, descs);
}
return type;
}
GType
gimp_position_get_type (void)
{
......
......@@ -78,21 +78,6 @@ typedef enum
} GimpHelpBrowserType;
#define GIMP_TYPE_ICON_SIZE (gimp_icon_size_get_type ())
GType gimp_icon_size_get_type (void) G_GNUC_CONST;
typedef enum
{
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;
#define GIMP_TYPE_POSITION (gimp_position_get_type ())
GType gimp_position_get_type (void) G_GNUC_CONST;
......
......@@ -43,12 +43,6 @@
"http://docs.gimp.org/" GIMP_APP_VERSION_STRING
enum
{
SIZE_CHANGED,
LAST_SIGNAL
};
enum
{
PROP_0,
......@@ -78,7 +72,6 @@ enum
PROP_PREFER_DARK_THEME,
PROP_ICON_THEME_PATH,
PROP_ICON_THEME,
PROP_ICON_SIZE,
PROP_USE_HELP,
PROP_SHOW_HELP_BUTTON,
PROP_HELP_LOCALES,
......@@ -121,31 +114,16 @@ 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)
{
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,
g_cclosure_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;
......@@ -339,13 +317,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
ICON_THEME_BLURB,
GIMP_CONFIG_DEFAULT_ICON_THEME,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_ENUM (object_class, PROP_ICON_SIZE,
"icon-size",
"icon-size",
ICON_SIZE_BLURB,
GIMP_TYPE_ICON_SIZE,
GIMP_ICON_SIZE_AUTO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_PROP_BOOLEAN (object_class, PROP_USE_HELP,
"use-help",
......@@ -653,28 +624,6 @@ gimp_gui_config_set_property (GObject *object,
g_free (gui_config->icon_theme);
gui_config->icon_theme = g_value_dup_string (value);
break;
case PROP_ICON_SIZE:
{
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);
break;
......@@ -834,9 +783,6 @@ gimp_gui_config_get_property (GObject *object,
case PROP_ICON_THEME:
g_value_set_string (value, gui_config->icon_theme);
break;
case PROP_ICON_SIZE:
g_value_set_enum (value, gui_config->icon_size);
break;
case PROP_USE_HELP:
g_value_set_boolean (value, gui_config->use_help);
break;
......@@ -904,41 +850,3 @@ 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 < 250.0 ||
display_config->monitor_yres < 250.0)
size = GIMP_ICON_SIZE_LARGE;
else
size = GIMP_ICON_SIZE_HUGE;
}
return size;
}
......@@ -67,7 +67,6 @@ struct _GimpGuiConfig
gboolean prefer_dark_theme;
gchar *icon_theme_path;
gchar *icon_theme;
GimpIconSize icon_size;
gboolean use_help;
gboolean show_help_button;
gchar *help_locales;
......@@ -100,6 +99,4 @@ struct _GimpGuiConfigClass
GType gimp_gui_config_get_type (void) G_GNUC_CONST;
GimpIconSize gimp_gui_config_detect_icon_size (GimpGuiConfig *config);
#endif /* GIMP_GUI_CONFIG_H__ */
......@@ -47,7 +47,6 @@
#include "widgets/gimpgrideditor.h"
#include "widgets/gimphelp.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpiconsizescale.h"
#include "widgets/gimplanguagecombobox.h"
#include "widgets/gimpmessagebox.h"
#include "widgets/gimpmessagedialog.h"
......@@ -1902,7 +1901,6 @@ prefs_dialog_new (Gimp *gimp,
{
GtkWidget *scrolled_win;
GtkWidget *icon_size_scale;
GtkListStore *list_store;
GtkWidget *view;
GtkTreeSelection *sel;
......@@ -2007,10 +2005,6 @@ prefs_dialog_new (Gimp *gimp,
g_signal_connect (sel, "changed",
G_CALLBACK (prefs_icon_theme_select_callback),
gimp);
icon_size_scale = gimp_icon_size_scale_new (gimp);
gtk_box_pack_start (GTK_BOX (vbox), icon_size_scale, FALSE, FALSE, 0);
gtk_widget_show (icon_size_scale);
}
/*************************/
......
......@@ -232,8 +232,6 @@ libappwidgets_a_sources = \
gimphistogramview.h \
gimpiconpicker.c \
gimpiconpicker.h \
gimpiconsizescale.c \
gimpiconsizescale.h \
gimpimagecommenteditor.c \
gimpimagecommenteditor.h \
gimpimageeditor.c \
......
......@@ -137,7 +137,6 @@ static gboolean gimp_dockbook_tab_drag_drop (GtkWidget *widget,
gint y,
guint time);
static GtkIconSize gimp_dockbook_get_tab_icon_size (GimpDockbook *dockbook);
static void gimp_dockbook_add_tab_timeout (GimpDockbook *dockbook,
GimpDockable *dockable);
static void gimp_dockbook_remove_tab_timeout (GimpDockbook *dockbook);
......@@ -768,12 +767,16 @@ gimp_dockbook_create_tab_widget (GimpDockbook *dockbook,
GtkWidget *tab_widget;
GimpDockWindow *dock_window;
GtkAction *action = NULL;
GtkIconSize tab_size = DEFAULT_TAB_ICON_SIZE;
gtk_widget_style_get (GTK_WIDGET (dockbook),
"tab-icon-size", &tab_size,
NULL);
tab_widget =
gimp_dockable_create_tab_widget (dockable,
gimp_dock_get_context (dockbook->p->dock),
gimp_dockable_get_tab_style (dockable),
gimp_dockbook_get_tab_icon_size (dockbook));
tab_size);
if (! GIMP_IS_VIEW (tab_widget))
{
......@@ -1187,41 +1190,6 @@ gimp_dockbook_tab_drag_drop (GtkWidget *widget,
return TRUE;
}
static GtkIconSize
gimp_dockbook_get_tab_icon_size (GimpDockbook *dockbook)
{
Gimp *gimp;
GimpIconSize size;
GtkIconSize tab_size = DEFAULT_TAB_ICON_SIZE;
gimp = gimp_dock_get_context (dockbook->p->dock)->gimp;
size = gimp_gui_config_detect_icon_size (GIMP_GUI_CONFIG (gimp->config));
/* Match GimpIconSize with GtkIconSize. */
switch (size)
{
case GIMP_ICON_SIZE_SMALL:
case GIMP_ICON_SIZE_MEDIUM:
tab_size = GTK_ICON_SIZE_MENU;
break;
case GIMP_ICON_SIZE_LARGE:
tab_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
break;
case GIMP_ICON_SIZE_HUGE:
tab_size = GTK_ICON_SIZE_DND;
break;
default:
/* GIMP_ICON_SIZE_DEFAULT:
* let's use the size set by the theme. */
gtk_widget_style_get (GTK_WIDGET (dockbook),
"tab-icon-size", &tab_size,
NULL);
break;
}
return tab_size;
}
static void
gimp_dockbook_add_tab_timeout (GimpDockbook *dockbook,
GimpDockable *dockable)
......
......@@ -86,8 +86,6 @@ static void gimp_editor_get_property (GObject *object,
GValue *value,
GParamSpec *pspec);
static void gimp_editor_style_updated (GtkWidget *widget);
static GimpUIManager * gimp_editor_get_menu (GimpDocked *docked,
const gchar **ui_path,
gpointer *popup_data);
......@@ -100,13 +98,10 @@ static GtkIconSize gimp_editor_ensure_button_box (GimpEditor *editor,
GtkReliefStyle *button_relief);
static void gimp_editor_get_styling (GimpEditor *editor,
GimpGuiConfig *config,
gint *content_spacing,
GtkIconSize *button_icon_size,
gint *button_spacing,
GtkReliefStyle *button_relief);
static void gimp_editor_config_size_changed (GimpGuiConfig *config,
GimpEditor *editor);
G_DEFINE_TYPE_WITH_CODE (GimpEditor, gimp_editor, GTK_TYPE_BOX,
......@@ -127,8 +122,6 @@ gimp_editor_class_init (GimpEditorClass *klass)
object_class->set_property = gimp_editor_set_property;
object_class->get_property = gimp_editor_get_property;
widget_class->style_updated = gimp_editor_style_updated;
g_object_class_install_property (object_class, PROP_MENU_FACTORY,
g_param_spec_object ("menu-factory",
NULL, NULL,
......@@ -251,10 +244,6 @@ gimp_editor_constructed (GObject *object)
gimp_menu_factory_manager_new (editor->priv->menu_factory,
editor->priv->menu_identifier,
editor->priv->popup_data);
g_signal_connect (editor->priv->ui_manager->gimp->config,
"size-changed",
G_CALLBACK (gimp_editor_config_size_changed),
editor);
}
}
......@@ -268,12 +257,7 @@ gimp_editor_dispose (GObject *object)
g_clear_pointer (&editor->priv->menu_identifier, g_free);
if (editor->priv->ui_manager)
{
g_signal_handlers_disconnect_by_func (editor->priv->ui_manager->gimp->config,
G_CALLBACK (gimp_editor_config_size_changed),
editor);
g_clear_object (&editor->priv->ui_manager);
}
g_clear_object (&editor->priv->ui_manager);
g_clear_pointer (&editor->priv->ui_path, g_free);
......@@ -358,19 +342,6 @@ gimp_editor_get_property (GObject *object,
}
}
static void
gimp_editor_style_updated (GtkWidget *widget)
{
GimpEditor *editor = GIMP_EDITOR (widget);
GimpGuiConfig *config = NULL;
GTK_WIDGET_CLASS (parent_class)->style_updated (widget);
if (editor->priv->ui_manager)
config = GIMP_GUI_CONFIG (editor->priv->ui_manager->gimp->config);
gimp_editor_config_size_changed (config, editor);
}
static GimpUIManager *
gimp_editor_get_menu (GimpDocked *docked,
const gchar **ui_path,
......@@ -441,19 +412,12 @@ 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_config_size_changed),
editor);
g_object_unref (editor->priv->ui_manager);
}
editor->priv->ui_manager = gimp_menu_factory_manager_new (menu_factory,
menu_identifier,
popup_data);
g_signal_connect (editor->priv->ui_manager->gimp->config,
"size-changed",
G_CALLBACK (gimp_editor_config_size_changed),
editor);
if (editor->priv->ui_path)
g_free (editor->priv->ui_path);
......@@ -772,7 +736,7 @@ gimp_editor_set_box_style (GimpEditor *editor,
if (editor->priv->ui_manager)
config = GIMP_GUI_CONFIG (editor->priv->ui_manager->gimp->config);
gimp_editor_get_styling (editor, config,
gimp_editor_get_styling (editor,
&content_spacing,
&button_icon_size,
&button_spacing,
......@@ -868,7 +832,7 @@ gimp_editor_ensure_button_box (GimpEditor *editor,
gimp = editor->priv->ui_manager->gimp;
config = GIMP_GUI_CONFIG (gimp->config);
}
gimp_editor_get_styling (editor, config,
gimp_editor_get_styling (editor,
&content_spacing,
&button_icon_size,
&button_spacing,
......@@ -891,14 +855,11 @@ gimp_editor_ensure_button_box (GimpEditor *editor,
static void
gimp_editor_get_styling (GimpEditor *editor,
GimpGuiConfig *config,
gint *content_spacing,
GtkIconSize *button_icon_size,
gint *button_spacing,
GtkReliefStyle *button_relief)
{
GimpIconSize size;
/* Get the theme styling. */
gtk_widget_style_get (GTK_WIDGET (editor),
"content-spacing", content_spacing,
......@@ -906,57 +867,4 @@ gimp_editor_get_styling (GimpEditor *editor,
"button-spacing", button_spacing,
"button-relief", button_relief,
NULL);
/* Check if we should override theme styling. */
if (config)
{
size = gimp_gui_config_detect_icon_size (config);
switch (size)
{
case GIMP_ICON_SIZE_SMALL:
*button_spacing = MIN (*button_spacing / 2, 1);
*content_spacing = MIN (*content_spacing / 2, 1);
case GIMP_ICON_SIZE_MEDIUM:
*button_icon_size = GTK_ICON_SIZE_MENU;
break;
case GIMP_ICON_SIZE_LARGE:
*button_icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
*button_spacing *= 2;
*content_spacing *= 2;
break;
case GIMP_ICON_SIZE_HUGE:
*button_icon_size = GTK_ICON_SIZE_DND;
*button_spacing *= 3;
*content_spacing *= 3;
break;
default:
/* GIMP_ICON_SIZE_DEFAULT:
* let's use the sizes set by the theme. */
break;
}
}
}
static void
gimp_editor_config_size_changed (GimpGuiConfig *config,
GimpEditor *editor)
{
gint content_spacing;
GtkIconSize button_icon_size;
gint button_spacing;
GtkReliefStyle button_relief;
gimp_editor_get_styling (editor, config,
&content_spacing,
&button_icon_size,
&button_spacing,
&button_relief);
/* Editor styling. */
gtk_box_set_spacing (GTK_BOX (editor), content_spacing);
/* Button box styling. */
if (editor->priv->button_box)
gimp_editor_set_box_style (editor,
GTK_BOX (editor->priv->button_box));
}
/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimpiconsizescale.c
* Copyright (C) 2016 Jehan <jehan@girinstud.io>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpconfig/gimpconfig.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "widgets-types.h"
#include "config/gimpguiconfig.h"
#include "core/gimp.h"
#include "gimpiconsizescale.h"
#include "gimp-intl.h"
enum
{
PROP_0,
PROP_GIMP
};
typedef struct _GimpIconSizeScalePrivate GimpIconSizeScalePrivate;
struct _GimpIconSizeScalePrivate
{
Gimp *gimp;
GtkWidget *scale;
GtkWidget *combo;
};
#define GET_PRIVATE(scale) \
G_TYPE_INSTANCE_GET_PRIVATE (scale, \
GIMP_TYPE_ICON_SIZE_SCALE, \
GimpIconSizeScalePrivate)
static void gimp_icon_size_scale_constructed (GObject *object);
static void gimp_icon_size_scale_finalize (GObject *object);
static void gimp_icon_size_scale_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_icon_size_scale_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
/* Signals on GimpGuiConfig properties. */
static void gimp_icon_size_scale_icon_theme_notify (GimpGuiConfig *config,
GParamSpec *pspec,
GtkRange *scale);
static void gimp_icon_size_scale_icon_size_notify (GimpGuiConfig *config,
GParamSpec *pspec,
GtkWidget *size_scale);
/* 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,
GimpGuiConfig *config);
static gboolean gimp_icon_size_scale_change_value (GtkRange *range,
GtkScrollType scroll,
gdouble value,
GimpGuiConfig *config);
G_DEFINE_TYPE (GimpIconSizeScale, gimp_icon_size_scale, GIMP_TYPE_FRAME)
#define parent_class gimp_icon_size_scale_parent_class
static void
gimp_icon_size_scale_class_init (GimpIconSizeScaleClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->constructed = gimp_icon_size_scale_constructed;
object_class->finalize = gimp_icon_size_scale_finalize;
object_class->set_property = gimp_icon_size_scale_set_property;
object_class->get_property = gimp_icon_size_scale_get_property;
g_object_class_install_property (object_class, PROP_GIMP,
g_param_spec_object ("gimp",
NULL, NULL,
GIMP_TYPE_GIMP,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (object_class, sizeof (GimpIconSizeScalePrivate));
}
static void
gimp_icon_size_scale_init (GimpIconSizeScale *object)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
GtkWidget *box;
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_scale_new_with_range (GTK_ORIENTATION_HORIZONTAL,
0.0, 3.0, 1.0);
/* 'draw_value' updates round_digits. So set it first. */
gtk_scale_set_draw_value (GTK_SCALE (private->scale), FALSE);
gtk_range_set_round_digits (GTK_RANGE (private->scale), 0.0);
gtk_widget_set_sensitive (GTK_WIDGET (private->scale), FALSE);
gtk_container_add (GTK_CONTAINER (object), private->scale);
}
static void
gimp_icon_size_scale_constructed (GObject *object)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
G_OBJECT_CLASS (parent_class)->constructed (object);
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",
G_CALLBACK (gimp_icon_size_scale_icon_theme_notify),
private->scale);
gimp_icon_size_scale_icon_theme_notify (GIMP_GUI_CONFIG (private->gimp->config),
NULL, GTK_RANGE (private->scale));
g_signal_connect (private->scale, "change-value",
G_CALLBACK (gimp_icon_size_scale_change_value),
private->gimp->config);
g_signal_connect (private->scale, "value-changed",
G_CALLBACK (gimp_icon_size_scale_value_changed),
private->gimp->config);
g_signal_connect (private->gimp->config, "notify::icon-size",
G_CALLBACK (gimp_icon_size_scale_icon_size_notify),
private->scale);
gimp_icon_size_scale_icon_size_notify (GIMP_GUI_CONFIG (private->gimp->config),
NULL, private->scale);
gtk_widget_show (private->combo);
gtk_widget_show (private->scale);
}
static void
gimp_icon_size_scale_finalize (GObject *object)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
g_signal_handlers_disconnect_by_func (private->gimp->config,
G_CALLBACK (gimp_icon_size_scale_icon_size_notify),
private->scale);
g_signal_handlers_disconnect_by_func (private->gimp->config,
G_CALLBACK (gimp_icon_size_scale_icon_theme_notify),
private->scale);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
static void
gimp_icon_size_scale_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
switch (property_id)
{
case PROP_GIMP:
private->gimp = g_value_get_object (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
}
static void
gimp_icon_size_scale_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec)
{
GimpIconSizeScalePrivate *private = GET_PRIVATE (object);
switch (property_id)
{
case PROP_GIMP:
g_value_set_object (value, private->gimp);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}