Deprecate and hardcode default toolbar icon size setting

Toolbar icon size can still be changed on a per-widget basis as
needed by the application developer.
This commit is contained in:
William Jon McCann 2013-07-08 13:45:01 -04:00
parent 425e977bb6
commit 7b66956e63
6 changed files with 9 additions and 114 deletions

View File

@ -499,7 +499,6 @@ static TranslationEntry translations[] = {
{ "org.gnome.desktop.interface", "font-name", "gtk-font-name", G_TYPE_STRING, { .s = "Cantarell 11" } },
{ "org.gnome.desktop.interface", "gtk-im-module", "gtk-im-module", G_TYPE_STRING, { .s = "simple" } },
{ "org.gnome.desktop.interface", "enable-animations", "gtk-enable-animations", G_TYPE_BOOLEAN, { .b = TRUE } },
{ "org.gnome.desktop.interface", "toolbar-icons-size", "gtk-toolbar-icon-size", G_TYPE_STRING, { .s = "large"} },
{ "org.gnome.settings-daemon.peripherals.mouse", "double-click", "gtk-double-click-time", G_TYPE_INT, { .i = 250 } },
{ "org.gnome.settings-daemon.peripherals.mouse", "drag-threshold", "gtk-dnd-drag-threshold", G_TYPE_INT, {.i = 8 } },
{ "org.gnome.desktop.sound", "theme-name", "gtk-sound-theme-name", G_TYPE_STRING, { .s = "freedesktop" } },

View File

@ -308,7 +308,6 @@ _gdk_win32_window_delete_property (GdkWindow *window,
"Gtk/ColorPalette\0" "gtk-color-palette\0"
"Gtk/FontName\0" "gtk-font-name\0"
"Gtk/KeyThemeName\0" "gtk-key-theme-name\0"
"Gtk/ToolbarIconSize\0" "gtk-toolbar-icon-size\0"
"Gtk/Modules\0" "gtk-modules\0"
"Gtk/CursorThemeName\0" "gtk-cursor-theme-name\0"
"Gtk/CursorThemeSize\0" "gtk-cursor-theme-size\0"

View File

@ -33,7 +33,6 @@ static const struct {
{"Gtk/ColorPalette", "gtk-color-palette"},
{"Gtk/FontName", "gtk-font-name"},
{"Gtk/KeyThemeName", "gtk-key-theme-name"},
{"Gtk/ToolbarIconSize", "gtk-toolbar-icon-size"},
{"Gtk/Modules", "gtk-modules"},
{"Gtk/CursorThemeName", "gtk-cursor-theme-name"},
{"Gtk/CursorThemeSize", "gtk-cursor-theme-size"},

View File

@ -1190,6 +1190,8 @@ gtk_settings_class_init (GtkSettingsClass *class)
* GtkSettings:gtk-toolbar-icon-size:
*
* The size of icons in default toolbars.
*
* Deprecated: 3.10: This setting is ignored.
*/
result = settings_install_property_parser (class,
g_param_spec_enum ("gtk-toolbar-icon-size",

View File

@ -2016,19 +2016,6 @@ toolbar_get_settings (GtkToolbar *toolbar)
return toolbar->priv->settings;
}
static void
icon_size_change_notify (GtkToolbar *toolbar)
{
GtkToolbarPrivate *priv = toolbar->priv;
if (!priv->icon_size_set)
{
/* pretend it was set, then unset, thus reverting to new default */
priv->icon_size_set = TRUE;
gtk_toolbar_unset_icon_size (toolbar);
}
}
static void
animation_change_notify (GtkToolbar *toolbar)
{
@ -2051,9 +2038,7 @@ settings_change_notify (GtkSettings *settings,
const GParamSpec *pspec,
GtkToolbar *toolbar)
{
if (! strcmp (pspec->name, "gtk-toolbar-icon-size"))
icon_size_change_notify (toolbar);
else if (! strcmp (pspec->name, "gtk-enable-animations"))
if (! strcmp (pspec->name, "gtk-enable-animations"))
animation_change_notify (toolbar);
}
@ -2093,7 +2078,6 @@ gtk_toolbar_screen_changed (GtkWidget *widget,
else
priv->settings = NULL;
icon_size_change_notify (toolbar);
animation_change_notify (toolbar);
}
@ -3190,16 +3174,7 @@ gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
if (priv->icon_size_set)
{
GtkSettings *settings = toolbar_get_settings (toolbar);
if (settings)
{
g_object_get (settings,
"gtk-toolbar-icon-size", &size,
NULL);
}
else
size = DEFAULT_ICON_SIZE;
size = DEFAULT_ICON_SIZE;
if (size != priv->icon_size)
{

View File

@ -162,9 +162,6 @@ struct _GtkToolPalettePrivate
GtkSizeGroup *text_size_group;
GtkSettings *settings;
gulong settings_connection;
guint drag_source : 2;
/* GtkScrollablePolicy needs to be checked when
@ -390,14 +387,6 @@ gtk_tool_palette_dispose (GObject *object)
palette->priv->text_size_group = NULL;
}
if (palette->priv->settings_connection > 0)
{
g_signal_handler_disconnect (palette->priv->settings, palette->priv->settings_connection);
palette->priv->settings_connection = 0;
}
g_clear_object (&palette->priv->settings);
G_OBJECT_CLASS (gtk_tool_palette_parent_class)->dispose (object);
}
@ -892,62 +881,11 @@ gtk_tool_palette_get_child_property (GtkContainer *container,
}
}
static void
icon_size_change_notify (GtkToolPalette *palette)
{
GtkToolPalettePrivate* priv = palette->priv;
if (!priv->icon_size_set)
{
/* pretend it was set, then unset, thus reverting to new default */
priv->icon_size_set = TRUE;
gtk_tool_palette_unset_icon_size (palette);
}
}
static void
gtk_tool_palette_settings_change_notify (GtkSettings *settings,
const GParamSpec *pspec,
GtkToolPalette *palette)
{
if (strcmp (pspec->name, "gtk-toolbar-icon-size") == 0)
icon_size_change_notify (palette);
}
static void
gtk_tool_palette_screen_changed (GtkWidget *widget,
GdkScreen *previous_screen)
{
GtkToolPalette *palette = GTK_TOOL_PALETTE (widget);
GtkToolPalettePrivate* priv = palette->priv;
GtkSettings *old_settings = priv->settings;
GtkSettings *settings;
if (gtk_widget_has_screen (GTK_WIDGET (palette)))
settings = gtk_widget_get_settings (GTK_WIDGET (palette));
else
settings = NULL;
if (settings == old_settings)
return;
if (old_settings)
{
g_signal_handler_disconnect (old_settings, priv->settings_connection);
priv->settings_connection = 0;
g_object_unref (old_settings);
}
if (settings)
{
priv->settings_connection =
g_signal_connect (settings, "notify",
G_CALLBACK (gtk_tool_palette_settings_change_notify),
palette);
priv->settings = g_object_ref (settings);
}
else
priv->settings = NULL;
gtk_tool_palette_reconfigured (palette);
}
@ -977,7 +915,7 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
cclass->set_child_property = gtk_tool_palette_set_child_property;
cclass->get_child_property = gtk_tool_palette_get_child_property;
/* Handle screen-changed so we can update our GtkSettings.
/* Handle screen-changed so we can update our configuration.
*/
wclass->screen_changed = gtk_tool_palette_screen_changed;
@ -991,9 +929,8 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
/**
* GtkToolPalette:icon-size:
*
* The size of the icons in a tool palette is normally determined by
* the #GtkSettings:gtk-toolbar-icon-size setting. When this property is set,
* it overrides the setting.
* The size of the icons in a tool palette. When this property is set,
* it overrides the default setting.
*
* This should only be used for special-purpose tool palettes, normal
* application tool palettes should respect the user preferences for the
@ -1127,13 +1064,6 @@ gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
gtk_widget_queue_resize (GTK_WIDGET (palette));
}
static GtkSettings *
toolpalette_get_settings (GtkToolPalette *palette)
{
GtkToolPalettePrivate *priv = palette->priv;
return priv->settings;
}
/**
* gtk_tool_palette_unset_icon_size:
* @palette: a #GtkToolPalette
@ -1153,22 +1083,13 @@ gtk_tool_palette_unset_icon_size (GtkToolPalette *palette)
if (palette->priv->icon_size_set)
{
GtkSettings *settings = toolpalette_get_settings (palette);
if (settings)
{
g_object_get (settings,
"gtk-toolbar-icon-size", &size,
NULL);
}
else
size = DEFAULT_ICON_SIZE;
size = DEFAULT_ICON_SIZE;
if (size != palette->priv->icon_size)
{
gtk_tool_palette_set_icon_size (palette, size);
g_object_notify (G_OBJECT (palette), "icon-size");
}
}
priv->icon_size_set = FALSE;
g_object_notify (G_OBJECT (palette), "icon-size-set");