[gitg] Just use the constructor for the FileChooser instead of ui file



commit b67ea411e820b023d038e6fb2d16cb1bc90cf572
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Fri Mar 1 16:56:43 2013 +0100

    Just use the constructor for the FileChooser instead of ui file

 gitg/gitg-window.vala            |   10 +++++--
 gitg/resources/ui/gitg-window.ui |   47 --------------------------------------
 2 files changed, 7 insertions(+), 50 deletions(-)
---
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 91a1ecf..8b86b67 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -124,9 +124,11 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
 
        private void on_open_repository(Gtk.Button button)
        {
-               Gtk.FileChooserDialog chooser = 
Resource.load_object<Gtk.FileChooserDialog>("ui/gitg-window.ui", "filechooserdialog_open");
-               chooser.transient_for = this;
-               chooser.show();
+               var chooser = new Gtk.FileChooserDialog (_("Select Repository"), this,
+                                                        Gtk.FileChooserAction.SELECT_FOLDER,
+                                                        Gtk.Stock.CANCEL, Gtk.ResponseType.CANCEL,
+                                                        Gtk.Stock.OPEN, Gtk.ResponseType.OK);
+               chooser.modal = true;
 
                chooser.response.connect((c, id) => {
                        if (id == Gtk.ResponseType.OK)
@@ -136,6 +138,8 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable, Gtk.
 
                        c.destroy();
                });
+
+               chooser.show();
        }
 
        private void parser_finished(Gtk.Builder builder)
diff --git a/gitg/resources/ui/gitg-window.ui b/gitg/resources/ui/gitg-window.ui
index 2f4db65..f900998 100644
--- a/gitg/resources/ui/gitg-window.ui
+++ b/gitg/resources/ui/gitg-window.ui
@@ -274,51 +274,4 @@
       </object>
     </child>
   </object>
-  <object class="GtkFileChooserDialog" id="filechooserdialog_open">
-    <property name="can_focus">False</property>
-    <property name="border_width">5</property>
-    <property name="title" translatable="yes">Open Repository</property>
-    <property name="role">GtkFileChooserDialog</property>
-    <property name="destroy_with_parent">True</property>
-    <property name="type_hint">dialog</property>
-    <property name="action">select-folder</property>
-    <property name="create-folders">False</property>
-    <property name="local-only">True</property>
-    <property name="modal">True</property>
-    <child internal-child="vbox">
-      <object class="GtkBox" id="filechooserdialog-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="filechooserdialog-action_area1">
-            <property name="can_focus">False</property>
-            <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="filechooserdialog_button_open">
-                <property name="label">gtk-ok</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>
-            </child>
-            <child>
-              <object class="GtkButton" id="filechooserdialog_button_cancel">
-                <property name="label">gtk-cancel</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">False</property>
-                <property name="use_stock">True</property>
-              </object>
-            </child>
-          </object>
-        </child>
-      </object>
-    </child>
-    <action-widgets>
-      <action-widget response="-5">filechooserdialog_button_open</action-widget>
-      <action-widget response="-6">filechooserdialog_button_cancel</action-widget>
-    </action-widgets>
-  </object>
 </interface>


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