[gtk+/composite-templates-new: 25/32] GtkPageSetupUnixDialog: Define children with a GtkBuilder template



commit 6a0ea4af72113d87b2367c080bbe948fa7730ee7
Author: Tristan Van Berkom <tristanvb openismus com>
Date:   Wed Mar 27 00:02:25 2013 +0900

    GtkPageSetupUnixDialog: Define children with a GtkBuilder template

 gtk/Makefile.am               |    1 +
 gtk/gtk.gresource.xml         |    1 +
 gtk/gtkpagesetupunixdialog.c  |  208 +++++----------------
 gtk/gtkpagesetupunixdialog.ui |  413 +++++++++++++++++++++++++++++++++++++++++
 gtk/tests/Makefile.am         |    4 +
 gtk/tests/templates.c         |   21 ++
 po/POTFILES.in                |    1 +
 7 files changed, 492 insertions(+), 157 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 724df51..8e3963c 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1108,6 +1108,7 @@ COMPOSITE_TEMPLATES =                     \
        gtkinfobar.ui                   \
        gtklockbutton.ui                \
        gtkmessagedialog.ui             \
+       gtkpagesetupunixdialog.ui       \
        gtkrecentchooserdefault.ui      \
        gtkscalebutton.ui               \
        gtkstatusbar.ui
diff --git a/gtk/gtk.gresource.xml b/gtk/gtk.gresource.xml
index e5819b9..31c4728 100644
--- a/gtk/gtk.gresource.xml
+++ b/gtk/gtk.gresource.xml
@@ -24,6 +24,7 @@
     <file compressed="true">gtkinfobar.ui</file>
     <file compressed="true">gtklockbutton.ui</file>
     <file compressed="true">gtkmessagedialog.ui</file>
+    <file compressed="true">gtkpagesetupunixdialog.ui</file>
     <file compressed="true">gtkrecentchooserdefault.ui</file>
     <file compressed="true">gtkscalebutton.ui</file>
     <file compressed="true">gtkstatusbar.ui</file>
diff --git a/gtk/gtkpagesetupunixdialog.c b/gtk/gtkpagesetupunixdialog.c
index 801b251..df6b214 100644
--- a/gtk/gtkpagesetupunixdialog.c
+++ b/gtk/gtkpagesetupunixdialog.c
@@ -71,6 +71,7 @@ struct _GtkPageSetupUnixDialogPrivate
   GtkWidget *printer_combo;
   GtkWidget *paper_size_combo;
   GtkWidget *paper_size_label;
+  GtkCellRenderer *paper_size_cell;
 
   GtkWidget *portrait_radio;
   GtkWidget *reverse_portrait_radio;
@@ -88,6 +89,7 @@ struct _GtkPageSetupUnixDialogPrivate
   gchar *waiting_for_printer;
 };
 
