[gtk+/composite-templates-new: 9/14] GtkAssistant: Define children with a GtkBuilder template



commit 46a20634cb0029c444eb49c2cdc4ec4c9cc887aa
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Sat Mar 23 19:10:34 2013 +0900

    GtkAssistant: Define children with a GtkBuilder template

 gtk/Makefile.am       |    1 +
 gtk/gtk.gresource.xml |    1 +
 gtk/gtkassistant.c    |  229 ++++++++++++++++++-------------------------------
 gtk/gtkassistant.ui   |  223 +++++++++++++++++++++++++++++++++++++++++++++++
 gtk/tests/templates.c |   11 +++
 po/POTFILES.in        |    1 +
 6 files changed, 321 insertions(+), 145 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index da17a06..166d000 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1095,6 +1095,7 @@ DND_CURSORS = \
 
 COMPOSITE_TEMPLATES =                  \
        gtkaboutdialog.ui               \
+       gtkassistant.ui                 \
        gtkdialog.ui                    \
        gtkinfobar.ui                   \
        gtklockbutton.ui                \
diff --git a/gtk/gtk.gresource.xml b/gtk/gtk.gresource.xml
index e1c44dd..f4452be 100644
--- a/gtk/gtk.gresource.xml
+++ b/gtk/gtk.gresource.xml
@@ -12,6 +12,7 @@
     <file alias="cursor/dnd-move.png">cursor_dnd_move.png</file>
     <file alias="cursor/dnd-copy.png">cursor_dnd_copy.png</file>
     <file>gtkaboutdialog.ui</file>
+    <file>gtkassistant.ui</file>
     <file>gtkdialog.ui</file>
     <file>gtkinfobar.ui</file>
     <file>gtklockbutton.ui</file>
diff --git a/gtk/gtkassistant.c b/gtk/gtkassistant.c
index 3ba9f22..8746508 100644
--- a/gtk/gtkassistant.c
+++ b/gtk/gtkassistant.c
@@ -149,9 +149,6 @@ static void     gtk_assistant_get_child_property (GtkContainer      *container,
                                                   GParamSpec        *pspec);
 
 static void       gtk_assistant_buildable_interface_init     (GtkBuildableIface *iface);
-static GObject   *gtk_assistant_buildable_get_internal_child (GtkBuildable  *buildable,
-                                                              GtkBuilder    *builder,
-                                                              const gchar   *childname);
 static gboolean   gtk_assistant_buildable_custom_tag_start   (GtkBuildable  *buildable,
                                                               GtkBuilder    *builder,
                                                               GObject       *child,
@@ -173,6 +170,25 @@ static void       gtk_assistant_do_set_page_side_image       (GtkAssistant  *ass
                                                               GtkWidget     *page,
                                                               GdkPixbuf     *pixbuf);
 
+static gboolean   assistant_sidebar_draw_cb                  (GtkWidget     *widget,
+                                                             cairo_t       *cr,
+                                                             gpointer       user_data);
+static void       on_assistant_close                         (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       on_assistant_apply                         (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       on_assistant_forward                       (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       on_assistant_back                          (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       on_assistant_cancel                        (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       on_assistant_last                          (GtkWidget     *widget,
+                                                             GtkAssistant  *assistant);
+static void       assistant_remove_page_cb                   (GtkNotebook   *notebook,
+                                                             GtkWidget     *page,
+                                                             GtkAssistant  *assistant);
+
 GType             _gtk_assistant_accessible_get_type         (void);
 
 enum
@@ -410,6 +426,44 @@ gtk_assistant_class_init (GtkAssistantClass *class)
                                                                     FALSE,
                                                                     G_PARAM_READWRITE));
 
+
+  gtk_container_class_set_template (container_class,
+                                   GTK_TEMPLATE_SOURCE_RESOURCE,
+                                   "/org/gtk/libgtk/gtkassistant.ui");
+  gtk_container_class_automate_child (container_class, "content", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, content));
+  gtk_container_class_automate_child (container_class, "action_area", TRUE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, action_area));
+  gtk_container_class_automate_child (container_class, "cancel", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, cancel));
+  gtk_container_class_automate_child (container_class, "forward", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, forward));
+  gtk_container_class_automate_child (container_class, "back", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, back));
+  gtk_container_class_automate_child (container_class, "apply", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, apply));
+  gtk_container_class_automate_child (container_class, "close", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, close));
+  gtk_container_class_automate_child (container_class, "last", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, last));
+  gtk_container_class_automate_child (container_class, "sidebar", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, sidebar));
+  gtk_container_class_automate_child (container_class, "button_size_group", FALSE, 
GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, button_size_group));
+  gtk_container_class_automate_child (container_class, "title_size_group", FALSE, GTK_AUTOMATE_CHILD_PRIVATE,
+                                     G_STRUCT_OFFSET (GtkAssistantPrivate, title_size_group));
+
+  gtk_container_class_declare_callbacks (container_class,
+                                        "assistant_sidebar_draw_cb", (GCallback)assistant_sidebar_draw_cb,
+                                        "assistant_remove_page_cb", (GCallback)assistant_remove_page_cb,
+                                        "on_assistant_close", (GCallback)on_assistant_close,
+                                        "on_assistant_apply", (GCallback)on_assistant_apply,
+                                        "on_assistant_forward", (GCallback)on_assistant_forward,
+                                        "on_assistant_back", (GCallback)on_assistant_back,
+                                        "on_assistant_cancel", (GCallback)on_assistant_cancel,
+                                        "on_assistant_last", (GCallback)on_assistant_last,
+                                        NULL);
+
   g_type_class_add_private (gobject_class, sizeof (GtkAssistantPrivate));
 }
 
