[gnome-boxes/my-fixes: 4/5] wizard-source: Split the file selection button into a separate type



commit e915bf600c074baa762001297863b731335f064e
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Aug 23 20:29:10 2017 +0200

    wizard-source: Split the file selection button into a separate type
    
    https://bugzilla.gnome.org/show_bug.cgi?id=786679

 data/gnome-boxes.gresource.xml      |    1 +
 data/ui/wizard-select-file-entry.ui |   41 +++++++++++++++++++++++++++++++++++
 data/ui/wizard-source.ui            |   38 +-------------------------------
 po/POTFILES.in                      |    1 +
 src/wizard-source.vala              |    6 ++++-
 5 files changed, 49 insertions(+), 38 deletions(-)
---
diff --git a/data/gnome-boxes.gresource.xml b/data/gnome-boxes.gresource.xml
index 751e6e2..b7f9f3e 100644
--- a/data/gnome-boxes.gresource.xml
+++ b/data/gnome-boxes.gresource.xml
@@ -33,6 +33,7 @@
     <file preprocess="xml-stripblanks">ui/wizard.ui</file>
     <file preprocess="xml-stripblanks">ui/wizard-media-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/wizard-scrolled.ui</file>
+    <file preprocess="xml-stripblanks">ui/wizard-select-file-entry.ui</file>
     <file preprocess="xml-stripblanks">ui/wizard-source.ui</file>
     <file preprocess="xml-stripblanks">ui/wizard-summary.ui</file>
     <file preprocess="xml-stripblanks">ui/wizard-toolbar.ui</file>
diff --git a/data/ui/wizard-select-file-entry.ui b/data/ui/wizard-select-file-entry.ui
new file mode 100644
index 0000000..5fcd94d
--- /dev/null
+++ b/data/ui/wizard-select-file-entry.ui
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <template class="BoxesWizardSelectFileEntry" parent="GtkButton">
+    <style>
+      <class name="boxes-menu-row"/>
+    </style>
+    <child>
+      <object class="GtkBox">
+        <property name="visible">True</property>
+        <property name="margin-top">10</property>
+        <property name="margin-bottom">10</property>
+        <property name="margin-start">20</property>
+        <property name="margin-end">20</property>
+        <property name="spacing">20</property>
+        <property name="orientation">horizontal</property>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="halign">start</property>
+            <property name="use-underline">True</property>
+            <property name="label" translatable="yes">_Select a file</property>
+          </object>
+          <packing>
+            <property name="expand">True</property>
+            <property name="fill">True</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkLabel">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">▶</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">False</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </template>
+</interface>
diff --git a/data/ui/wizard-source.ui b/data/ui/wizard-source.ui
index 4664fe7..be28ebc 100644
--- a/data/ui/wizard-source.ui
+++ b/data/ui/wizard-source.ui
@@ -82,45 +82,9 @@
         </child>
 
         <child>
-          <object class="GtkButton" id="select_file_button">
+          <object class="BoxesWizardSelectFileEntry" id="select_file_button">
             <property name="visible">True</property>
             <signal name="clicked" handler="on_select_file_button_clicked"/>
-            <style>
-              <class name="boxes-menu-row"/>
-            </style>
-            <child>
-              <object class="GtkBox" id="select_file_box">
-                <property name="visible">True</property>
-                <property name="margin-top">10</property>
-                <property name="margin-bottom">10</property>
-                <property name="margin-start">20</property>
-                <property name="margin-end">20</property>
-                <property name="spacing">20</property>
-                <property name="orientation">horizontal</property>
-                <child>
-                  <object class="GtkLabel" id="select_file_label">
-                    <property name="visible">True</property>
-                    <property name="halign">start</property>
-                    <property name="use-underline">True</property>
-                    <property name="label" translatable="yes">_Select a file</property>
-                  </object>
-                  <packing>
-                    <property name="expand">True</property>
-                    <property name="fill">True</property>
-                  </packing>
-                </child>
-                <child>
-                  <object class="GtkLabel" id="select_file_next_label">
-                    <property name="visible">True</property>
-                    <property name="label" translatable="yes">▶</property>
-                  </object>
-                  <packing>
-                    <property name="expand">False</property>
-                    <property name="fill">False</property>
-                  </packing>
-                </child>
-              </object>
-            </child>
           </object>
         </child>
 
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 63102b7..b572eb1 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -22,6 +22,7 @@ data/ui/topbar.ui
 data/ui/unattended-setup-box.ui
 data/ui/wizard-media-entry.ui
 data/ui/wizard-scrolled.ui
+data/ui/wizard-select-file-entry.ui
 data/ui/wizard-source.ui
 data/ui/wizard-toolbar.ui
 data/ui/wizard.ui
diff --git a/src/wizard-source.vala b/src/wizard-source.vala
index 2c16ec2..46fdc73 100644
--- a/src/wizard-source.vala
+++ b/src/wizard-source.vala
@@ -94,6 +94,10 @@ private class Boxes.WizardMediaEntry : Gtk.Button {
     }
 }
 
+[GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-select-file-entry.ui")]
+private class Boxes.WizardSelectFileEntry : Gtk.Button {
+}
+
 [GtkTemplate (ui = "/org/gnome/Boxes/ui/wizard-source.ui")]
 private class Boxes.WizardSource: Gtk.Stack {
     private const string[] page_names = { "main-page", "url-page" };
@@ -118,7 +122,7 @@ private class Boxes.WizardSource: Gtk.Stack {
     [GtkChild]
     public Gtk.Entry url_entry;
     [GtkChild]
-    private Gtk.Button select_file_button;
+    private Boxes.WizardSelectFileEntry select_file_button;
     [GtkChild]
     private Gtk.Button libvirt_sys_import_button;
     [GtkChild]


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