[PATCH] Redraw hubs and standalone spokes when the text direction changes
David Shea
dshea at redhat.com
Tue May 20 20:44:28 UTC 2014
The text direction might not be set to its final value during the
initial draw of the sidebar, so redraw the window whenever it receives a
direction-changed signal.
---
widgets/src/HubWindow.c | 10 ++++++++++
widgets/src/StandaloneWindow.c | 10 ++++++++++
2 files changed, 20 insertions(+)
diff --git a/widgets/src/HubWindow.c b/widgets/src/HubWindow.c
index b7a0ed6..d3e75be 100644
--- a/widgets/src/HubWindow.c
+++ b/widgets/src/HubWindow.c
@@ -116,6 +116,12 @@ static int get_sidebar_height(GtkWidget *window) {
return allocation.height;
}
+static void anaconda_hub_window_direction_changed (GtkWidget *widget,
+ GtkTextDirection previous_direction, gpointer user_data) {
+ /* Redraw the widget to refresh the sidebar */
+ gtk_widget_queue_draw(widget);
+}
+
/* function to override default drawing to insert sidebar image */
static gboolean anaconda_hub_window_on_draw(GtkWidget *win, cairo_t *cr) {
GtkStyleContext *context;
@@ -212,6 +218,10 @@ static void anaconda_hub_window_init(AnacondaHubWindow *win) {
/* The hub has different alignment requirements than a spoke. */
gtk_alignment_set(GTK_ALIGNMENT(anaconda_base_window_get_alignment(ANACONDA_BASE_WINDOW(win))),
0.5, 0.0, 0.5, 1.0);
+
+ /* Redraw to refresh the sidebar when the text direction changes */
+ g_signal_connect(win, "direction-changed", G_CALLBACK(anaconda_hub_window_direction_changed),
+ NULL);
}
/**
diff --git a/widgets/src/StandaloneWindow.c b/widgets/src/StandaloneWindow.c
index 7e20270..51e1c61 100644
--- a/widgets/src/StandaloneWindow.c
+++ b/widgets/src/StandaloneWindow.c
@@ -151,6 +151,12 @@ static void anaconda_standalone_window_size_allocate (GtkWidget *window, GtkAllo
gtk_widget_size_allocate (child, &child_allocation);
}
+static void anaconda_standalone_window_direction_changed(GtkWidget *widget,
+ GtkTextDirection previous_direction, gpointer user_data) {
+ /* Redraw the widget to refresh the sidebar */
+ gtk_widget_queue_draw(widget);
+}
+
static void anaconda_standalone_window_class_init(AnacondaStandaloneWindowClass *klass) {
GObjectClass *object_class = G_OBJECT_CLASS(klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
@@ -249,6 +255,10 @@ static void anaconda_standalone_window_init(AnacondaStandaloneWindow *win) {
* UI, by skipping you to the next screen.
*/
g_signal_connect(win, "realize", G_CALLBACK(anaconda_standalone_window_realize), win);
+
+ /* Redraw to refresh the sidebar when the text direction changes */
+ g_signal_connect(win, "direction-changed",
+ G_CALLBACK(anaconda_standalone_window_direction_changed), NULL);
}
static void anaconda_standalone_window_realize(GtkWidget *widget,
--
1.9.0
More information about the anaconda-patches
mailing list