@@ -953,115 +1007,11 @@ static void
 gtk_assistant_init (GtkAssistant *assistant)
 {
   GtkAssistantPrivate *priv;
-  GtkStyleContext *context;
-  GtkWidget *main_box;
-  GtkWidget *content_box;
-  GtkWidget *sidebar_frame;
 
   assistant->priv = G_TYPE_INSTANCE_GET_PRIVATE (assistant,
                                                  GTK_TYPE_ASSISTANT,
                                                  GtkAssistantPrivate);
   priv = assistant->priv;
-
-  /* use border on inner panes instead */
-  gtk_container_set_border_width (GTK_CONTAINER (assistant), 0);
-
-  gtk_widget_push_composite_child ();
-
-  main_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-  priv->sidebar = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-
-  /* use a frame for the sidebar, and manually render a background
-   * in it. GtkFrame also gives us padding support for free.
-   */
-  sidebar_frame = gtk_frame_new (NULL);
-  context = gtk_widget_get_style_context (sidebar_frame);
-  gtk_style_context_add_class (context, GTK_STYLE_CLASS_SIDEBAR);
-
-  g_signal_connect (sidebar_frame, "draw",
-                    G_CALLBACK (assistant_sidebar_draw_cb), assistant);
-
-  content_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-  gtk_container_set_border_width (GTK_CONTAINER (content_box), 12);
-  priv->content = gtk_notebook_new ();
-  gtk_notebook_set_show_border (GTK_NOTEBOOK (priv->content), FALSE);
-  gtk_notebook_set_show_tabs (GTK_NOTEBOOK (priv->content), FALSE);
-  priv->action_area = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-
-  g_signal_connect (priv->content, "remove",
-                    G_CALLBACK (assistant_remove_page_cb), assistant);
-
-  gtk_container_add (GTK_CONTAINER (sidebar_frame), priv->sidebar);
-  gtk_box_pack_start (GTK_BOX (main_box), sidebar_frame, FALSE, FALSE, 0);
-  gtk_box_pack_start (GTK_BOX (main_box), content_box, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (content_box), priv->content, TRUE, TRUE, 0);
-  gtk_box_pack_start (GTK_BOX (content_box), priv->action_area, FALSE, TRUE, 0);
-  gtk_widget_set_halign (priv->action_area, GTK_ALIGN_END);
-
-  gtk_widget_show_all (main_box);
-
-  gtk_widget_set_parent (main_box, GTK_WIDGET (assistant));
-  _gtk_bin_set_child (GTK_BIN (assistant), main_box);
-
-  priv->close   = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
-  priv->apply   = gtk_button_new_from_stock (GTK_STOCK_APPLY);
-  priv->forward = gtk_button_new_with_mnemonic (_("C_ontinue"));
-  gtk_button_set_image (GTK_BUTTON (priv->forward),
-      gtk_image_new_from_stock (GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON));
-  priv->back    = gtk_button_new_with_mnemonic (_("Go _Back"));
-  gtk_button_set_image (GTK_BUTTON (priv->back),
-      gtk_image_new_from_stock (GTK_STOCK_GO_BACK, GTK_ICON_SIZE_BUTTON));
-  priv->cancel  = gtk_button_new_from_stock (GTK_STOCK_CANCEL);
-  priv->last    = gtk_button_new_with_mnemonic (_("_Finish"));
-  gtk_button_set_image (GTK_BUTTON (priv->last),
-      gtk_image_new_from_stock (GTK_STOCK_GOTO_LAST, GTK_ICON_SIZE_BUTTON));
-  gtk_widget_set_can_default (priv->close, TRUE);
-  gtk_widget_set_can_default (priv->apply, TRUE);
-  gtk_widget_set_can_default (priv->forward, TRUE);
-
-  priv->button_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-  gtk_size_group_add_widget (priv->button_size_group, priv->close);
-  gtk_size_group_add_widget (priv->button_size_group, priv->apply);
-  gtk_size_group_add_widget (priv->button_size_group, priv->forward);
-  gtk_size_group_add_widget (priv->button_size_group, priv->back);
-  gtk_size_group_add_widget (priv->button_size_group, priv->cancel);
-  gtk_size_group_add_widget (priv->button_size_group, priv->last);
-
-  gtk_widget_set_no_show_all (priv->close, TRUE);
-  gtk_widget_set_no_show_all (priv->apply, TRUE);
-  gtk_widget_set_no_show_all (priv->forward, TRUE);
-  gtk_widget_set_no_show_all (priv->back, TRUE);
-  gtk_widget_set_no_show_all (priv->cancel, TRUE);
-  gtk_widget_set_no_show_all (priv->last, TRUE);
-
-  if (!alternative_button_order (assistant))
-    {
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
-    }
-  else
-    {
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->close, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->cancel, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->apply, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->forward, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->back, FALSE, FALSE, 0);
-      gtk_box_pack_end (GTK_BOX (priv->action_area), priv->last, FALSE, FALSE, 0);
-    }
-
-  gtk_widget_show (priv->forward);
-  gtk_widget_show (priv->back);
-  gtk_widget_show (priv->cancel);
-  gtk_widget_show (priv->action_area);
-
-  gtk_widget_pop_composite_child ();
-
-  priv->title_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
   priv->pages = NULL;
   priv->current_page = NULL;
   priv->visited_pages = NULL;
