From dcb6900c615e519bc1bc590f80e20620fcba19d7 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Fri, 12 Mar 2004 22:51:13 +0000 Subject: [PATCH] Swap GTK_ARROW_LEFT and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, Fri Mar 12 17:20:15 2004 Owen Taylor * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, Semion Chichelnitsky) * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed gtk_toolbar_direction-changed handlers and explicit flipping of GtkArrow widgets. --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-4 | 10 ++++++++++ ChangeLog.pre-2-6 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ gtk/gtkarrow.c | 12 ++++++++++-- gtk/gtkpathbar.c | 45 +++++---------------------------------------- gtk/gtktoolbar.c | 25 +------------------------ 8 files changed, 66 insertions(+), 66 deletions(-) diff --git a/ChangeLog b/ChangeLog index f070f86c29..8bdae20012 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +Fri Mar 12 17:20:15 2004 Owen Taylor + + * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT + and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, + Semion Chichelnitsky) + + * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed + gtk_toolbar_direction-changed handlers and explicit + flipping of GtkArrow widgets. + Fri Mar 12 23:37:15 2004 Soeren Sandmann * gtk/gtkfilechooserdialog.c diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index f070f86c29..8bdae20012 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +Fri Mar 12 17:20:15 2004 Owen Taylor + + * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT + and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, + Semion Chichelnitsky) + + * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed + gtk_toolbar_direction-changed handlers and explicit + flipping of GtkArrow widgets. + Fri Mar 12 23:37:15 2004 Soeren Sandmann * gtk/gtkfilechooserdialog.c diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index f070f86c29..8bdae20012 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,13 @@ +Fri Mar 12 17:20:15 2004 Owen Taylor + + * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT + and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, + Semion Chichelnitsky) + + * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed + gtk_toolbar_direction-changed handlers and explicit + flipping of GtkArrow widgets. + Fri Mar 12 23:37:15 2004 Soeren Sandmann * gtk/gtkfilechooserdialog.c diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index f070f86c29..8bdae20012 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,13 @@ +Fri Mar 12 17:20:15 2004 Owen Taylor + + * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT + and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, + Semion Chichelnitsky) + + * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed + gtk_toolbar_direction-changed handlers and explicit + flipping of GtkArrow widgets. + Fri Mar 12 23:37:15 2004 Soeren Sandmann * gtk/gtkfilechooserdialog.c diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index f070f86c29..8bdae20012 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +Fri Mar 12 17:20:15 2004 Owen Taylor + + * gtk/gtkarrow.c (gtk_arrow_expose): Swap GTK_ARROW_LEFT + and GTK_ARROW_RIGHT for GTK_TEXT_DIR_LTR. (#129159, + Semion Chichelnitsky) + + * gtk/gtkpathbar.c gtk/gtktoolbar.c: Remove no-longer-needed + gtk_toolbar_direction-changed handlers and explicit + flipping of GtkArrow widgets. + Fri Mar 12 23:37:15 2004 Soeren Sandmann * gtk/gtkfilechooserdialog.c diff --git a/gtk/gtkarrow.c b/gtk/gtkarrow.c index 5054769ddf..89dbf510ba 100644 --- a/gtk/gtkarrow.c +++ b/gtk/gtkarrow.c @@ -234,6 +234,7 @@ gtk_arrow_expose (GtkWidget *widget, gint x, y; gint extent; gfloat xalign; + GtkArrowType effective_arrow_type; if (GTK_WIDGET_DRAWABLE (widget)) { @@ -243,11 +244,18 @@ gtk_arrow_expose (GtkWidget *widget, width = widget->allocation.width - misc->xpad * 2; height = widget->allocation.height - misc->ypad * 2; extent = MIN (width, height) * 0.7; + effective_arrow_type = arrow->arrow_type; if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) xalign = misc->xalign; else - xalign = 1.0 - misc->xalign; + { + xalign = 1.0 - misc->xalign; + if (arrow->arrow_type == GTK_ARROW_LEFT) + effective_arrow_type = GTK_ARROW_RIGHT; + else if (arrow->arrow_type == GTK_ARROW_RIGHT) + effective_arrow_type = GTK_ARROW_LEFT; + } x = floor (widget->allocation.x + misc->xpad + ((widget->allocation.width - extent) * xalign) @@ -273,7 +281,7 @@ gtk_arrow_expose (GtkWidget *widget, gtk_paint_arrow (widget->style, widget->window, widget->state, shadow_type, &event->area, widget, "arrow", - arrow->arrow_type, TRUE, + effective_arrow_type, TRUE, x, y, extent, extent); } diff --git a/gtk/gtkpathbar.c b/gtk/gtkpathbar.c index 703e99214a..9963648153 100644 --- a/gtk/gtkpathbar.c +++ b/gtk/gtkpathbar.c @@ -73,8 +73,6 @@ static void gtk_path_bar_size_request (GtkWidget *widget, GtkRequisition *requisition); static void gtk_path_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static void gtk_path_bar_direction_changed (GtkWidget *widget, - GtkTextDirection direction); static void gtk_path_bar_add (GtkContainer *container, GtkWidget *widget); static void gtk_path_bar_remove (GtkContainer *container, @@ -97,14 +95,15 @@ static void gtk_path_bar_update_button_appearance (GtkPathBar *path_bar, gboolean current_dir); static GtkWidget * -get_slider_button (GtkPathBar *path_bar) +get_slider_button (GtkPathBar *path_bar, + GtkArrowType arrow_type) { GtkWidget *button; gtk_widget_push_composite_child (); button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (GTK_ARROW_RIGHT, GTK_SHADOW_OUT)); + gtk_container_add (GTK_CONTAINER (button), gtk_arrow_new (arrow_type, GTK_SHADOW_OUT)); gtk_container_add (GTK_CONTAINER (path_bar), button); gtk_widget_show_all (button); @@ -120,8 +119,8 @@ gtk_path_bar_init (GtkPathBar *path_bar) gtk_widget_set_redraw_on_allocate (GTK_WIDGET (path_bar), FALSE); path_bar->spacing = 3; - path_bar->up_slider_button = get_slider_button (path_bar); - path_bar->down_slider_button = get_slider_button (path_bar); + path_bar->up_slider_button = get_slider_button (path_bar, GTK_ARROW_LEFT); + path_bar->down_slider_button = get_slider_button (path_bar, GTK_ARROW_RIGHT); path_bar->icon_size = FALLBACK_ICON_SIZE; g_signal_connect (path_bar->up_slider_button, "clicked", G_CALLBACK (gtk_path_bar_scroll_up), path_bar); @@ -146,7 +145,6 @@ gtk_path_bar_class_init (GtkPathBarClass *path_bar_class) widget_class->size_request = gtk_path_bar_size_request; widget_class->size_allocate = gtk_path_bar_size_allocate; - widget_class->direction_changed = gtk_path_bar_direction_changed; widget_class->style_set = gtk_path_bar_style_set; widget_class->screen_changed = gtk_path_bar_screen_changed; @@ -267,30 +265,6 @@ gtk_path_bar_size_request (GtkWidget *widget, static void gtk_path_bar_update_slider_buttons (GtkPathBar *path_bar) { - GtkTextDirection direction; - - direction = gtk_widget_get_direction (GTK_WIDGET (path_bar)); - if (direction == GTK_TEXT_DIR_RTL) - { - GtkWidget *arrow; - - arrow = gtk_bin_get_child (GTK_BIN (path_bar->up_slider_button)); - g_object_set (arrow, "arrow_type", GTK_ARROW_RIGHT, NULL); - - arrow = gtk_bin_get_child (GTK_BIN (path_bar->down_slider_button)); - g_object_set (arrow, "arrow_type", GTK_ARROW_LEFT, NULL); - } - else - { - GtkWidget *arrow; - - arrow = gtk_bin_get_child (GTK_BIN (path_bar->up_slider_button)); - g_object_set (arrow, "arrow_type", GTK_ARROW_LEFT, NULL); - - arrow = gtk_bin_get_child (GTK_BIN (path_bar->down_slider_button)); - g_object_set (arrow, "arrow_type", GTK_ARROW_RIGHT, NULL); - } - if (path_bar->button_list) { GtkWidget *button; @@ -491,15 +465,6 @@ gtk_path_bar_size_allocate (GtkWidget *widget, } } -static void - gtk_path_bar_direction_changed (GtkWidget *widget, - GtkTextDirection direction) -{ - gtk_path_bar_update_slider_buttons (GTK_PATH_BAR (widget)); - - (* GTK_WIDGET_CLASS (gtk_path_bar_parent_class)->direction_changed) (widget, direction); -} - static void gtk_path_bar_style_set (GtkWidget *widget, GtkStyle *previous_style) diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 370ec6d8ac..56dd4ca495 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -158,8 +158,6 @@ static void gtk_toolbar_size_allocate (GtkWidget *widget, GtkAllocation *allocation); static void gtk_toolbar_style_set (GtkWidget *widget, GtkStyle *prev_style); -static void gtk_toolbar_direction_changed (GtkWidget *widget, - GtkTextDirection previous_direction); static gboolean gtk_toolbar_focus (GtkWidget *widget, GtkDirectionType dir); static void gtk_toolbar_screen_changed (GtkWidget *widget, @@ -373,7 +371,6 @@ gtk_toolbar_class_init (GtkToolbarClass *klass) widget_class->size_request = gtk_toolbar_size_request; widget_class->size_allocate = gtk_toolbar_size_allocate; widget_class->style_set = gtk_toolbar_style_set; - widget_class->direction_changed = gtk_toolbar_direction_changed; widget_class->focus = gtk_toolbar_focus; widget_class->screen_changed = gtk_toolbar_screen_changed; widget_class->realize = gtk_toolbar_realize; @@ -1625,24 +1622,6 @@ gtk_toolbar_style_set (GtkWidget *widget, gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget)); } -static void -gtk_toolbar_direction_changed (GtkWidget *widget, - GtkTextDirection previous_dir) -{ - GtkToolbar *toolbar = GTK_TOOLBAR (widget); - GtkToolbarPrivate *priv = GTK_TOOLBAR_GET_PRIVATE (toolbar); - - if (toolbar->orientation == GTK_ORIENTATION_VERTICAL) - { - if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR) - gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE); - else - gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_LEFT, GTK_SHADOW_NONE); - } - - GTK_WIDGET_CLASS (parent_class)->direction_changed (widget, previous_dir); -} - static GList * gtk_toolbar_list_children_in_focus_order (GtkToolbar *toolbar, GtkDirectionType dir) @@ -2355,10 +2334,8 @@ gtk_toolbar_orientation_changed (GtkToolbar *toolbar, if (orientation == GTK_ORIENTATION_HORIZONTAL) gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_DOWN, GTK_SHADOW_NONE); - else if (gtk_widget_get_direction (GTK_WIDGET (toolbar)) == GTK_TEXT_DIR_LTR) + else gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_RIGHT, GTK_SHADOW_NONE); - else - gtk_arrow_set (GTK_ARROW (priv->arrow), GTK_ARROW_LEFT, GTK_SHADOW_NONE); gtk_toolbar_reconfigured (toolbar);