notebook: Update arrows when text direction changes

Fixes https://gitlab.gnome.org/GNOME/gtk/issues/103
This commit is contained in:
Matthias Clasen 2020-02-06 02:07:22 -05:00
parent 2f369b6d7a
commit b6e2699409

View File

@ -693,6 +693,8 @@ static void gtk_notebook_grab_notify (GtkWidget *widget,
gboolean was_grabbed);
static void gtk_notebook_state_flags_changed (GtkWidget *widget,
GtkStateFlags previous_state);
static void gtk_notebook_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction);
static gboolean gtk_notebook_focus (GtkWidget *widget,
GtkDirectionType direction);
@ -958,6 +960,7 @@ gtk_notebook_class_init (GtkNotebookClass *class)
widget_class->popup_menu = gtk_notebook_popup_menu;
widget_class->grab_notify = gtk_notebook_grab_notify;
widget_class->state_flags_changed = gtk_notebook_state_flags_changed;
widget_class->direction_changed = gtk_notebook_direction_changed;
widget_class->focus = gtk_notebook_focus;
widget_class->compute_expand = gtk_notebook_compute_expand;
@ -3016,11 +3019,16 @@ update_arrow_nodes (GtkNotebook *notebook)
up_icon_name = "pan-down-symbolic";
down_icon_name = "pan-up-symbolic";
}
else
else if (gtk_widget_get_direction (GTK_WIDGET (notebook)) == GTK_TEXT_DIR_LTR)
{
up_icon_name = "pan-end-symbolic";
down_icon_name = "pan-start-symbolic";
}
else
{
up_icon_name = "pan-start-symbolic";
down_icon_name = "pan-end-symbolic";
}
arrow[0] = TRUE;
arrow[1] = FALSE;
@ -3105,6 +3113,13 @@ update_arrow_nodes (GtkNotebook *notebook)
}
}
static void
gtk_notebook_direction_changed (GtkWidget *widget,
GtkTextDirection previous_direction)
{
update_arrow_nodes (GTK_NOTEBOOK (widget));
}
static void
gtk_notebook_dnd_finished_cb (GdkDrag *drag,
GtkWidget *widget)