+/* Keep these in line with GtkListStores defined in gtkpagesetupunixprintdialog.ui */
 enum {
   PRINTER_LIST_COL_NAME,
   PRINTER_LIST_COL_PRINTER,
@@ -103,7 +105,6 @@ enum {
 G_DEFINE_TYPE (GtkPageSetupUnixDialog, gtk_page_setup_unix_dialog, GTK_TYPE_DIALOG)
 
 static void gtk_page_setup_unix_dialog_finalize  (GObject                *object);
-static void populate_dialog                      (GtkPageSetupUnixDialog *dialog);
 static void fill_paper_sizes_from_printer        (GtkPageSetupUnixDialog *dialog,
                                                   GtkPrinter             *printer);
 static void printer_added_cb                     (GtkPrintBackend        *backend,
@@ -115,7 +116,19 @@ static void printer_removed_cb                   (GtkPrintBackend        *backen
 static void printer_status_cb                    (GtkPrintBackend        *backend,
                                                   GtkPrinter             *printer,
                                                   GtkPageSetupUnixDialog *dialog);
-
+static void printer_changed_callback             (GtkComboBox            *combo_box,
+                                                 GtkPageSetupUnixDialog *dialog);
+static void paper_size_changed                   (GtkComboBox            *combo_box,
+                                                 GtkPageSetupUnixDialog *dialog);
+static void page_name_func                       (GtkCellLayout          *cell_layout,
+                                                 GtkCellRenderer        *cell,
+                                                 GtkTreeModel           *tree_model,
+                                                 GtkTreeIter            *iter,
+                                                 gpointer                data);
+static void load_print_backends                  (GtkPageSetupUnixDialog *dialog);
+static gboolean paper_size_row_is_separator      (GtkTreeModel           *model,
+                                                 GtkTreeIter            *iter,
+                                                 gpointer                data);
 
 
 static const gchar const common_paper_sizes[][16] = {
@@ -138,11 +151,33 @@ static void
 gtk_page_setup_unix_dialog_class_init (GtkPageSetupUnixDialogClass *class)
 {
   GObjectClass *object_class;
+  GtkWidgetClass *widget_class;
 
-  object_class = (GObjectClass *) class;
+  object_class = G_OBJECT_CLASS (class);
+  widget_class = GTK_WIDGET_CLASS (class);
 
   object_class->finalize = gtk_page_setup_unix_dialog_finalize;
 
+  /* Bind class to template
+   */
+  gtk_widget_class_set_template_from_resource (widget_class,
+                                              "/org/gtk/libgtk/gtkpagesetupunixdialog.ui");
+
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, printer_list);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, page_setup_list);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, custom_paper_list);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, printer_combo);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, paper_size_combo);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, paper_size_label);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, paper_size_cell);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, portrait_radio);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, reverse_portrait_radio);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, landscape_radio);
+  gtk_widget_class_bind_child (widget_class, GtkPageSetupUnixDialogPrivate, reverse_landscape_radio);
+
+  gtk_widget_class_bind_callback (widget_class, printer_changed_callback);
+  gtk_widget_class_bind_callback (widget_class, paper_size_changed);
+
   g_type_class_add_private (class, sizeof (GtkPageSetupUnixDialogPrivate));
 }
 
@@ -159,10 +194,9 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
 
   priv->print_backends = NULL;
 
-  priv->printer_list = gtk_list_store_new (PRINTER_LIST_N_COLS,
-                                                   G_TYPE_STRING,
-                                                   G_TYPE_OBJECT);
+  gtk_widget_init_template (GTK_WIDGET (dialog));
 
+  /* Do this in code, we want the translatable strings without the markup */
   gtk_list_store_append (priv->printer_list, &iter);
   tmp = g_strdup_printf ("<b>%s</b>\n%s", _("Any Printer"), _("For portable documents"));
   gtk_list_store_set (priv->printer_list, &iter,
@@ -171,25 +205,24 @@ gtk_page_setup_unix_dialog_init (GtkPageSetupUnixDialog *dialog)
                       -1);
   g_free (tmp);
 
-  priv->page_setup_list = gtk_list_store_new (PAGE_SETUP_LIST_N_COLS,
-                                                      G_TYPE_OBJECT,
-                                                      G_TYPE_BOOLEAN);
+  /* After adding the above row, set it active */
+  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->printer_combo), 0);
 
-  priv->custom_paper_list = gtk_list_store_new (1, G_TYPE_OBJECT);
-  _gtk_print_load_custom_papers (priv->custom_paper_list);
+  /* Setup cell data func and separator func in code */
+  gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (priv->paper_size_combo),
+                                       paper_size_row_is_separator, NULL, NULL);
+  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (priv->paper_size_combo),
+                                     priv->paper_size_cell,
+                                      page_name_func, NULL, NULL);
 
-  populate_dialog (dialog);
+  /* Load data */
+  _gtk_print_load_custom_papers (priv->custom_paper_list);
+  load_print_backends (dialog);
 
-  gtk_dialog_add_buttons (GTK_DIALOG (dialog),
-                          GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-                          GTK_STOCK_APPLY, GTK_RESPONSE_OK,
-                          NULL);
   gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
                                            GTK_RESPONSE_OK,
                                            GTK_RESPONSE_CANCEL,
                                            -1);
-
-  gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
 }
 
 static void
@@ -846,145 +879,6 @@ page_name_func (GtkCellLayout   *cell_layout,
 
 }
 
