ToolPalette: Implement GtkOrientable.

* gtk/gtktoolpalette.[h|c]: Remove gtk_tool_palette_get/set_property(),
implementing GtkOrientable instead.
* gtk/gtktoolitemgroup.c:
* demos/gtk-demo/toolpalette.c: Use gtk_orientable_* instead.
This commit is contained in:
Murray Cumming 2009-07-14 19:11:20 +02:00
parent 2976f4d98c
commit ac7b0c91ae
6 changed files with 15 additions and 53 deletions

View File

@ -25,7 +25,7 @@ static void on_combo_orientation_changed(GtkComboBox *combo_box, gpointer user_d
gint val = 0;
gtk_tree_model_get (model, &iter, 1, &val, -1);
gtk_tool_palette_set_orientation (palette, val);
gtk_orientable_set_orientation (GTK_ORIENTABLE (palette), val);
}
static void on_combo_style_changed(GtkComboBox *combo_box, gpointer user_data)

View File

@ -1,3 +1,9 @@
2009-07-14 Murray Cumming <murrayc@murrayc.com>
reviewed by: <delete if not using a buddy>
* gtk/gtk-sections.txt:
2009-07-13 Murray Cumming <murrayc@murrayc.com>
reviewed by: <delete if not using a buddy>

View File

@ -4449,8 +4449,6 @@ 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_get_orientation
gtk_tool_palette_set_orientation
gtk_tool_palette_get_style
gtk_tool_palette_set_style
gtk_tool_palette_add_drag_dest

View File

@ -127,7 +127,7 @@ gtk_tool_item_group_get_orientation (GtkToolShell *shell)
GtkWidget *parent = gtk_widget_get_parent (GTK_WIDGET (shell));
if (GTK_IS_TOOL_PALETTE (parent))
return gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
return gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
return GTK_ORIENTATION_VERTICAL;
}
@ -177,7 +177,7 @@ gtk_tool_item_group_get_text_orientation (GtkToolShell *shell)
if (GTK_IS_TOOL_PALETTE (parent))
{
GtkOrientation orientation = gtk_tool_palette_get_orientation (GTK_TOOL_PALETTE (parent));
GtkOrientation orientation = gtk_orientable_get_orientation (GTK_ORIENTABLE (parent));
if (GTK_ORIENTATION_HORIZONTAL == orientation &&
(GTK_TOOLBAR_TEXT == gtk_tool_item_group_get_style (shell)/* ||
GTK_TOOLBAR_BOTH_HORIZ == gtk_tool_item_group_get_style (shell)*/))

View File

@ -165,9 +165,10 @@ static const GtkTargetEntry dnd_targets[] =
{ "application/x-GTK-tool-palette-group", GTK_TARGET_SAME_APP, 0 },
};
G_DEFINE_TYPE (GtkToolPalette,
G_DEFINE_TYPE_WITH_CODE (GtkToolPalette,
gtk_tool_palette,
GTK_TYPE_CONTAINER);
GTK_TYPE_CONTAINER,
G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL));
static void
gtk_tool_palette_init (GtkToolPalette *palette)
@ -256,7 +257,7 @@ gtk_tool_palette_get_property (GObject *object,
break;
case PROP_ORIENTATION:
g_value_set_enum (value, gtk_tool_palette_get_orientation (palette));
g_value_set_enum (value, palette->priv->orientation);
break;
case PROP_TOOLBAR_STYLE:
@ -895,14 +896,8 @@ gtk_tool_palette_class_init (GtkToolPaletteClass *cls)
G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_install_property (oclass, PROP_ORIENTATION,
g_param_spec_enum ("orientation",
P_("Orientation"),
P_("Orientation of the tool palette"),
GTK_TYPE_ORIENTATION,
DEFAULT_ORIENTATION,
G_PARAM_READWRITE | G_PARAM_STATIC_NAME |
G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB));
g_object_class_override_property (oclass, PROP_ORIENTATION,
"orientation");
g_object_class_install_property (oclass, PROP_TOOLBAR_STYLE,
g_param_spec_enum ("toolbar-style",
@ -969,25 +964,6 @@ gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
g_object_set (palette, "icon-size", icon_size, NULL);
}
/**
* gtk_tool_palette_set_orientation:
* @palette: an #GtkToolPalette.
* @orientation: the #GtkOrientation that the tool palette shall have.
*
* Sets the orientation (horizontal or vertical) of the tool palette.
*
* Since: 2.18
*/
void
gtk_tool_palette_set_orientation (GtkToolPalette *palette,
GtkOrientation orientation)
{
g_return_if_fail (GTK_IS_TOOL_PALETTE (palette));
if (orientation != palette->priv->orientation)
g_object_set (palette, "orientation", orientation, NULL);
}
/**
* gtk_tool_palette_set_style:
* @palette: an #GtkToolPalette.
@ -1024,21 +1000,6 @@ gtk_tool_palette_get_icon_size (GtkToolPalette *palette)
return palette->priv->icon_size;
}
/**
* gtk_tool_palette_get_orientation:
* @palette: an #GtkToolPalette.
*
* Gets the orientation (horizontal or vertical) of the tool palette. See gtk_tool_palette_set_orientation().
*
* Returns the #GtkOrientation of the tool palette.
*/
GtkOrientation
gtk_tool_palette_get_orientation (GtkToolPalette *palette)
{
g_return_val_if_fail (GTK_IS_TOOL_PALETTE (palette), DEFAULT_ORIENTATION);
return palette->priv->orientation;
}
/**
* gtk_tool_palette_get_style:
* @palette: an #GtkToolPalette.

View File

@ -95,13 +95,10 @@ gboolean gtk_tool_palette_get_expand (GtkToolPa
void gtk_tool_palette_set_icon_size (GtkToolPalette *palette,
GtkIconSize icon_size);
void gtk_tool_palette_set_orientation (GtkToolPalette *palette,
GtkOrientation orientation);
void gtk_tool_palette_set_style (GtkToolPalette *palette,
GtkToolbarStyle style);
GtkIconSize gtk_tool_palette_get_icon_size (GtkToolPalette *palette);
GtkOrientation gtk_tool_palette_get_orientation (GtkToolPalette *palette);
GtkToolbarStyle gtk_tool_palette_get_style (GtkToolPalette *palette);
GtkToolItem* gtk_tool_palette_get_drop_item (GtkToolPalette *palette,