From: Murray Cumming Date: Tue, 14 Jul 2009 17:11:20 +0000 (+0200) Subject: ToolPalette: Implement GtkOrientable. X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=ac7b0c91ae8394b869c00ece5ccadcb433aaecd6;p=~andy%2Fgtk 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. --- diff --git a/demos/gtk-demo/toolpalette.c b/demos/gtk-demo/toolpalette.c index fb933de97..671aa77cd 100644 --- a/demos/gtk-demo/toolpalette.c +++ b/demos/gtk-demo/toolpalette.c @@ -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) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 0a6b97fdd..5cc66e0d9 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,9 @@ +2009-07-14 Murray Cumming + + reviewed by: + + * gtk/gtk-sections.txt: + 2009-07-13 Murray Cumming reviewed by: diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt index 901f014f6..00e82de49 100644 --- a/docs/reference/gtk/gtk-sections.txt +++ b/docs/reference/gtk/gtk-sections.txt @@ -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 diff --git a/gtk/gtktoolitemgroup.c b/gtk/gtktoolitemgroup.c index f2718ddb3..58312de7c 100644 --- a/gtk/gtktoolitemgroup.c +++ b/gtk/gtktoolitemgroup.c @@ -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)*/)) diff --git a/gtk/gtktoolpalette.c b/gtk/gtktoolpalette.c index d20fde4c2..363ee3e11 100644 --- a/gtk/gtktoolpalette.c +++ b/gtk/gtktoolpalette.c @@ -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. diff --git a/gtk/gtktoolpalette.h b/gtk/gtktoolpalette.h index 64c4f095e..1d4d2494a 100644 --- a/gtk/gtktoolpalette.h +++ b/gtk/gtktoolpalette.h @@ -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,