@@ -1070,18 +1020,20 @@ gtk_assistant_init (GtkAssistant *assistant)
   priv->forward_function_data = assistant;
   priv->forward_data_destroy = NULL;
 
-  g_signal_connect (G_OBJECT (priv->close), "clicked",
-                    G_CALLBACK (on_assistant_close), assistant);
-  g_signal_connect (G_OBJECT (priv->apply), "clicked",
-                    G_CALLBACK (on_assistant_apply), assistant);
-  g_signal_connect (G_OBJECT (priv->forward), "clicked",
-                    G_CALLBACK (on_assistant_forward), assistant);
-  g_signal_connect (G_OBJECT (priv->back), "clicked",
-                    G_CALLBACK (on_assistant_back), assistant);
-  g_signal_connect (G_OBJECT (priv->cancel), "clicked",
-                    G_CALLBACK (on_assistant_cancel), assistant);
-  g_signal_connect (G_OBJECT (priv->last), "clicked",
-                    G_CALLBACK (on_assistant_last), assistant);
+  gtk_container_init_template (GTK_CONTAINER (assistant));
+
+  if (alternative_button_order (assistant))
+    {
+      GList *buttons, *l;
+
+      /* Reverse the action area children for the alternative button order setting */
+      buttons = gtk_container_get_children (GTK_CONTAINER (priv->action_area));
+
+      for (l = buttons; l; l = l->next)
+       gtk_box_reorder_child (GTK_BOX (priv->action_area), GTK_WIDGET (l->data), -1);
+
+      g_list_free (buttons);
+    }
 }
 
 static void
