[gtk/matthiasc/for-master-2] notebook: Update arrows when text direction changes
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/for-master-2] notebook: Update arrows when text direction changes
- Date: Thu, 6 Feb 2020 07:10:02 +0000 (UTC)
commit 477675e0293283a7edddc1759726efcb78532c41
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Feb 6 02:07:22 2020 -0500
notebook: Update arrows when text direction changes
Fixes https://gitlab.gnome.org/GNOME/gtk/issues/103
gtk/gtknotebook.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
---
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index b3feea7fe3..70fa1a92bc 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]