[gtksourceview/wip/renovate-test-widget] Renovate test-widget (not finished)



commit 158eedcbeb706d490428b871211d0f7447701392
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Mar 9 15:19:07 2014 +0100

    Renovate test-widget (not finished)
    
    - use a composite widget template
    - replaces the menu with a sidebar, like in test-completion.
    - fixes lots of warnings due to deprecated functions (GtkStock,
    GtkUIManager, etc.).

 tests/Makefile.am               |   10 +-
 tests/test-widget.c             |  255 +++++++++++++------------
 tests/test-widget.gresource.xml |    6 +
 tests/test-widget.ui            |  396 +++++++++++++++++++++++++++++++++++++++
 4 files changed, 546 insertions(+), 121 deletions(-)
---
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 8d0a4e6..94dd3f3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -14,7 +14,8 @@ noinst_PROGRAMS = $(TEST_PROGS) $(UNIT_TEST_PROGS)
 
 BUILT_SOURCES =                                \
        test-completion-resources.c     \
-       test-search-resources.c
+       test-search-resources.c         \
+       test-widget-resources.c
 
 test-completion-resources.c: test-completion.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) 
--generate-dependencies $(srcdir)/test-completion.gresource.xml)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source 
$(srcdir)/test-completion.gresource.xml
@@ -22,6 +23,9 @@ test-completion-resources.c: test-completion.gresource.xml $(shell $(GLIB_COMPIL
 test-search-resources.c: test-search.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies 
$(srcdir)/test-search.gresource.xml)
        $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source 
$(srcdir)/test-search.gresource.xml
 
+test-widget-resources.c: test-widget.gresource.xml $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies 
$(srcdir)/test-widget.gresource.xml)
+       $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) --target=$@ --sourcedir=$(srcdir) --generate-source 
$(srcdir)/test-widget.gresource.xml
+
 TEST_PROGS = test-completion
 test_completion_SOURCES =              \
        test-completion.c               \
@@ -49,7 +53,9 @@ test_search_performances_LDADD =                              \
        $(TESTS_LIBS)
 
 TEST_PROGS += test-widget
-test_widget_SOURCES = test-widget.c
+test_widget_SOURCES =          \
+       test-widget.c           \
+       test-widget-resources.c
 test_widget_LDADD =                    \
        $(top_builddir)/gtksourceview/libgtksourceview-3.0.la \
        $(DEP_LIBS)                     \
diff --git a/tests/test-widget.c b/tests/test-widget.c
index 319fd5b..50aced5 100644
--- a/tests/test-widget.c
+++ b/tests/test-widget.c
@@ -4,6 +4,7 @@
  *
  * Copyright (C) 2001 - Mikael Hermansson <tyan linux se>
  * Copyright (C) 2003 - Gustavo Giráldez <gustavo giraldez gmx net>
+ * Copyright (C) 2014 - Sébastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -25,6 +26,39 @@
 #include <gio/gio.h>
 #include <gtksourceview/gtksource.h>
 
+#define TEST_TYPE_WIDGET             (test_widget_get_type ())
+#define TEST_WIDGET(obj)             (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_WIDGET, TestWidget))
+#define TEST_WIDGET_CLASS(klass)     (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_WIDGET, TestWidgetClass))
+#define TEST_IS_WIDGET(obj)          (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_WIDGET))
+#define TEST_IS_WIDGET_CLASS(klass)  (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_WIDGET))
+#define TEST_WIDGET_GET_CLASS(obj)   (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_WIDGET, TestWidgetClass))
+
+typedef struct _TestWidget         TestWidget;
+typedef struct _TestWidgetClass    TestWidgetClass;
+typedef struct _TestWidgetPrivate  TestWidgetPrivate;
+
+struct _TestWidget
+{
+       GtkGrid parent;
+
+       TestWidgetPrivate *priv;
+};
+
+struct _TestWidgetClass
+{
+       GtkGridClass parent_class;
+};
+
+struct _TestWidgetPrivate
+{
+       GtkSourceView *source_view;
+       GtkSourceBuffer *source_buffer;
+};
+
+GType test_widget_get_type (void);
+
+G_DEFINE_TYPE_WITH_PRIVATE (TestWidget, test_widget, GTK_TYPE_GRID)
+
 static GtkSourceStyleScheme *style_scheme = NULL;
 
 #define MARK_TYPE_1      "one"
@@ -32,21 +66,10 @@ static GtkSourceStyleScheme *style_scheme = NULL;
 
 /* Private prototypes */
 