-static GtkWidget *
-create_radio_button (GSList      *group,
-                     const gchar *stock_id)
-{
-  GtkWidget *radio_button, *image, *label, *hbox;
-  GtkStockItem item;
-
-  radio_button = gtk_radio_button_new (group);
-  image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_LARGE_TOOLBAR);
-  gtk_stock_lookup (stock_id, &item);
-  label = gtk_label_new (item.label);
-  hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-  gtk_container_add (GTK_CONTAINER (radio_button), hbox);
-  gtk_container_add (GTK_CONTAINER (hbox), image);
-  gtk_container_add (GTK_CONTAINER (hbox), label);
-
-  gtk_widget_show_all (radio_button);
-
-  return radio_button;
-}
-
-static void
-populate_dialog (GtkPageSetupUnixDialog *ps_dialog)
-{
-  GtkPageSetupUnixDialogPrivate *priv = ps_dialog->priv;
-  GtkDialog *dialog = GTK_DIALOG (ps_dialog);
-  GtkWidget *table, *label, *combo, *radio_button;
-  GtkWidget *action_area, *content_area;
-  GtkCellRenderer *cell;
-
-  gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
-
-  content_area = gtk_dialog_get_content_area (dialog);
-  action_area = gtk_dialog_get_action_area (dialog);
-
-  gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
-  gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
-  gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
-  gtk_box_set_spacing (GTK_BOX (action_area), 6);
-
-  table = gtk_grid_new ();
-  gtk_grid_set_row_spacing (GTK_GRID (table), 6);
-  gtk_grid_set_column_spacing (GTK_GRID (table), 12);
-  gtk_container_set_border_width (GTK_CONTAINER (table), 5);
-  gtk_box_pack_start (GTK_BOX (content_area), table, TRUE, TRUE, 0);
-  gtk_widget_show (table);
-
-  label = gtk_label_new_with_mnemonic (_("_Format for:"));
-  gtk_widget_set_halign (label, GTK_ALIGN_START);
-  gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 0, 1, 1);
-  gtk_widget_show (label);
-
-  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (priv->printer_list));
-  priv->printer_combo = combo;
-
-  cell = gtk_cell_renderer_text_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
-  gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
-                                  "markup", PRINTER_LIST_COL_NAME,
-                                  NULL);
-
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), combo, 1, 0, 3, 1);
-  gtk_widget_show (combo);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
-
-  label = gtk_label_new_with_mnemonic (_("_Paper size:"));
-  gtk_widget_set_halign (label, GTK_ALIGN_START);
-  gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 1, 1, 1);
-  gtk_widget_show (label);
-
-  combo = gtk_combo_box_new_with_model (GTK_TREE_MODEL (priv->page_setup_list));
-  priv->paper_size_combo = combo;
-  gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
-                                        paper_size_row_is_separator, NULL, NULL);
-
-  cell = gtk_cell_renderer_text_new ();
-  gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
-  gtk_cell_layout_set_cell_data_func (GTK_CELL_LAYOUT (combo), cell,
-                                      page_name_func, NULL, NULL);
-
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), combo, 1, 1, 3, 1);
-  gtk_widget_show (combo);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
-
-  label = gtk_label_new (NULL);
-  priv->paper_size_label = label;
-  gtk_widget_set_halign (label, GTK_ALIGN_START);
-  gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
-  gtk_grid_attach (GTK_GRID (table), label, 1, 2, 3, 1);
-  gtk_widget_show (label);
-
-  label = gtk_label_new_with_mnemonic (_("_Orientation:"));
-  gtk_widget_set_halign (label, GTK_ALIGN_START);
-  gtk_widget_set_valign (label, GTK_ALIGN_CENTER);
-  gtk_grid_attach (GTK_GRID (table), label, 0, 3, 1, 1);
-  gtk_widget_show (label);
-
-  radio_button = create_radio_button (NULL, GTK_STOCK_ORIENTATION_PORTRAIT);
-  priv->portrait_radio = radio_button;
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), radio_button, 1, 3, 1, 1);
-  gtk_label_set_mnemonic_widget (GTK_LABEL (label), radio_button);
-
-  radio_button = create_radio_button (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button)),
-                                      GTK_STOCK_ORIENTATION_REVERSE_PORTRAIT);
-  priv->reverse_portrait_radio = radio_button;
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), radio_button, 2, 3, 1, 1);
-
-  radio_button = create_radio_button (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button)),
-                                      GTK_STOCK_ORIENTATION_LANDSCAPE);
-  priv->landscape_radio = radio_button;
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), radio_button, 1, 4, 1, 1);
-  gtk_widget_show (radio_button);
-
-  radio_button = create_radio_button (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio_button)),
-                                      GTK_STOCK_ORIENTATION_REVERSE_LANDSCAPE);
-  priv->reverse_landscape_radio = radio_button;
-  gtk_widget_set_halign (combo, GTK_ALIGN_FILL);
-  gtk_widget_set_hexpand (combo, TRUE);
-  gtk_grid_attach (GTK_GRID (table), radio_button, 2, 4, 1, 1);
-
-  g_signal_connect (priv->paper_size_combo, "changed", G_CALLBACK (paper_size_changed), ps_dialog);
-  g_signal_connect (priv->printer_combo, "changed", G_CALLBACK (printer_changed_callback), ps_dialog);
-  gtk_combo_box_set_active (GTK_COMBO_BOX (priv->printer_combo), 0);
-
-  load_print_backends (ps_dialog);
-}
-
 /**
  * gtk_page_setup_unix_dialog_new:
  * @title: (allow-none): the title of the dialog, or %NULL
diff --git a/gtk/gtkpagesetupunixdialog.ui b/gtk/gtkpagesetupunixdialog.ui
new file mode 100644
index 0000000..65bc44a
--- /dev/null
+++ b/gtk/gtkpagesetupunixdialog.ui
@@ -0,0 +1,413 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="gtk30">
+  <!-- interface-requires gtk+ 3.6 -->
+  <object class="GtkListStore" id="custom_paper_list">
+    <columns>
+      <!-- column-name paper -->
+      <column type="GObject"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="page_setup_list">
+    <columns>
+      <!-- column-name page-setup -->
+      <column type="GObject"/>
+      <!-- column-name is-separator -->
+      <column type="gboolean"/>
+    </columns>
+  </object>
+  <object class="GtkListStore" id="printer_list">
+    <columns>
+      <!-- column-name name -->
+      <column type="gchararray"/>
+      <!-- column-name printer -->
+      <column type="GObject"/>
+    </columns>
+  </object>
+  <template class="GtkPageSetupUnixDialog" parent="GtkDialog">
+    <property name="can_focus">False</property>
+    <property name="border_width">5</property>
+    <property name="resizable">False</property>
+    <property name="type_hint">dialog</property>
+    <child internal-child="vbox">
+      <object class="GtkBox" id="dialog-vbox1">
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">2</property>
+        <child internal-child="action_area">
+          <object class="GtkButtonBox" id="dialog-action_area1">
+            <property name="can_focus">False</property>
+            <property name="layout_style">end</property>
+            <child>
+              <object class="GtkButton" id="cancel_button">
+                <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="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkButton" id="apply_button">
+                <property name="label">gtk-apply</property>
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="can_default">True</property>
+                <property name="has_default">True</property>
+                <property name="receives_default">True</property>
+                <property name="use_stock">True</property>
+              </object>
+              <packing>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">1</property>
+              </packing>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="pack_type">end</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkGrid" id="grid1">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="border_width">5</property>
+            <property name="row_spacing">6</property>
+            <property name="column_spacing">12</property>
+            <child>
+              <object class="GtkLabel" id="printer_combo_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">_Format for:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">printer_combo</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="GtkComboBox" id="printer_combo">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="model">printer_list</property>
+                <signal name="changed" handler="printer_changed_callback" swapped="no"/>
+                <child>
+                  <object class="GtkCellRendererText" id="printer_combo_renderer"/>
+                  <attributes>
+                    <attribute name="markup">0</attribute>
+                  </attributes>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">0</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="paper_size_combo_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">_Paper size:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">paper_size_combo</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="GtkComboBox" id="paper_size_combo">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="hexpand">True</property>
+                <property name="model">page_setup_list</property>
+                <signal name="changed" handler="paper_size_changed" swapped="no"/>
+                <child>
+                  <object class="GtkCellRendererText" id="paper_size_cell"/>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">1</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="paper_size_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+                <property name="width">3</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkLabel" id="orientation_label">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="halign">start</property>
+                <property name="valign">center</property>
+                <property name="label" translatable="yes">_Orientation:</property>
+                <property name="use_underline">True</property>
+                <property name="mnemonic_widget">portrait_radio</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="GtkRadioButton" id="portrait_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <child>
+                  <object class="GtkBox" id="box1">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkImage" id="image1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-orientation-portrait</property>
+                        <property name="icon_size">3</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label1">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Portrait</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="reverse_portrait_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">portrait_radio</property>
+                <child>
+                  <object class="GtkBox" id="box2">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkImage" id="image2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-orientation-reverse-portrait</property>
+                        <property name="icon_size">3</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label2">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Reverse portrait</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">3</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="landscape_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="active">True</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">portrait_radio</property>
+                <child>
+                  <object class="GtkBox" id="box3">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkImage" id="image3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-orientation-landscape</property>
+                        <property name="icon_size">3</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label3">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Landscape</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkRadioButton" id="reverse_landscape_radio">
+                <property name="visible">True</property>
+                <property name="can_focus">True</property>
+                <property name="receives_default">False</property>
+                <property name="hexpand">True</property>
+                <property name="xalign">0</property>
+                <property name="draw_indicator">True</property>
+                <property name="group">portrait_radio</property>
+                <child>
+                  <object class="GtkBox" id="box4">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="spacing">6</property>
+                    <child>
+                      <object class="GtkImage" id="image4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="stock">gtk-orientation-reverse-landscape</property>
+                        <property name="icon_size">3</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkLabel" id="label4">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="label" translatable="yes">Reverse landscape</property>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">1</property>
+                      </packing>
+                    </child>
+                  </object>
+                </child>
+              </object>
+              <packing>
+                <property name="left_attach">2</property>
+                <property name="top_attach">4</property>
+                <property name="width">1</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+            <child>
+              <placeholder/>
+            </child>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+    <action-widgets>
+      <action-widget response="-6">cancel_button</action-widget>
+      <action-widget response="-5">apply_button</action-widget>
+    </action-widgets>
+  </template>
+</interface>
diff --git a/gtk/tests/Makefile.am b/gtk/tests/Makefile.am
index d27e23e..0e7f70f 100644
--- a/gtk/tests/Makefile.am
+++ b/gtk/tests/Makefile.am
@@ -10,6 +10,10 @@ AM_CPPFLAGS = \
        $(GTK_DEBUG_FLAGS)              \
        $(GTK_DEP_CFLAGS)
 
+if OS_UNIX
+AM_CPPFLAGS += -DHAVE_UNIX_PRINT_WIDGETS
+endif
+
 DEPS = \
        $(top_builddir)/gtk/libgtk-3.la
 
diff --git a/gtk/tests/templates.c b/gtk/tests/templates.c
index d1702e8..776ed0b 100644
--- a/gtk/tests/templates.c
+++ b/gtk/tests/templates.c
@@ -18,6 +18,10 @@
  */
 #include <gtk/gtk.h>
 