@@ -1189,18 +1141,6 @@ gtk_assistant_destroy (GtkWidget *widget)
   if (priv->action_area)
     priv->action_area = NULL;
 
-  if (priv->button_size_group)
-    {
-      g_object_unref (priv->button_size_group);
-      priv->button_size_group = NULL;
-    }
-
-  if (priv->title_size_group)
-    {
-      g_object_unref (priv->title_size_group);
-      priv->title_size_group = NULL;
-    }
-
   if (priv->forward_function)
     {
       if (priv->forward_function_data &&
@@ -1309,6 +1249,19 @@ static void
 gtk_assistant_add (GtkContainer *container,
                    GtkWidget    *page)
 {
+  /* A bit tricky here, GtkAssistant doesnt exactly play by 
+   * the rules by allowing gtk_container_add() to insert pages.
+   *
+   * For the first invocation (from the builder template invocation),
+   * let's make sure we add the actual direct container content properly.
+   */
+  if (!gtk_bin_get_child (GTK_BIN (container)))
+    {
+      gtk_widget_set_parent (page, GTK_WIDGET (container));
+      _gtk_bin_set_child (GTK_BIN (container), page);
+      return;
+    }
+
   gtk_assistant_append_page (GTK_ASSISTANT (container), page);
 }
 
@@ -2354,24 +2307,10 @@ static void
 gtk_assistant_buildable_interface_init (GtkBuildableIface *iface)
 {
   parent_buildable_iface = g_type_interface_peek_parent (iface);
-  iface->get_internal_child = gtk_assistant_buildable_get_internal_child;
   iface->custom_tag_start = gtk_assistant_buildable_custom_tag_start;
   iface->custom_finished = gtk_assistant_buildable_custom_finished;
 }
 
-static GObject *
-gtk_assistant_buildable_get_internal_child (GtkBuildable *buildable,
-                                            GtkBuilder   *builder,
-                                            const gchar  *childname)
-{
-    if (strcmp (childname, "action_area") == 0)
-      return G_OBJECT (GTK_ASSISTANT (buildable)->priv->action_area);
-
-    return parent_buildable_iface->get_internal_child (buildable,
-                                                       builder,
-                                                       childname);
-}
-
 gboolean
 gtk_assistant_buildable_custom_tag_start (GtkBuildable  *buildable,
                                           GtkBuilder    *builder,
diff --git a/gtk/gtkassistant.ui b/gtk/gtkassistant.ui
new file mode 100644
index 0000000..30c1f7a
--- /dev/null
+++ b/gtk/gtkassistant.ui
@@ -0,0 +1,223 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="gtk30">
+  <!-- interface-requires gtk+ 3.10 -->
+  <object class="GtkImage" id="back_image">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-go-back</property>
+  </object>
+  <object class="GtkImage" id="forward_image">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-go-forward</property>
+  </object>
+  <object class="GtkImage" id="last_image">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="stock">gtk-goto-last</property>
+  </object>
+  <template class="GtkAssistant" parent="GtkWindow">
+    <property name="can_focus">False</property>
+    <child>
+      <object class="GtkBox" id="main_box">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="spacing">12</property>
+        <child>
+          <object class="GtkFrame" id="sidebar_frame">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="label_xalign">0</property>
+            <property name="shadow_type">none</property>
+            <style>
+              <class name="sidebar"/>
+            </style>
+            <signal name="draw" handler="assistant_sidebar_draw_cb" swapped="no"/>
+            <child>
+              <object class="GtkBox" id="sidebar">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+              </object>
+            </child>
+            <child type="label_item">
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="content_box">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">12</property>
+            <property name="orientation">vertical</property>
+            <property name="spacing">12</property>
+            <child>
+              <object class="GtkNotebook" id="content">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="show_tabs">False</property>
+                <property name="show_border">False</property>
+                <signal name="remove" handler="assistant_remove_page_cb" swapped="no"/>
+                <child>
+                  <placeholder/>
+                </child>
+                <child type="tab">
+                  <placeholder/>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">True</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkBox" id="action_area">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">end</property>
+                <property name="spacing">6</property>
+                <child>
+                  <object class="GtkButton" id="apply">
+                    <property name="label">gtk-apply</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_assistant_apply" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="forward">
+                    <property name="label" translatable="yes">C_ontinue</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="image">forward_image</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="on_assistant_forward" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">1</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="back">
+                    <property name="label" translatable="yes">Go _Back</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="image">back_image</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="on_assistant_back" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">2</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="last">
+                    <property name="label" translatable="yes">_Finish</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="image">last_image</property>
+                    <property name="use_underline">True</property>
+                    <signal name="clicked" handler="on_assistant_last" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">3</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="cancel">
+                    <property name="label">gtk-cancel</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_assistant_cancel" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">4</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkButton" id="close">
+                    <property name="label">gtk-close</property>
+                    <property name="can_focus">True</property>
+                    <property name="can_default">True</property>
+                    <property name="receives_default">True</property>
+                    <property name="no_show_all">True</property>
+                    <property name="use_stock">True</property>
+                    <signal name="clicked" handler="on_assistant_close" swapped="no"/>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">False</property>
+                    <property name="position">5</property>
+                  </packing>
+                </child>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+  <object class="GtkSizeGroup" id="button_size_group">
+    <widgets>
+      <widget name="apply"/>
+      <widget name="forward"/>
+      <widget name="back"/>
+      <widget name="last"/>
+      <widget name="cancel"/>
+      <widget name="close"/>
+    </widgets>
+  </object>
+  <object class="GtkSizeGroup" id="title_size_group"/>
+</interface>
diff --git a/gtk/tests/templates.c b/gtk/tests/templates.c
index e646ab4..1a646c9 100644
--- a/gtk/tests/templates.c
+++ b/gtk/tests/templates.c
@@ -88,6 +88,16 @@ test_lock_button_basic (void)
   g_object_unref (permission);
 }
 
+static void
+test_assistant_basic (void)
+{
+  GtkWidget *widget;
+
+  widget = gtk_assistant_new ();
+  g_assert (GTK_IS_ASSISTANT (widget));
+  gtk_widget_destroy (widget);
+}
+
 int
 main (int argc, char **argv)
 {
@@ -100,6 +110,7 @@ main (int argc, char **argv)
   g_test_add_func ("/Template/GtkAboutDialog/Basic", test_about_dialog_basic);
   g_test_add_func ("/Template/GtkInfoBar/Basic", test_info_bar_basic);
   g_test_add_func ("/Template/GtkLockButton/Basic", test_lock_button_basic);
+  g_test_add_func ("/Template/GtkAssistant/Basic", test_assistant_basic);
 
   return g_test_run();
 }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fce4726..6732b69 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -275,6 +275,7 @@ modules/printbackends/lpr/gtkprintbackendlpr.c
 modules/printbackends/papi/gtkprintbackendpapi.c
 modules/printbackends/test/gtkprintbackendtest.c
 [type: gettext/glade]gtk/gtkaboutdialog.ui
+[type: gettext/glade]gtk/gtkassistant.ui
 [type: gettext/glade]gtk/gtkdialog.ui
 [type: gettext/glade]gtk/gtkinfobar.ui
 [type: gettext/glade]gtk/gtklockbutton.ui


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