forked from AuroraMiddleware/gtk
toolbar: Remove icon sizes
This commit is contained in:
parent
8df61992d7
commit
a7754a14b5
@ -2414,7 +2414,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolbar">
|
||||
<property name="icon-size">1</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
@ -2900,7 +2899,6 @@ microphone-sensitivity-medium-symbolic</property>
|
||||
<object class="GtkToolbar">
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<property name="icon-size">1</property>
|
||||
<child>
|
||||
<object class="GtkToolButton" id="toolbutton1">
|
||||
<property name="icon-name">document-open-symbolic</property>
|
||||
|
@ -3214,7 +3214,6 @@ GtkToggleButtonPrivate
|
||||
GtkToolShell
|
||||
GtkToolShellIface
|
||||
gtk_tool_shell_get_ellipsize_mode
|
||||
gtk_tool_shell_get_icon_size
|
||||
gtk_tool_shell_get_orientation
|
||||
gtk_tool_shell_get_style
|
||||
gtk_tool_shell_get_text_alignment
|
||||
@ -3244,13 +3243,10 @@ gtk_toolbar_get_nth_item
|
||||
gtk_toolbar_get_drop_index
|
||||
gtk_toolbar_set_drop_highlight_item
|
||||
gtk_toolbar_set_show_arrow
|
||||
gtk_toolbar_unset_icon_size
|
||||
gtk_toolbar_get_show_arrow
|
||||
gtk_toolbar_get_style
|
||||
gtk_toolbar_get_icon_size
|
||||
|
||||
gtk_toolbar_set_style
|
||||
gtk_toolbar_set_icon_size
|
||||
gtk_toolbar_unset_style
|
||||
|
||||
<SUBSECTION Standard>
|
||||
@ -3284,7 +3280,6 @@ gtk_tool_item_get_visible_vertical
|
||||
gtk_tool_item_set_is_important
|
||||
gtk_tool_item_get_is_important
|
||||
gtk_tool_item_get_ellipsize_mode
|
||||
gtk_tool_item_get_icon_size
|
||||
gtk_tool_item_get_orientation
|
||||
gtk_tool_item_get_toolbar_style
|
||||
gtk_tool_item_get_text_alignment
|
||||
@ -3476,9 +3471,6 @@ gtk_tool_palette_get_expand
|
||||
gtk_tool_palette_set_expand
|
||||
gtk_tool_palette_get_group_position
|
||||
gtk_tool_palette_set_group_position
|
||||
gtk_tool_palette_get_icon_size
|
||||
gtk_tool_palette_set_icon_size
|
||||
gtk_tool_palette_unset_icon_size
|
||||
gtk_tool_palette_get_style
|
||||
gtk_tool_palette_set_style
|
||||
gtk_tool_palette_unset_style
|
||||
|
@ -1074,7 +1074,6 @@ populate_dialog (GtkCustomPaperUnixDialog *dialog)
|
||||
gtk_widget_show (treeview);
|
||||
|
||||
toolbar = gtk_toolbar_new ();
|
||||
gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
|
||||
|
||||
context = gtk_widget_get_style_context (toolbar);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
|
||||
|
160
gtk/gtktoolbar.c
160
gtk/gtktoolbar.c
@ -101,7 +101,6 @@ typedef struct _ToolbarContent ToolbarContent;
|
||||
#define SPACE_LINE_START 2.0
|
||||
#define SPACE_LINE_END 8.0
|
||||
|
||||
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_LARGE_TOOLBAR
|
||||
#define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_BOTH_HORIZ
|
||||
#define DEFAULT_ANIMATION_STATE TRUE
|
||||
|
||||
@ -118,7 +117,6 @@ struct _GtkToolbarPrivate
|
||||
GtkMenu *menu;
|
||||
GtkSettings *settings;
|
||||
|
||||
GtkIconSize icon_size;
|
||||
GtkToolbarStyle style;
|
||||
|
||||
GtkToolItem *highlight_tool_item;
|
||||
@ -144,7 +142,6 @@ struct _GtkToolbarPrivate
|
||||
GtkOrientation orientation;
|
||||
|
||||
guint animation : 1;
|
||||
guint icon_size_set : 1;
|
||||
guint is_sliding : 1;
|
||||
guint need_rebuild : 1; /* whether the overflow menu should be regenerated */
|
||||
guint need_sync : 1;
|
||||
@ -159,8 +156,6 @@ enum {
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_SHOW_ARROW,
|
||||
PROP_TOOLTIPS,
|
||||
PROP_ICON_SIZE,
|
||||
PROP_ICON_SIZE_SET
|
||||
};
|
||||
|
||||
/* Child properties */
|
||||
@ -314,7 +309,6 @@ static void toolbar_content_set_expand (ToolbarContent *content,
|
||||
gboolean expand);
|
||||
|
||||
static void toolbar_tool_shell_iface_init (GtkToolShellIface *iface);
|
||||
static GtkIconSize toolbar_get_icon_size (GtkToolShell *shell);
|
||||
static GtkOrientation toolbar_get_orientation (GtkToolShell *shell);
|
||||
static GtkToolbarStyle toolbar_get_style (GtkToolShell *shell);
|
||||
static void toolbar_rebuild_menu (GtkToolShell *shell);
|
||||
@ -508,43 +502,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolbar:icon-size:
|
||||
*
|
||||
* The size of the icons in a toolbar is normally determined by
|
||||
* the toolbar-icon-size setting. When this property is set, it
|
||||
* overrides the setting.
|
||||
*
|
||||
* This should only be used for special-purpose toolbars, normal
|
||||
* application toolbars should respect the user preferences for the
|
||||
* size of icons.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ICON_SIZE,
|
||||
g_param_spec_enum ("icon-size",
|
||||
P_("Icon size"),
|
||||
P_("Size of icons in this toolbar"),
|
||||
GTK_TYPE_ICON_SIZE,
|
||||
DEFAULT_ICON_SIZE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolbar:icon-size-set:
|
||||
*
|
||||
* Is %TRUE if the icon-size property has been set.
|
||||
*
|
||||
* Since: 2.10
|
||||
*/
|
||||
g_object_class_install_property (gobject_class,
|
||||
PROP_ICON_SIZE_SET,
|
||||
g_param_spec_boolean ("icon-size-set",
|
||||
P_("Icon size set"),
|
||||
P_("Whether the icon-size property has been set"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
/* child properties */
|
||||
gtk_container_class_install_child_property (container_class,
|
||||
CHILD_PROP_EXPAND,
|
||||
@ -591,7 +548,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
|
||||
static void
|
||||
toolbar_tool_shell_iface_init (GtkToolShellIface *iface)
|
||||
{
|
||||
iface->get_icon_size = toolbar_get_icon_size;
|
||||
iface->get_orientation = toolbar_get_orientation;
|
||||
iface->get_style = toolbar_get_style;
|
||||
iface->rebuild_menu = toolbar_rebuild_menu;
|
||||
@ -612,7 +568,6 @@ gtk_toolbar_init (GtkToolbar *toolbar)
|
||||
|
||||
priv->orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
priv->style = DEFAULT_TOOLBAR_STYLE;
|
||||
priv->icon_size = DEFAULT_ICON_SIZE;
|
||||
priv->animation = DEFAULT_ANIMATION_STATE;
|
||||
|
||||
_gtk_orientable_set_style_classes (GTK_ORIENTABLE (toolbar));
|
||||
@ -654,7 +609,6 @@ gtk_toolbar_set_property (GObject *object,
|
||||
GParamSpec *pspec)
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (object);
|
||||
GtkToolbarPrivate *priv = toolbar->priv;
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
@ -668,15 +622,6 @@ gtk_toolbar_set_property (GObject *object,
|
||||
case PROP_SHOW_ARROW:
|
||||
gtk_toolbar_set_show_arrow (toolbar, g_value_get_boolean (value));
|
||||
break;
|
||||
case PROP_ICON_SIZE:
|
||||
gtk_toolbar_set_icon_size (toolbar, g_value_get_enum (value));
|
||||
break;
|
||||
case PROP_ICON_SIZE_SET:
|
||||
if (g_value_get_boolean (value))
|
||||
priv->icon_size_set = TRUE;
|
||||
else
|
||||
gtk_toolbar_unset_icon_size (toolbar);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -703,12 +648,6 @@ gtk_toolbar_get_property (GObject *object,
|
||||
case PROP_SHOW_ARROW:
|
||||
g_value_set_boolean (value, priv->show_arrow);
|
||||
break;
|
||||
case PROP_ICON_SIZE:
|
||||
g_value_set_enum (value, gtk_toolbar_get_icon_size (toolbar));
|
||||
break;
|
||||
case PROP_ICON_SIZE_SET:
|
||||
g_value_set_boolean (value, priv->icon_size_set);
|
||||
break;
|
||||
default:
|
||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||
break;
|
||||
@ -2623,22 +2562,6 @@ gtk_toolbar_get_nth_item (GtkToolbar *toolbar,
|
||||
return GTK_TOOL_ITEM (toolbar_content_get_widget (content));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toolbar_get_icon_size:
|
||||
* @toolbar: a #GtkToolbar
|
||||
*
|
||||
* Retrieves the icon size for the toolbar. See gtk_toolbar_set_icon_size().
|
||||
*
|
||||
* Returns: the current icon size for the icons on the toolbar.
|
||||
**/
|
||||
GtkIconSize
|
||||
gtk_toolbar_get_icon_size (GtkToolbar *toolbar)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), DEFAULT_ICON_SIZE);
|
||||
|
||||
return toolbar->priv->icon_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toolbar_set_show_arrow:
|
||||
* @toolbar: a #GtkToolbar
|
||||
@ -2772,80 +2695,6 @@ gtk_toolbar_finalize (GObject *object)
|
||||
G_OBJECT_CLASS (gtk_toolbar_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toolbar_set_icon_size:
|
||||
* @toolbar: A #GtkToolbar
|
||||
* @icon_size: The #GtkIconSize that stock icons in the toolbar shall have.
|
||||
*
|
||||
* This function sets the size of stock icons in the toolbar. You
|
||||
* can call it both before you add the icons and after they’ve been
|
||||
* added. The size you set will override user preferences for the default
|
||||
* icon size.
|
||||
*
|
||||
* This should only be used for special-purpose toolbars, normal
|
||||
* application toolbars should respect the user preferences for the
|
||||
* size of icons.
|
||||
**/
|
||||
void
|
||||
gtk_toolbar_set_icon_size (GtkToolbar *toolbar,
|
||||
GtkIconSize icon_size)
|
||||
{
|
||||
GtkToolbarPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
||||
g_return_if_fail (icon_size != GTK_ICON_SIZE_INVALID);
|
||||
|
||||
priv = toolbar->priv;
|
||||
|
||||
if (!priv->icon_size_set)
|
||||
{
|
||||
priv->icon_size_set = TRUE;
|
||||
g_object_notify (G_OBJECT (toolbar), "icon-size-set");
|
||||
}
|
||||
|
||||
if (priv->icon_size == icon_size)
|
||||
return;
|
||||
|
||||
priv->icon_size = icon_size;
|
||||
g_object_notify (G_OBJECT (toolbar), "icon-size");
|
||||
|
||||
gtk_toolbar_reconfigured (toolbar);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_toolbar_unset_icon_size:
|
||||
* @toolbar: a #GtkToolbar
|
||||
*
|
||||
* Unsets toolbar icon size set with gtk_toolbar_set_icon_size(), so that
|
||||
* user preferences will be used to determine the icon size.
|
||||
**/
|
||||
void
|
||||
gtk_toolbar_unset_icon_size (GtkToolbar *toolbar)
|
||||
{
|
||||
GtkToolbarPrivate *priv;
|
||||
GtkIconSize size;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
|
||||
|
||||
priv = toolbar->priv;
|
||||
|
||||
if (priv->icon_size_set)
|
||||
{
|
||||
size = DEFAULT_ICON_SIZE;
|
||||
|
||||
if (size != priv->icon_size)
|
||||
{
|
||||
gtk_toolbar_set_icon_size (toolbar, size);
|
||||
g_object_notify (G_OBJECT (toolbar), "icon-size");
|
||||
}
|
||||
|
||||
priv->icon_size_set = FALSE;
|
||||
g_object_notify (G_OBJECT (toolbar), "icon-size-set");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* ToolbarContent methods
|
||||
*/
|
||||
@ -3254,15 +3103,6 @@ _gtk_toolbar_elide_underscores (const gchar *original)
|
||||
return result;
|
||||
}
|
||||
|
||||
static GtkIconSize
|
||||
toolbar_get_icon_size (GtkToolShell *shell)
|
||||
{
|
||||
GtkToolbar *toolbar = GTK_TOOLBAR (shell);
|
||||
GtkToolbarPrivate *priv = toolbar->priv;
|
||||
|
||||
return priv->icon_size;
|
||||
}
|
||||
|
||||
static GtkOrientation
|
||||
toolbar_get_orientation (GtkToolShell *shell)
|
||||
{
|
||||
|
@ -113,14 +113,6 @@ void gtk_toolbar_set_style (GtkToolbar *toolbar,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_unset_style (GtkToolbar *toolbar);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconSize gtk_toolbar_get_icon_size (GtkToolbar *toolbar);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_set_icon_size (GtkToolbar *toolbar,
|
||||
GtkIconSize icon_size);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_toolbar_unset_icon_size (GtkToolbar *toolbar);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
gint gtk_toolbar_get_drop_index (GtkToolbar *toolbar,
|
||||
gint x,
|
||||
|
@ -311,7 +311,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
GtkToolbarStyle style;
|
||||
gboolean need_label = FALSE;
|
||||
gboolean need_icon = FALSE;
|
||||
GtkIconSize icon_size;
|
||||
GtkWidget *box = NULL;
|
||||
GtkOrientation text_orientation = GTK_ORIENTATION_HORIZONTAL;
|
||||
GtkSizeGroup *size_group = NULL;
|
||||
@ -446,7 +445,6 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
}
|
||||
}
|
||||
|
||||
icon_size = gtk_tool_item_get_icon_size (GTK_TOOL_ITEM (button));
|
||||
if (need_icon)
|
||||
{
|
||||
if (button->priv->icon_widget)
|
||||
@ -456,13 +454,13 @@ gtk_tool_button_construct_contents (GtkToolItem *tool_item)
|
||||
if (GTK_IS_IMAGE (icon))
|
||||
{
|
||||
g_object_set (button->priv->icon_widget,
|
||||
"icon-size", icon_size,
|
||||
"icon-size", GTK_ICON_SIZE_SMALL_TOOLBAR,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
else if (button->priv->icon_name)
|
||||
{
|
||||
icon = gtk_image_new_from_icon_name (button->priv->icon_name, icon_size);
|
||||
icon = gtk_image_new_from_icon_name (button->priv->icon_name, GTK_ICON_SIZE_SMALL_TOOLBAR);
|
||||
}
|
||||
|
||||
if (icon)
|
||||
|
@ -358,33 +358,6 @@ gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item)
|
||||
return gtk_tool_shell_get_ellipsize_mode (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_icon_size:
|
||||
* @tool_item: a #GtkToolItem
|
||||
*
|
||||
* Returns the icon size used for @tool_item. Custom subclasses of
|
||||
* #GtkToolItem should call this function to find out what size icons
|
||||
* they should use.
|
||||
*
|
||||
* Returns: (type int): a #GtkIconSize indicating the icon size
|
||||
* used for @tool_item
|
||||
*
|
||||
* Since: 2.4
|
||||
**/
|
||||
GtkIconSize
|
||||
gtk_tool_item_get_icon_size (GtkToolItem *tool_item)
|
||||
{
|
||||
GtkWidget *parent;
|
||||
|
||||
g_return_val_if_fail (GTK_IS_TOOL_ITEM (tool_item), GTK_ICON_SIZE_LARGE_TOOLBAR);
|
||||
|
||||
parent = gtk_widget_get_parent (GTK_WIDGET (tool_item));
|
||||
if (!parent || !GTK_IS_TOOL_SHELL (parent))
|
||||
return GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
|
||||
return gtk_tool_shell_get_icon_size (GTK_TOOL_SHELL (parent));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_item_get_orientation:
|
||||
* @tool_item: a #GtkToolItem
|
||||
|
@ -120,8 +120,6 @@ void gtk_tool_item_set_is_important (GtkToolItem *tool_item,
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
PangoEllipsizeMode gtk_tool_item_get_ellipsize_mode (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconSize gtk_tool_item_get_icon_size (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_item_get_orientation (GtkToolItem *tool_item);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolbarStyle gtk_tool_item_get_toolbar_style (GtkToolItem *tool_item);
|
||||
|
@ -150,17 +150,6 @@ gtk_tool_item_group_get_style (GtkToolShell *shell)
|
||||
return GTK_TOOLBAR_ICONS;
|
||||
}
|
||||
|
||||
static GtkIconSize
|
||||
gtk_tool_item_group_get_icon_size (GtkToolShell *shell)
|
||||
{
|
||||
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
|
||||
|
||||
if (GTK_IS_TOOL_PALETTE (parent))
|
||||
return gtk_tool_palette_get_icon_size (GTK_TOOL_PALETTE (parent));
|
||||
|
||||
return GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
}
|
||||
|
||||
static PangoEllipsizeMode
|
||||
gtk_tool_item_group_get_ellipsize_mode (GtkToolShell *shell)
|
||||
{
|
||||
@ -257,7 +246,6 @@ gtk_tool_item_group_display_changed (GtkWidget *widget,
|
||||
static void
|
||||
gtk_tool_item_group_tool_shell_init (GtkToolShellIface *iface)
|
||||
{
|
||||
iface->get_icon_size = gtk_tool_item_group_get_icon_size;
|
||||
iface->get_orientation = gtk_tool_item_group_get_orientation;
|
||||
iface->get_style = gtk_tool_item_group_get_style;
|
||||
iface->get_text_alignment = gtk_tool_item_group_get_text_alignment;
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "gtkwidgetprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
#define DEFAULT_ICON_SIZE GTK_ICON_SIZE_SMALL_TOOLBAR
|
||||
#define DEFAULT_ORIENTATION GTK_ORIENTATION_VERTICAL
|
||||
#define DEFAULT_TOOLBAR_STYLE GTK_TOOLBAR_ICONS
|
||||
|
||||
@ -123,8 +122,6 @@ typedef struct _GtkToolPaletteDragData GtkToolPaletteDragData;
|
||||
enum
|
||||
{
|
||||
PROP_NONE,
|
||||
PROP_ICON_SIZE,
|
||||
PROP_ICON_SIZE_SET,
|
||||
PROP_ORIENTATION,
|
||||
PROP_TOOLBAR_STYLE,
|
||||
PROP_HADJUSTMENT,
|
||||
@ -157,8 +154,6 @@ struct _GtkToolPalettePrivate
|
||||
GtkAdjustment *hadjustment;
|
||||
GtkAdjustment *vadjustment;
|
||||
|
||||
GtkIconSize icon_size;
|
||||
gboolean icon_size_set;
|
||||
GtkOrientation orientation;
|
||||
GtkToolbarStyle style;
|
||||
gboolean style_set;
|
||||
@ -210,8 +205,6 @@ gtk_tool_palette_init (GtkToolPalette *palette)
|
||||
palette->priv->groups = g_ptr_array_sized_new (4);
|
||||
g_ptr_array_set_free_func (palette->priv->groups, g_free);
|
||||
|
||||
palette->priv->icon_size = DEFAULT_ICON_SIZE;
|
||||
palette->priv->icon_size_set = FALSE;
|
||||
palette->priv->orientation = DEFAULT_ORIENTATION;
|
||||
palette->priv->style = DEFAULT_TOOLBAR_STYLE;
|
||||
palette->priv->style_set = FALSE;
|
||||
@ -252,24 +245,6 @@ gtk_tool_palette_set_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ICON_SIZE:
|
||||
if (palette->priv->icon_size != g_value_get_enum (value))
|
||||
{
|
||||
palette->priv->icon_size = g_value_get_enum (value);
|
||||
gtk_tool_palette_reconfigured (palette);
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ICON_SIZE_SET:
|
||||
if (palette->priv->icon_size_set != g_value_get_boolean (value))
|
||||
{
|
||||
palette->priv->icon_size_set = g_value_get_boolean (value);
|
||||
gtk_tool_palette_reconfigured (palette);
|
||||
g_object_notify_by_pspec (object, pspec);
|
||||
}
|
||||
break;
|
||||
|
||||
case PROP_ORIENTATION:
|
||||
if (palette->priv->orientation != g_value_get_enum (value))
|
||||
{
|
||||
@ -331,14 +306,6 @@ gtk_tool_palette_get_property (GObject *object,
|
||||
|
||||
switch (prop_id)
|
||||
{
|
||||
case PROP_ICON_SIZE:
|
||||
g_value_set_enum (value, gtk_tool_palette_get_icon_size (palette));
|
||||
break;
|
||||
|
||||
case PROP_ICON_SIZE_SET:
|
||||
g_value_set_boolean (value, palette->priv->icon_size_set);
|
||||
break;
|
||||
|
||||
case PROP_ORIENTATION:
|
||||
g_value_set_enum (value, palette->priv->orientation);
|
||||
break;
|
||||
@ -897,42 +864,6 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
|
||||
g_object_class_override_property (oclass, PROP_HSCROLL_POLICY, "hscroll-policy");
|
||||
g_object_class_override_property (oclass, PROP_VSCROLL_POLICY, "vscroll-policy");
|
||||
|
||||
/**
|
||||
* GtkToolPalette:icon-size:
|
||||
*
|
||||
* 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
|
||||
* size of icons.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
g_object_class_install_property (oclass,
|
||||
PROP_ICON_SIZE,
|
||||
g_param_spec_enum ("icon-size",
|
||||
P_("Icon size"),
|
||||
P_("Size of icons in this tool palette"),
|
||||
GTK_TYPE_ICON_SIZE,
|
||||
DEFAULT_ICON_SIZE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolPalette:icon-size-set:
|
||||
*
|
||||
* Is %TRUE if the #GtkToolPalette:icon-size property has been set.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
g_object_class_install_property (oclass,
|
||||
PROP_ICON_SIZE_SET,
|
||||
g_param_spec_boolean ("icon-size-set",
|
||||
P_("Icon size set"),
|
||||
P_("Whether the icon-size property has been set"),
|
||||
FALSE,
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
/**
|
||||
* GtkToolPalette:toolbar-style:
|
||||
*
|
||||
@ -997,76 +928,6 @@ gtk_tool_palette_new (void)
|
||||
return g_object_new (GTK_TYPE_TOOL_PALETTE, NULL);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_palette_set_icon_size:
|
||||
* @palette: a #GtkToolPalette
|
||||
* @icon_size: (type int): the #GtkIconSize that icons in the tool
|
||||
* palette shall have
|
||||
*
|
||||
* Sets the size of icons in the tool palette.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
void
|
||||
gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
|
||||
GtkIconSize icon_size)
|
||||
{
|
||||
GtkToolPalettePrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_PALETTE (palette));
|
||||
g_return_if_fail (icon_size != GTK_ICON_SIZE_INVALID);
|
||||
|
||||
priv = palette->priv;
|
||||
|
||||
if (!priv->icon_size_set)
|
||||
{
|
||||
priv->icon_size_set = TRUE;
|
||||
g_object_notify (G_OBJECT (palette), "icon-size-set");
|
||||
}
|
||||
|
||||
if (priv->icon_size == icon_size)
|
||||
return;
|
||||
|
||||
priv->icon_size = icon_size;
|
||||
g_object_notify (G_OBJECT (palette), "icon-size");
|
||||
|
||||
gtk_tool_palette_reconfigured (palette);
|
||||
|
||||
gtk_widget_queue_resize (GTK_WIDGET (palette));
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_palette_unset_icon_size:
|
||||
* @palette: a #GtkToolPalette
|
||||
*
|
||||
* Unsets the tool palette icon size set with gtk_tool_palette_set_icon_size(),
|
||||
* so that user preferences will be used to determine the icon size.
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
void
|
||||
gtk_tool_palette_unset_icon_size (GtkToolPalette *palette)
|
||||
{
|
||||
GtkToolPalettePrivate* priv = palette->priv;
|
||||
GtkIconSize size;
|
||||
|
||||
g_return_if_fail (GTK_IS_TOOL_PALETTE (palette));
|
||||
|
||||
if (palette->priv->icon_size_set)
|
||||
{
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
/* Set the "toolbar-style" property and do appropriate things.
|
||||
* GtkToolbar does this by emitting a signal instead of just
|
||||
* calling a function...
|
||||
@ -1137,25 +998,6 @@ gtk_tool_palette_unset_style (GtkToolPalette *palette)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_palette_get_icon_size:
|
||||
* @palette: a #GtkToolPalette
|
||||
*
|
||||
* Gets the size of icons in the tool palette.
|
||||
* See gtk_tool_palette_set_icon_size().
|
||||
*
|
||||
* Returns: (type int): the #GtkIconSize of icons in the tool palette
|
||||
*
|
||||
* Since: 2.20
|
||||
*/
|
||||
GtkIconSize
|
||||
gtk_tool_palette_get_icon_size (GtkToolPalette *palette)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), DEFAULT_ICON_SIZE);
|
||||
|
||||
return palette->priv->icon_size;
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_palette_get_style:
|
||||
* @palette: a #GtkToolPalette
|
||||
|
@ -112,19 +112,12 @@ GDK_AVAILABLE_IN_ALL
|
||||
gboolean gtk_tool_palette_get_expand (GtkToolPalette *palette,
|
||||
GtkToolItemGroup *group);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
|
||||
GtkIconSize icon_size);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_palette_unset_icon_size (GtkToolPalette *palette);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_palette_set_style (GtkToolPalette *palette,
|
||||
GtkToolbarStyle style);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
void gtk_tool_palette_unset_style (GtkToolPalette *palette);
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconSize gtk_tool_palette_get_icon_size (GtkToolPalette *palette);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkToolbarStyle gtk_tool_palette_get_style (GtkToolPalette *palette);
|
||||
|
||||
|
@ -75,23 +75,6 @@ gtk_tool_shell_real_get_ellipsize_mode (GtkToolShell *shell)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_icon_size:
|
||||
* @shell: a #GtkToolShell
|
||||
*
|
||||
* Retrieves the icon size for the tool shell. Tool items must not call this
|
||||
* function directly, but rely on gtk_tool_item_get_icon_size() instead.
|
||||
*
|
||||
* Returns: (type int): the current size (#GtkIconSize) for icons of @shell
|
||||
*
|
||||
* Since: 2.14
|
||||
**/
|
||||
GtkIconSize
|
||||
gtk_tool_shell_get_icon_size (GtkToolShell *shell)
|
||||
{
|
||||
return GTK_TOOL_SHELL_GET_IFACE (shell)->get_icon_size (shell);
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_tool_shell_get_orientation:
|
||||
* @shell: a #GtkToolShell
|
||||
|
@ -43,7 +43,6 @@ typedef struct _GtkToolShellIface GtkToolShellIface;
|
||||
|
||||
/**
|
||||
* GtkToolShellIface:
|
||||
* @get_icon_size: mandatory implementation of gtk_tool_shell_get_icon_size().
|
||||
* @get_orientation: mandatory implementation of gtk_tool_shell_get_orientation().
|
||||
* @get_style: mandatory implementation of gtk_tool_shell_get_style().
|
||||
* @rebuild_menu: optional implementation of gtk_tool_shell_rebuild_menu().
|
||||
@ -60,7 +59,6 @@ struct _GtkToolShellIface
|
||||
GTypeInterface g_iface;
|
||||
|
||||
/*< public >*/
|
||||
GtkIconSize (*get_icon_size) (GtkToolShell *shell);
|
||||
GtkOrientation (*get_orientation) (GtkToolShell *shell);
|
||||
GtkToolbarStyle (*get_style) (GtkToolShell *shell);
|
||||
void (*rebuild_menu) (GtkToolShell *shell);
|
||||
@ -73,8 +71,6 @@ struct _GtkToolShellIface
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GType gtk_tool_shell_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkIconSize gtk_tool_shell_get_icon_size (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
GtkOrientation gtk_tool_shell_get_orientation (GtkToolShell *shell);
|
||||
GDK_AVAILABLE_IN_ALL
|
||||
|
@ -292,44 +292,6 @@ bold_toggled (GtkToggleToolButton *button)
|
||||
gtk_toggle_tool_button_get_active (button));
|
||||
}
|
||||
|
||||
static void
|
||||
set_icon_size_toggled (GtkCheckButton *button, GtkToolbar *toolbar)
|
||||
{
|
||||
GtkWidget *option_menu;
|
||||
int icon_size;
|
||||
|
||||
option_menu = g_object_get_data (G_OBJECT (button), "option-menu");
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)))
|
||||
{
|
||||
if (gtk_combo_box_get_active (GTK_COMBO_BOX (option_menu)) == 0)
|
||||
icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
else
|
||||
icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
|
||||
gtk_toolbar_set_icon_size (toolbar, icon_size);
|
||||
gtk_widget_set_sensitive (option_menu, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
gtk_toolbar_unset_icon_size (toolbar);
|
||||
gtk_widget_set_sensitive (option_menu, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
icon_size_history_changed (GtkComboBox *menu, GtkToolbar *toolbar)
|
||||
{
|
||||
int icon_size;
|
||||
|
||||
if (gtk_combo_box_get_active (menu) == 0)
|
||||
icon_size = GTK_ICON_SIZE_SMALL_TOOLBAR;
|
||||
else
|
||||
icon_size = GTK_ICON_SIZE_LARGE_TOOLBAR;
|
||||
|
||||
gtk_toolbar_set_icon_size (toolbar, icon_size);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
toolbar_drag_drop (GtkWidget *widget, GdkDragContext *context,
|
||||
gint x, gint y, guint time, GtkWidget *label)
|
||||
@ -536,20 +498,6 @@ main (gint argc, gchar **argv)
|
||||
g_signal_connect (option_menu, "changed",
|
||||
G_CALLBACK (change_toolbar_style), toolbar);
|
||||
|
||||
checkbox = gtk_check_button_new_with_mnemonic("_Set Icon Size:");
|
||||
g_signal_connect (checkbox, "toggled", G_CALLBACK (set_icon_size_toggled), toolbar);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), checkbox);
|
||||
|
||||
option_menu = gtk_combo_box_text_new ();
|
||||
g_object_set_data (G_OBJECT (checkbox), "option-menu", option_menu);
|
||||
gtk_widget_set_sensitive (option_menu, FALSE);
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "small toolbar");
|
||||
gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (option_menu), "large toolbar");
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), option_menu);
|
||||
g_signal_connect (option_menu, "changed",
|
||||
G_CALLBACK (icon_size_history_changed), toolbar);
|
||||
|
||||
scrolled_window = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window),
|
||||
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
|
||||
|
@ -13,7 +13,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="icon_size">1</property>
|
||||
<style>
|
||||
<class name="inline-toolbar"/>
|
||||
</style>
|
||||
|
@ -14,7 +14,6 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="toolbar-style">icons</property>
|
||||
<style>
|
||||
|
@ -78,7 +78,6 @@ list_ignore_properties (gboolean buglist)
|
||||
{ "GtkMenuItem", "accel-path", (void*) MATCH_ANY_VALUE }, /* has odd restrictions in the setter */
|
||||
{ "GtkRecentChooserMenu", "select-multiple", (void*) MATCH_ANY_VALUE }, /* property disabled */
|
||||
{ "GtkTextView", "overwrite", (void*) MATCH_ANY_VALUE }, /* needs text buffer */
|
||||
{ "GtkToolbar", "icon-size", (void*) GTK_ICON_SIZE_INVALID },
|
||||
{ "GtkTreeView", "expander-column", (void*) MATCH_ANY_VALUE }, /* assertion list != NULL */
|
||||
{ "GtkWindow", "display", (void*) MATCH_ANY_VALUE },
|
||||
{ NULL, NULL, NULL }
|
||||
|
Loading…
Reference in New Issue
Block a user