+#ifdef HAVE_UNIX_PRINT_WIDGETS
+#  include <gtk/gtkunixprint.h>
+#endif
+
 static gboolean
 main_loop_quit_cb (gpointer data)
 {
@@ -254,6 +258,19 @@ test_recent_chooser_widget_basic (void)
   gtk_widget_destroy (widget);
 }
 
+#ifdef HAVE_UNIX_PRINT_WIDGETS
+static void
+test_page_setup_unix_dialog_basic (void)
+{
+  GtkWidget *widget;
+
+  widget = gtk_page_setup_unix_dialog_new ("Setup your Page !", NULL);
+  g_assert (GTK_IS_PAGE_SETUP_UNIX_DIALOG (widget));
+  gtk_widget_destroy (widget);
+}
+
+#endif
+
 int
 main (int argc, char **argv)
 {
@@ -284,5 +301,9 @@ main (int argc, char **argv)
   g_test_add_func ("/Template/GtkFontChooserDialog/Basic", test_font_chooser_dialog_basic);
   g_test_add_func ("/Template/GtkRecentChooserWidget/Basic", test_recent_chooser_widget_basic);
 
+#ifdef HAVE_UNIX_PRINT_WIDGETS
+  g_test_add_func ("/Template/UnixPrint/GtkPageSetupUnixDialog/Basic", test_page_setup_unix_dialog_basic);
+#endif
+
   return g_test_run();
 }
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 025dc94..2dbfa43 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -287,6 +287,7 @@ modules/printbackends/test/gtkprintbackendtest.c
 [type: gettext/glade]gtk/gtkinfobar.ui
 [type: gettext/glade]gtk/gtklockbutton.ui
 [type: gettext/glade]gtk/gtkmessagedialog.ui
+[type: gettext/glade]gtk/gtkpagesetupunixdialog.ui
 [type: gettext/glade]gtk/gtkrecentchooserdefault.ui
 [type: gettext/glade]gtk/gtkscalebutton.ui
 [type: gettext/glade]gtk/gtkstatusbar.ui


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