[gtk+] Deprecate and hardcode default toolbar icon size setting
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Deprecate and hardcode default toolbar icon size setting
- Date: Mon, 8 Jul 2013 19:04:24 +0000 (UTC)
commit 7b66956e63f4cd85fc72bf51778596c9b1b83c28
Author: William Jon McCann <william jon mccann gmail com>
Date: Mon Jul 8 13:45:01 2013 -0400
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.
gdk/wayland/gdkscreen-wayland.c | 1 -
gdk/win32/gdkproperty-win32.c | 1 -
gdk/x11/gdksettings.c | 1 -
gtk/gtksettings.c | 2 +
gtk/gtktoolbar.c | 29 +------------
gtk/gtktoolpalette.c | 89 ++------------------------------------
6 files changed, 9 insertions(+), 114 deletions(-)
---
diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c
index 4ef5ee2..862b253 100644
--- a/gdk/wayland/gdkscreen-wayland.c
+++ b/gdk/wayland/gdkscreen-wayland.c
@@ -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" } },
diff --git a/gdk/win32/gdkproperty-win32.c b/gdk/win32/gdkproperty-win32.c
index cb2a08d..975ff33 100644
--- a/gdk/win32/gdkproperty-win32.c
+++ b/gdk/win32/gdkproperty-win32.c
@@ -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"
diff --git a/gdk/x11/gdksettings.c b/gdk/x11/gdksettings.c
index 8f2adb3..07f6aa0 100644
--- a/gdk/x11/gdksettings.c
+++ b/gdk/x11/gdksettings.c
@@ -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"},
diff --git a/gtk/gtksettings.c b/gtk/gtksettings.c
index 472a480..6111044 100644
--- a/gtk/gtksettings.c
+++ b/gtk/gtksettings.c
@@ -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",
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 9412cc0..dcdcf2e 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -2017,19 +2017,6 @@ toolbar_get_settings (GtkToolbar *toolbar)
}
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)
{
GtkToolbarPrivate *priv = toolbar->priv;
@@ -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)
{
diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c
index a90a3e4..98456fa 100644
--- a/gtk/gtktoolpalette.c
+++ b/gtk/gtktoolpalette.c
@@ -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);
}
@@ -893,61 +882,10 @@ 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");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]