diff options
author | Matthias Clasen <mclasen@redhat.com> | 2016-01-18 00:04:23 -0500 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2016-01-18 00:11:50 -0500 |
commit | a32b39c60faefb8bf3eb00e8e2ec10217b301e92 (patch) | |
tree | c7a13336dc317505154b1def01ade18ede723d97 /gtk/gtkcheckbutton.c | |
parent | 5265db5dd616f654d1c17b395f97818b2b531000 (diff) | |
download | gtk+-a32b39c60faefb8bf3eb00e8e2ec10217b301e92.tar.gz |
checkbutton: Handle rtl changes again
Now that the box gadget has api for it, use it here to
change the order of the gadgets for right-to-left.
Diffstat (limited to 'gtk/gtkcheckbutton.c')
-rw-r--r-- | gtk/gtkcheckbutton.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index 6395811af9..1e397d4b43 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -152,22 +152,8 @@ gtk_check_button_direction_changed (GtkWidget *widget, GtkTextDirection previous_direction) { GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (widget)); - GtkWidget *child; - child = gtk_bin_get_child (GTK_BIN (widget)); - if (child) - { - GtkCssNode *node, *parent, *sibling; - - node = gtk_css_gadget_get_node (priv->indicator_gadget); - parent = gtk_css_node_get_parent (node); - sibling = gtk_widget_get_css_node (child); - - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - gtk_css_node_insert_before (parent, node, sibling); - else - gtk_css_node_insert_after (parent, node, sibling); - } + gtk_box_gadget_reverse_children (GTK_BOX_GADGET (priv->gadget)); GTK_WIDGET_CLASS (gtk_check_button_parent_class)->direction_changed (widget, previous_direction); } @@ -188,10 +174,12 @@ gtk_check_button_add (GtkContainer *container, GtkWidget *widget) { GtkCheckButtonPrivate *priv = gtk_check_button_get_instance_private (GTK_CHECK_BUTTON (container)); + int pos; GTK_CONTAINER_CLASS (gtk_check_button_parent_class)->add (container, widget); - gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), 1, widget); + pos = gtk_widget_get_direction (GTK_WIDGET (container)) == GTK_TEXT_DIR_RTL ? 0 : 1; + gtk_box_gadget_insert_widget (GTK_BOX_GADGET (priv->gadget), pos, widget); } static void |