-static void       open_file_cb                   (GtkAction       *action,
-                                                 gpointer         user_data);
-static void       print_file_cb                  (GtkAction       *action,
-                                                 gpointer         user_data);
-
-static void       numbers_toggled_cb             (GtkAction       *action,
-                                                 gpointer         user_data);
 static void       marks_toggled_cb               (GtkAction       *action,
                                                  gpointer         user_data);
 static void       margin_toggled_cb              (GtkAction       *action,
                                                  gpointer         user_data);
-static void       hl_syntax_toggled_cb           (GtkAction       *action,
-                                                 gpointer         user_data);
-static void       hl_bracket_toggled_cb          (GtkAction       *action,
-                                                 gpointer         user_data);
 static void       hl_line_toggled_cb             (GtkAction       *action,
                                                  gpointer         user_data);
 static void       draw_spaces_toggled_cb        (GtkAction       *action,
@@ -72,17 +95,8 @@ static void       backward_string_cb             (GtkAction       *action,
 
 /* Actions & UI definition */
 
-static GtkActionEntry buffer_action_entries[] = {
-       { "Open", GTK_STOCK_OPEN, "_Open", "<control>O",
-         "Open a file", G_CALLBACK (open_file_cb) },
-       { "Quit", GTK_STOCK_QUIT, "_Quit", "<control>Q",
-         "Exit the application", G_CALLBACK (gtk_main_quit) }
-};
-
 static GtkActionEntry view_action_entries[] = {
        { "FileMenu", NULL, "_File", NULL, NULL, NULL },
-       { "Print", GTK_STOCK_PRINT, "_Print", "<control>P",
-         "Print the current file", G_CALLBACK (print_file_cb) },
        { "ViewMenu", NULL, "_View", NULL, NULL, NULL },
        { "TabWidth", NULL, "_Tab Width", NULL, NULL, NULL },
        { "IndentWidth", NULL, "I_ndent Width", NULL, NULL, NULL },
@@ -94,15 +108,6 @@ static GtkActionEntry view_action_entries[] = {
 };
 
 static GtkToggleActionEntry toggle_entries[] = {
-       { "HlSyntax", NULL, "Highlight _Syntax", NULL,
-         "Toggle syntax highlighting",
-         G_CALLBACK (hl_syntax_toggled_cb), FALSE },
-       { "HlBracket", NULL, "Highlight Matching _Bracket", NULL,
-         "Toggle highlighting of matching bracket",
-         G_CALLBACK (hl_bracket_toggled_cb), FALSE },
-       { "ShowNumbers", NULL, "Show _Line Numbers", NULL,
-         "Toggle visibility of line numbers in the left margin",
-         G_CALLBACK (numbers_toggled_cb), FALSE },
        { "ShowMarks", NULL, "Show Line _Marks", NULL,
          "Toggle visibility of marks in the left margin",
          G_CALLBACK (marks_toggled_cb), FALSE },
@@ -401,8 +406,8 @@ print_language_style_ids (GtkSourceLanguage *language)
 }
 
 static void
-open_file (GtkSourceBuffer *buffer,
-          const gchar     *filename)
+open_file (TestWidget  *self,
+          const gchar *filename)
 {
        GtkSourceLanguage *language = NULL;
        gchar *absolute_filename;
@@ -418,20 +423,21 @@ open_file (GtkSourceBuffer *buffer,
                g_free (curdir);
        }
 
-       remove_all_marks (buffer);
+       remove_all_marks (self->priv->source_buffer);
 
-       if (!gtk_source_buffer_load_file (buffer, absolute_filename))
+       if (!gtk_source_buffer_load_file (self->priv->source_buffer, absolute_filename))
        {
                g_free (absolute_filename);
                return;
        }
 
-       g_object_set_data_full (G_OBJECT (buffer),
+       /* TODO have a GFile class attribute */
+       g_object_set_data_full (G_OBJECT (self->priv->source_buffer),
                                "filename", absolute_filename,
                                (GDestroyNotify) g_free);
 
-       language = get_language (GTK_TEXT_BUFFER (buffer), absolute_filename);
-       gtk_source_buffer_set_language (buffer, language);
+       language = get_language (GTK_TEXT_BUFFER (self->priv->source_buffer), absolute_filename);
+       gtk_source_buffer_set_language (self->priv->source_buffer, language);
 
        if (language != NULL)
        {
@@ -446,13 +452,11 @@ open_file (GtkSourceBuffer *buffer,
 /* View action callbacks */
 
 static void
-numbers_toggled_cb (GtkAction *action,
-                   gpointer   user_data)
+show_line_numbers_toggled_cb (TestWidget     *self,
+                             GtkCheckButton *button)
 {
-       g_return_if_fail (GTK_IS_TOGGLE_ACTION (action) && GTK_SOURCE_IS_VIEW (user_data));
-       gtk_source_view_set_show_line_numbers (
-               GTK_SOURCE_VIEW (user_data),
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+       gboolean enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+       gtk_source_view_set_show_line_numbers (self->priv->source_view, enabled);
 }
 
 static void
@@ -476,27 +480,19 @@ margin_toggled_cb (GtkAction *action,
 }
 
 static void
-hl_syntax_toggled_cb (GtkAction *action,
-                     gpointer   user_data)
+highlight_syntax_toggled_cb (TestWidget     *self,
+                            GtkCheckButton *button)
 {
-       GtkTextBuffer *buffer;
-       g_return_if_fail (GTK_IS_TOGGLE_ACTION (action) && GTK_SOURCE_IS_VIEW (user_data));
-       buffer = gtk_text_view_get_buffer (user_data);
-       gtk_source_buffer_set_highlight_syntax (
-               GTK_SOURCE_BUFFER (buffer),
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+       gboolean enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+       gtk_source_buffer_set_highlight_syntax (self->priv->source_buffer, enabled);
 }
 
 static void
-hl_bracket_toggled_cb (GtkAction *action,
-                      gpointer   user_data)
+highlight_matching_bracket_toggled_cb (TestWidget     *self,
+                                      GtkCheckButton *button)
 {
-       GtkTextBuffer *buffer;
-       g_return_if_fail (GTK_IS_TOGGLE_ACTION (action) && GTK_SOURCE_IS_VIEW (user_data));
-       buffer = gtk_text_view_get_buffer (user_data);
-       gtk_source_buffer_set_highlight_matching_brackets (
-               GTK_SOURCE_BUFFER (buffer),
-               gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action)));
+       gboolean enabled = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+       gtk_source_buffer_set_highlight_matching_brackets (self->priv->source_buffer, enabled);
 }
 
 static void
@@ -652,15 +648,12 @@ backward_string_cb (GtkAction *action,
 /* Buffer action callbacks */
 
 static void
-open_file_cb (GtkAction *action,
-             gpointer   user_data)
+open_button_clicked_cb (TestWidget *self)
 {
        GtkWidget *chooser;
        gint response;
        static gchar *last_dir;
 
-       g_return_if_fail (GTK_SOURCE_IS_BUFFER (user_data));
-
        chooser = gtk_file_chooser_dialog_new ("Open file...",
                                               NULL,
                                               GTK_FILE_CHOOSER_ACTION_OPEN,
@@ -691,7 +684,7 @@ open_file_cb (GtkAction *action,
                {
                        g_free (last_dir);
                        last_dir = gtk_file_chooser_get_current_folder (GTK_FILE_CHOOSER (chooser));
-                       open_file (GTK_SOURCE_BUFFER (user_data), filename);
+                       open_file (self, filename);
                        g_free (filename);
                }
        }
@@ -821,36 +814,26 @@ end_print (GtkPrintOperation        *operation,
 #undef SETUP_FROM_VIEW
 
 static void
-print_file_cb (GtkAction *action,
-              gpointer   user_data)
+print_button_clicked_cb (TestWidget *self)
 {
-       GtkSourceView *view;
-       GtkSourceBuffer *buffer;
        GtkSourcePrintCompositor *compositor;
        GtkPrintOperation *operation;
        const gchar *filename;
        gchar *basename;
 
-       g_return_if_fail (GTK_SOURCE_IS_VIEW (user_data));
-
-       view = GTK_SOURCE_VIEW (user_data);
-
-       buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view)));
-
-       filename = g_object_get_data (G_OBJECT (buffer), "filename");
+       filename = g_object_get_data (G_OBJECT (self->priv->source_buffer), "filename");
        basename = g_filename_display_basename (filename);
 
 #ifdef SETUP_FROM_VIEW
-       compositor = gtk_source_print_compositor_new_from_view (view);
+       compositor = gtk_source_print_compositor_new_from_view (self->priv->source_view);
 #else
-
-       compositor = gtk_source_print_compositor_new (buffer);
+       compositor = gtk_source_print_compositor_new (self->priv->source_buffer);
 
        gtk_source_print_compositor_set_tab_width (compositor,
-                                                  gtk_source_view_get_tab_width (view));
+                                                  gtk_source_view_get_tab_width (self->priv->source_view));
 
        gtk_source_print_compositor_set_wrap_mode (compositor,
-                                                  gtk_text_view_get_wrap_mode (GTK_TEXT_VIEW (view)));
+                                                  gtk_text_view_get_wrap_mode (GTK_TEXT_VIEW 
(self->priv->source_view)));
 
        gtk_source_print_compositor_set_print_line_numbers (compositor, 1);
 
@@ -1297,13 +1280,6 @@ create_main_window (GtkSourceBuffer *buffer)
        window = create_view_window (buffer, NULL);
        ui_manager = g_object_get_data (G_OBJECT (window), "ui_manager");
 
-       /* buffer action group */
-       action_group = gtk_action_group_new ("BufferActions");
-       gtk_action_group_add_actions (action_group, buffer_action_entries,
-                                     G_N_ELEMENTS (buffer_action_entries), buffer);
-       gtk_ui_manager_insert_action_group (ui_manager, action_group, 1);
-       g_object_unref (action_group);
-
        /* merge buffer ui */
        if (!gtk_ui_manager_add_ui_from_string (ui_manager, buffer_ui_description, -1, &error))
        {
@@ -1346,19 +1322,71 @@ create_main_window (GtkSourceBuffer *buffer)
        return window;
 }
 
+/* Class init, dispose, etc. */
+
+static void
+test_widget_dispose (GObject *object)
+{
+       TestWidget *self = TEST_WIDGET (object);
+
+       g_clear_object (&self->priv->source_buffer);
+
+       G_OBJECT_CLASS (test_widget_parent_class)->dispose (object);
+}
+
+static void
+test_widget_class_init (TestWidgetClass *klass)
+{
+       GObjectClass *object_class = G_OBJECT_CLASS (klass);
+       GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+
+       object_class->dispose = test_widget_dispose;
+
+       gtk_widget_class_set_template_from_resource (widget_class,
+                                                    "/org/gnome/gtksourceview/tests/ui/test-widget.ui");
+
+       gtk_widget_class_bind_template_callback (widget_class, open_button_clicked_cb);
+       gtk_widget_class_bind_template_callback (widget_class, print_button_clicked_cb);
+       gtk_widget_class_bind_template_callback (widget_class, highlight_syntax_toggled_cb);
+       gtk_widget_class_bind_template_callback (widget_class, highlight_matching_bracket_toggled_cb);
+       gtk_widget_class_bind_template_callback (widget_class, show_line_numbers_toggled_cb);
+
+       gtk_widget_class_bind_template_child_private (widget_class, TestWidget, source_view);
+}
+
+static void
+test_widget_init (TestWidget *self)
+{
+       self->priv = test_widget_get_instance_private (self);
+
+       gtk_widget_init_template (GTK_WIDGET (self));
+
+       self->priv->source_buffer = GTK_SOURCE_BUFFER (
+               gtk_text_view_get_buffer (GTK_TEXT_VIEW (self->priv->source_view)));
+
+       g_object_ref (self->priv->source_buffer);
+
+       open_file (self, TOP_SRCDIR "/gtksourceview/gtksourcebuffer.c");
+}
+
+static TestWidget *
+test_widget_new (void)
+{
+       return g_object_new (test_widget_get_type (), NULL);
+}
+
 /* Program entry point */
 
 int
 main (int argc, char *argv[])
 {
+       GtkSourceLanguageManager *language_manager;
+       GtkSourceStyleSchemeManager *style_scheme_manager;
        GtkWidget *window;
-       GtkSourceLanguageManager *lm;
-       GtkSourceStyleSchemeManager *sm;
-       GtkSourceBuffer *buffer;
+       TestWidget *test_widget;
 
-       gboolean no_syntax = FALSE;
        gchar *builtin_lang_dirs[] = {TOP_SRCDIR "/data/language-specs", NULL};
-       gchar *builtin_sm_dirs[] = {TOP_SRCDIR "/data/styles", NULL};
+       gchar *builtin_styles_dirs[] = {TOP_SRCDIR "/data/styles", NULL};
        gchar **dirs;
        const gchar * const * schemes;
        gboolean use_default_paths = FALSE;
@@ -1367,7 +1395,6 @@ main (int argc, char *argv[])
        GOptionContext *context;
 
        GOptionEntry entries[] = {
-         { "no-syntax", 'n', 0, G_OPTION_ARG_NONE, &no_syntax, "Disable syntax highlighting", NULL},
          { "style-scheme", 's', 0, G_OPTION_ARG_STRING, &style_scheme_id, "Style scheme name to use", 
"SCHEME"},
          { "default-paths", 'd', 0, G_OPTION_ARG_NONE, &use_default_paths, "Use default search paths", NULL},
          { NULL }
@@ -1378,29 +1405,32 @@ main (int argc, char *argv[])
        g_option_context_add_group (context, gtk_get_option_group (TRUE));
        g_option_context_parse (context, &argc, &argv, NULL);
 
+       gtk_init (&argc, &argv);
+
        /* we do not use defaults so we don't need to install the library */
        dirs = use_default_paths ? NULL : builtin_lang_dirs;
-       lm = gtk_source_language_manager_get_default ();
-       gtk_source_language_manager_set_search_path (lm, dirs);
+       language_manager = gtk_source_language_manager_get_default ();
+       gtk_source_language_manager_set_search_path (language_manager, dirs);
 
-       dirs = use_default_paths ? NULL : builtin_sm_dirs;
+       dirs = use_default_paths ? NULL : builtin_styles_dirs;
 
-       sm = gtk_source_style_scheme_manager_get_default ();
-       gtk_source_style_scheme_manager_set_search_path (sm, dirs);
+       style_scheme_manager = gtk_source_style_scheme_manager_get_default ();
+       gtk_source_style_scheme_manager_set_search_path (style_scheme_manager, dirs);
 
        if (!use_default_paths)
        {
-               gtk_source_style_scheme_manager_append_search_path (sm, TOP_SRCDIR "/tests/test-scheme.xml");
+               gtk_source_style_scheme_manager_append_search_path (style_scheme_manager,
+                                                                   TOP_SRCDIR "/tests/test-scheme.xml");
        }
 
-       schemes = gtk_source_style_scheme_manager_get_scheme_ids (sm);
+       schemes = gtk_source_style_scheme_manager_get_scheme_ids (style_scheme_manager);
        g_print ("Available style schemes:\n");
        while (*schemes != NULL)
        {
                const gchar* const *authors;
                gchar *authors_str = NULL;
 
-               style_scheme = gtk_source_style_scheme_manager_get_scheme (sm, *schemes);
+               style_scheme = gtk_source_style_scheme_manager_get_scheme (style_scheme_manager, *schemes);
 
                authors = gtk_source_style_scheme_get_authors (style_scheme);
                if (authors != NULL)
@@ -1426,38 +1456,25 @@ main (int argc, char *argv[])
 
        if (style_scheme_id != NULL)
        {
-               style_scheme = gtk_source_style_scheme_manager_get_scheme (sm, style_scheme_id);
+               style_scheme = gtk_source_style_scheme_manager_get_scheme (style_scheme_manager, 
style_scheme_id);
        }
        else
        {
                style_scheme = NULL;
        }
 
-       /* create buffer */
-       buffer = gtk_source_buffer_new (NULL);
+       window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+       gtk_window_set_default_size (GTK_WINDOW (window), 700, 500);
 
-       gtk_source_buffer_set_highlight_syntax (buffer, !no_syntax);
+       g_signal_connect (window, "destroy", gtk_main_quit, NULL);
 
-       if (argc > 1)
-       {
-               open_file (buffer, argv [1]);
-       }
-       else
-       {
-               open_file (buffer, TOP_SRCDIR "/gtksourceview/gtksourcebuffer.c");
-       }
+       test_widget = test_widget_new ();
+       gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (test_widget));
 
-       /* create first window */
-       window = create_main_window (buffer);
-       gtk_window_set_default_size (GTK_WINDOW (window), 500, 500);
        gtk_widget_show (window);
 
-       /* ... and action! */
        gtk_main ();
 
-       /* cleanup */
-       g_object_unref (buffer);
-
        g_free (style_scheme_id);
 
        return 0;
diff --git a/tests/test-widget.gresource.xml b/tests/test-widget.gresource.xml
new file mode 100644
index 0000000..7568a08
--- /dev/null
+++ b/tests/test-widget.gresource.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<gresources>
+  <gresource prefix="/org/gnome/gtksourceview/tests/ui">
+    <file preprocess="xml-stripblanks">test-widget.ui</file>
+  </gresource>
+</gresources>
diff --git a/tests/test-widget.ui b/tests/test-widget.ui
new file mode 100644
index 0000000..02e8270
--- /dev/null
+++ b/tests/test-widget.ui
@@ -0,0 +1,396 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.16.0 -->
+<interface>
+  <requires lib="gtk+" version="3.10"/>
+  <requires lib="gtksourceview" version="3.0"/>
+  <object class="GtkAdjustment" id="adjustment_indent_width">
+    <property name="lower">-1</property>
+    <property name="upper">16</property>
+    <property name="value">-1</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <object class="GtkAdjustment" id="adjustment_tab_width">
+    <property name="upper">16</property>
+    <property name="value">8</property>
+    <property name="step_increment">1</property>
+    <property name="page_increment">10</property>
+  </object>
+  <template class="TestWidget" parent="GtkGrid">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="border_width">6</property>
+    <property name="column_spacing">4</property>
+    <child>
+      <object class="GtkScrolledWindow" id="scrolledwindow1">
+        <property name="width_request">400</property>
+        <property name="height_request">400</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="shadow_type">in</property>
+        <child>
+          <object class="GtkSourceView" id="source_view">
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="hexpand">True</property>
+            <property name="vexpand">True</property>
+            <property name="left_margin">2</property>
+            <property name="right_margin">2</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">1</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+    <child>
+      <object class="GtkGrid" id="grid2">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="row_spacing">2</property>
+        <child>
+          <object class="GtkButton" id="open_button">
+            <property name="label">Open File</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <signal name="clicked" handler="open_button_clicked_cb" object="TestWidget" swapped="yes"/>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">0</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkButton" id="print_button">
+            <property name="label">Print</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">True</property>
+            <signal name="clicked" handler="print_button_clicked_cb" object="TestWidget" swapped="yes"/>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">1</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label">General options</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">2</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid3">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkCheckButton" id="highlight_syntax">
+                <property name="label">Highlight syntax</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="active">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="highlight_syntax_toggled_cb" object="TestWidget" 
swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="highlight_matching_bracket">
+                <property name="label">Highlight matching bracket</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="active">True</property>
+                <property name="draw_indicator">True</property>
+                <signal name="toggled" handler="highlight_matching_bracket_toggled_cb" object="TestWidget" 
swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="show_line_numbers">
+                <property name="label">Show line numbers</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>
+                <signal name="toggled" handler="show_line_numbers_toggled_cb" object="TestWidget" 
swapped="yes"/>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="show_line_marks">
+                <property name="label">Show line marks</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">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="show_right_margin">
+                <property name="label">Show right margin</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>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="highlight_current_line">
+                <property name="label">Highlight current line</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">5</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="draw_spaces">
+                <property name="label">Draw spaces</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">6</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="wrap_lines">
+                <property name="label">Wrap lines</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">7</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">3</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel" id="label2">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="xalign">0</property>
+            <property name="label">Indentation</property>
+            <attributes>
+              <attribute name="weight" value="bold"/>
+            </attributes>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">4</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid4">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <child>
+              <object class="GtkCheckButton" id="auto_indent">
+                <property name="label">Auto indent</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">0</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkCheckButton" id="indent_spaces">
+                <property name="label">Insert spaces instead of tabs</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">1</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid5">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="column_spacing">4</property>
+                <child>
+                  <object class="GtkLabel" id="label3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label">Tab width:</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkSpinButton" id="tab_width">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="adjustment">adjustment_tab_width</property>
+                    <property name="value">8</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">2</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkGrid" id="grid6">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="column_spacing">4</property>
+                <child>
+                  <object class="GtkSpinButton" id="indent_width">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="adjustment">adjustment_indent_width</property>
+                    <property name="value">-1</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">1</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkLabel" id="label4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="label">Indent width:</property>
+                  </object>
+                  <packing>
+                    <property name="left_attach">0</property>
+                    <property name="top_attach">0</property>
+                    <property name="width">1</property>
+                    <property name="height">1</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">0</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="left_attach">0</property>
+            <property name="top_attach">5</property>
+            <property name="width">1</property>
+            <property name="height">1</property>
+          </packing>
+        </child>
+      </object>
+      <packing>
+        <property name="left_attach">0</property>
+        <property name="top_attach">0</property>
+        <property name="width">1</property>
+        <property name="height">1</property>
+      </packing>
+    </child>
+  </template>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]