toolbar: Don't special-case RTL toolbar child positions anymore

If you want to get rounded corners on an hbox, instead of
  :first-child {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
you now need to write:
  :first-child, :last-child:dir(rtl) {
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
  }
  :last-child, :first-child:dir(rtl)
  {
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
  }
This commit is contained in:
Benjamin Otte 2012-12-18 18:18:24 +01:00
parent 6f86e57c4f
commit 821a675013

View File

@ -231,8 +231,6 @@ static GtkWidgetPath * gtk_toolbar_get_path_for_child
GtkWidget *child); GtkWidget *child);
static void gtk_toolbar_invalidate_order (GtkToolbar *toolbar); static void gtk_toolbar_invalidate_order (GtkToolbar *toolbar);
static void gtk_toolbar_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
static void gtk_toolbar_orientation_changed (GtkToolbar *toolbar, static void gtk_toolbar_orientation_changed (GtkToolbar *toolbar,
GtkOrientation orientation); GtkOrientation orientation);
static void gtk_toolbar_real_style_changed (GtkToolbar *toolbar, static void gtk_toolbar_real_style_changed (GtkToolbar *toolbar,
@ -396,7 +394,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass)
widget_class->unmap = gtk_toolbar_unmap; widget_class->unmap = gtk_toolbar_unmap;
widget_class->popup_menu = gtk_toolbar_popup_menu; widget_class->popup_menu = gtk_toolbar_popup_menu;
widget_class->show_all = gtk_toolbar_show_all; widget_class->show_all = gtk_toolbar_show_all;
widget_class->direction_changed = gtk_toolbar_direction_changed;
container_class->add = gtk_toolbar_add; container_class->add = gtk_toolbar_add;
container_class->remove = gtk_toolbar_remove; container_class->remove = gtk_toolbar_remove;
@ -3858,10 +3855,6 @@ gtk_toolbar_get_visible_position (GtkToolbar *toolbar,
g_assert (count.found); g_assert (count.found);
if (toolbar->priv->orientation == GTK_ORIENTATION_HORIZONTAL &&
gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_RTL)
return count.after;
return count.before; return count.before;
} }
@ -3882,23 +3875,18 @@ gtk_toolbar_get_path_for_child (GtkContainer *container,
{ {
GtkWidgetPath *path; GtkWidgetPath *path;
GtkToolbar *toolbar; GtkToolbar *toolbar;
GtkToolbarPrivate *priv;
GtkWidgetPath *sibling_path; GtkWidgetPath *sibling_path;
gint vis_index; gint vis_index;
GList *children; GList *children;
toolbar = GTK_TOOLBAR (container); toolbar = GTK_TOOLBAR (container);
priv = toolbar->priv;
/* build a path for all the visible children; /* build a path for all the visible children;
* get_children works in visible order * get_children works in visible order
*/ */
sibling_path = gtk_widget_path_new (); sibling_path = gtk_widget_path_new ();
children = _gtk_container_get_all_children (container); children = _gtk_container_get_all_children (container);
children = g_list_reverse (children);
if (priv->orientation != GTK_ORIENTATION_HORIZONTAL ||
gtk_widget_get_direction (GTK_WIDGET (toolbar)) != GTK_TEXT_DIR_RTL)
children = g_list_reverse (children);
g_list_foreach (children, add_widget_to_path, sibling_path); g_list_foreach (children, add_widget_to_path, sibling_path);
g_list_free (children); g_list_free (children);
@ -3936,12 +3924,3 @@ gtk_toolbar_invalidate_order (GtkToolbar *toolbar)
NULL); NULL);
} }
static void
gtk_toolbar_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction)
{
GTK_WIDGET_CLASS (gtk_toolbar_parent_class)->direction_changed (widget, previous_direction);
gtk_toolbar_invalidate_order (GTK_TOOLBAR (widget));
}