[gtksourceview] test-widget: add option to show top border window
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] test-widget: add option to show top border window
- Date: Sat, 26 Mar 2016 12:02:05 +0000 (UTC)
commit ad329e7b027d42d4dd889cbf39f1c43d678a6f5f
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sat Mar 26 12:57:15 2016 +0100
test-widget: add option to show top border window
To test if the background color is correctly applied to the corner.
tests/test-widget.c | 20 ++++++++++++++++++++
tests/test-widget.ui | 32 +++++++++++++++++++++++---------
2 files changed, 43 insertions(+), 9 deletions(-)
---
diff --git a/tests/test-widget.c b/tests/test-widget.c
index ae56206..161670e 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -53,6 +53,7 @@ struct _TestWidgetPrivate
GtkSourceBuffer *buffer;
GtkSourceFile *file;
GtkSourceMap *map;
+ GtkCheckButton *show_top_border_window_checkbutton;
GtkCheckButton *show_map_checkbutton;
GtkCheckButton *draw_spaces_checkbutton;
GtkCheckButton *smart_backspace_checkbutton;
@@ -967,6 +968,7 @@ test_widget_class_init (TestWidgetClass *klass)
gtk_widget_class_bind_template_child_private (widget_class, TestWidget, view);
gtk_widget_class_bind_template_child_private (widget_class, TestWidget, map);
+ gtk_widget_class_bind_template_child_private (widget_class, TestWidget,
show_top_border_window_checkbutton);
gtk_widget_class_bind_template_child_private (widget_class, TestWidget, show_map_checkbutton);
gtk_widget_class_bind_template_child_private (widget_class, TestWidget, draw_spaces_checkbutton);
gtk_widget_class_bind_template_child_private (widget_class, TestWidget, smart_backspace_checkbutton);
@@ -992,6 +994,19 @@ tranform_boolean_to_draw_spaces_flags (GBinding *binding,
}
static void
+show_top_border_window_toggled_cb (GtkToggleButton *checkbutton,
+ TestWidget *self)
+{
+ gint size;
+
+ size = gtk_toggle_button_get_active (checkbutton) ? 20 : 0;
+
+ gtk_text_view_set_border_window_size (GTK_TEXT_VIEW (self->priv->view),
+ GTK_TEXT_WINDOW_TOP,
+ size);
+}
+
+static void
test_widget_init (TestWidget *self)
{
self->priv = test_widget_get_instance_private (self);
@@ -1003,6 +1018,11 @@ test_widget_init (TestWidget *self)
g_object_ref (self->priv->buffer);
+ g_signal_connect (self->priv->show_top_border_window_checkbutton,
+ "toggled",
+ G_CALLBACK (show_top_border_window_toggled_cb),
+ self);
+
g_signal_connect_swapped (self->priv->indent_width_checkbutton,
"toggled",
G_CALLBACK (update_indent_width),
diff --git a/tests/test-widget.ui b/tests/test-widget.ui
index 2adb39b..150e5e3 100644
--- a/tests/test-widget.ui
+++ b/tests/test-widget.ui
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.19.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<requires lib="gtksourceview" version="3.0"/>
@@ -132,7 +132,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">4</property>
+ <property name="top_attach">5</property>
</packing>
</child>
<child>
@@ -167,7 +167,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">5</property>
+ <property name="top_attach">6</property>
</packing>
</child>
<child>
@@ -180,7 +180,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">6</property>
+ <property name="top_attach">7</property>
</packing>
</child>
<child>
@@ -194,7 +194,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">7</property>
+ <property name="top_attach">8</property>
</packing>
</child>
<child>
@@ -208,7 +208,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">8</property>
+ <property name="top_attach">9</property>
</packing>
</child>
<child>
@@ -221,7 +221,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">9</property>
+ <property name="top_attach">10</property>
</packing>
</child>
<child>
@@ -234,7 +234,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">10</property>
+ <property name="top_attach">11</property>
</packing>
</child>
<child>
@@ -274,7 +274,7 @@
</object>
<packing>
<property name="left_attach">0</property>
- <property name="top_attach">11</property>
+ <property name="top_attach">12</property>
</packing>
</child>
<child>
@@ -327,6 +327,20 @@
<property name="top_attach">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkCheckButton" id="show_top_border_window_checkbutton">
+ <property name="label">Show top border window</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="xalign">0</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">4</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="left_attach">0</property>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]