[longomatch] Add project export function to the projects manager



commit 29e61fe1edf7cec2e313aee16ba1d0e69aef64e0
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date:   Wed Dec 23 04:28:09 2009 +0100

    Add project export function to the projects manager

 LongoMatch/Gui/Dialog/ProjectsManager.cs           |   30 +++++++-
 .../LongoMatch.Gui.Dialog.ProjectsManager.cs       |   70 ++++++++++++++------
 LongoMatch/gtk-gui/gui.stetic                      |   20 +++++-
 3 files changed, 95 insertions(+), 25 deletions(-)
---
diff --git a/LongoMatch/Gui/Dialog/ProjectsManager.cs b/LongoMatch/Gui/Dialog/ProjectsManager.cs
index ebc0a36..754df7d 100644
--- a/LongoMatch/Gui/Dialog/ProjectsManager.cs
+++ b/LongoMatch/Gui/Dialog/ProjectsManager.cs
@@ -51,7 +51,8 @@ namespace LongoMatch.Gui.Dialog
 			projectdetails.Clear();
 			projectdetails.Sensitive = false;
 			saveButton.Sensitive = false;
-			deleteButton.Sensitive = false;
+			deleteButton.Sensitive = false;
+			exportbutton.Sensitive = false;
 			originalFilePath=null;
 		}
 		
@@ -144,20 +145,41 @@ namespace LongoMatch.Gui.Dialog
 				projectdetails.Clear();
 				projectdetails.Sensitive = false;
 				saveButton.Sensitive = false;
-				deleteButton.Sensitive = false;
+				deleteButton.Sensitive = false;
+				exportbutton.Sensitive = false;
 			}
 			else {
 				projectdetails.Sensitive = true;
 				projectdetails.SetProject(MainClass.DB.GetProject(project.File));
 				originalFilePath = project.File;
 				saveButton.Sensitive = false;
-				deleteButton.Sensitive = true;
+				deleteButton.Sensitive = true;
+				exportbutton.Sensitive = true;
 			}
 		}
 
 		protected virtual void OnProjectdetailsEditedEvent(object sender, System.EventArgs e)
 		{
-			saveButton.Sensitive = true;
+			saveButton.Sensitive = true;
+		}
+		
+		protected virtual void OnExportbuttonClicked (object sender, System.EventArgs e)
+		{
+			FileChooserDialog fChooser = new FileChooserDialog(Catalog.GetString("Save Project"),
+			                (Gtk.Window)Toplevel,
+			                FileChooserAction.Save,
+			                "gtk-cancel",ResponseType.Cancel,
+			                "gtk-save",ResponseType.Accept);
+			fChooser.SetCurrentFolder(MainClass.HomeDir());
+			FileFilter filter = new FileFilter();
+			filter.Name = "LongoMatch Project";
+			filter.AddPattern("*.lpr");
+
+			fChooser.AddFilter(filter);
+			if (fChooser.Run() == (int)ResponseType.Accept) {
+				Project.Export(projectdetails.GetProject(), fChooser.Filename);
+			}
+			fChooser.Destroy();
 		}
 	}
 }
diff --git a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectsManager.cs b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectsManager.cs
index 9e13137..5f8133a 100644
--- a/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectsManager.cs
+++ b/LongoMatch/gtk-gui/LongoMatch.Gui.Dialog.ProjectsManager.cs
@@ -35,6 +35,8 @@ namespace LongoMatch.Gui.Dialog {
         
         private Gtk.Button deleteButton;
         
+        private Gtk.Button exportbutton;
+        
         private Gtk.HSeparator hseparator3;
         
         private Gtk.Button buttonOk;
@@ -132,31 +134,58 @@ namespace LongoMatch.Gui.Dialog {
             w7.Position = 2;
             w7.Expand = false;
             w7.Fill = false;
+            // Container child vbox2.Gtk.Box+BoxChild
+            this.exportbutton = new Gtk.Button();
+            this.exportbutton.Sensitive = false;
+            this.exportbutton.CanFocus = true;
+            this.exportbutton.Name = "exportbutton";
+            this.exportbutton.UseUnderline = true;
+            // Container child exportbutton.Gtk.Container+ContainerChild
+            Gtk.Alignment w8 = new Gtk.Alignment(0.5F, 0.5F, 0F, 0F);
+            // Container child GtkAlignment8.Gtk.Container+ContainerChild
+            Gtk.HBox w9 = new Gtk.HBox();
+            w9.Spacing = 2;
+            // Container child GtkHBox10.Gtk.Container+ContainerChild
+            Gtk.Image w10 = new Gtk.Image();
+            w10.Pixbuf = Stetic.IconLoader.LoadIcon(this, "stock_export", Gtk.IconSize.Menu, 16);
+            w9.Add(w10);
+            // Container child GtkHBox10.Gtk.Container+ContainerChild
+            Gtk.Label w12 = new Gtk.Label();
+            w12.LabelProp = Mono.Unix.Catalog.GetString("_Export");
+            w12.UseUnderline = true;
+            w9.Add(w12);
+            w8.Add(w9);
+            this.exportbutton.Add(w8);
+            this.vbox2.Add(this.exportbutton);
+            Gtk.Box.BoxChild w16 = ((Gtk.Box.BoxChild)(this.vbox2[this.exportbutton]));
+            w16.Position = 3;
+            w16.Expand = false;
+            w16.Fill = false;
             this.hpaned1.Add(this.vbox2);
             this.hbox2.Add(this.hpaned1);
-            Gtk.Box.BoxChild w9 = ((Gtk.Box.BoxChild)(this.hbox2[this.hpaned1]));
-            w9.Position = 0;
+            Gtk.Box.BoxChild w18 = ((Gtk.Box.BoxChild)(this.hbox2[this.hpaned1]));
+            w18.Position = 0;
             this.dialog1_VBox1.Add(this.hbox2);
-            Gtk.Box.BoxChild w10 = ((Gtk.Box.BoxChild)(this.dialog1_VBox1[this.hbox2]));
-            w10.Position = 0;
+            Gtk.Box.BoxChild w19 = ((Gtk.Box.BoxChild)(this.dialog1_VBox1[this.hbox2]));
+            w19.Position = 0;
             // Container child dialog1_VBox1.Gtk.Box+BoxChild
             this.hseparator3 = new Gtk.HSeparator();
             this.hseparator3.Name = "hseparator3";
             this.dialog1_VBox1.Add(this.hseparator3);
-            Gtk.Box.BoxChild w11 = ((Gtk.Box.BoxChild)(this.dialog1_VBox1[this.hseparator3]));
-            w11.PackType = ((Gtk.PackType)(1));
-            w11.Position = 1;
-            w11.Expand = false;
-            w11.Fill = false;
+            Gtk.Box.BoxChild w20 = ((Gtk.Box.BoxChild)(this.dialog1_VBox1[this.hseparator3]));
+            w20.PackType = ((Gtk.PackType)(1));
+            w20.Position = 1;
+            w20.Expand = false;
+            w20.Fill = false;
             w1.Add(this.dialog1_VBox1);
-            Gtk.Box.BoxChild w12 = ((Gtk.Box.BoxChild)(w1[this.dialog1_VBox1]));
-            w12.Position = 0;
+            Gtk.Box.BoxChild w21 = ((Gtk.Box.BoxChild)(w1[this.dialog1_VBox1]));
+            w21.Position = 0;
             // Internal child LongoMatch.Gui.Dialog.ProjectsManager.ActionArea
-            Gtk.HButtonBox w13 = this.ActionArea;
-            w13.Name = "dialog1_ActionArea";
-            w13.Spacing = 6;
-            w13.BorderWidth = ((uint)(5));
-            w13.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
+            Gtk.HButtonBox w22 = this.ActionArea;
+            w22.Name = "dialog1_ActionArea";
+            w22.Spacing = 6;
+            w22.BorderWidth = ((uint)(5));
+            w22.LayoutStyle = ((Gtk.ButtonBoxStyle)(4));
             // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild
             this.buttonOk = new Gtk.Button();
             this.buttonOk.CanDefault = true;
@@ -166,19 +195,20 @@ namespace LongoMatch.Gui.Dialog {
             this.buttonOk.UseUnderline = true;
             this.buttonOk.Label = "gtk-quit";
             this.AddActionWidget(this.buttonOk, 0);
-            Gtk.ButtonBox.ButtonBoxChild w14 = ((Gtk.ButtonBox.ButtonBoxChild)(w13[this.buttonOk]));
-            w14.Expand = false;
-            w14.Fill = false;
+            Gtk.ButtonBox.ButtonBoxChild w23 = ((Gtk.ButtonBox.ButtonBoxChild)(w22[this.buttonOk]));
+            w23.Expand = false;
+            w23.Fill = false;
             if ((this.Child != null)) {
                 this.Child.ShowAll();
             }
             this.DefaultWidth = 804;
-            this.DefaultHeight = 550;
+            this.DefaultHeight = 555;
             this.Show();
             this.projectlistwidget1.ProjectSelectedEvent += new LongoMatch.Gui.Component.ProjectSelectedHandler(this.OnProjectlistwidget1ProjectSelectedEvent);
             this.projectdetails.EditedEvent += new System.EventHandler(this.OnProjectdetailsEditedEvent);
             this.saveButton.Pressed += new System.EventHandler(this.OnSaveButtonPressed);
             this.deleteButton.Pressed += new System.EventHandler(this.OnDeleteButtonPressed);
+            this.exportbutton.Clicked += new System.EventHandler(this.OnExportbuttonClicked);
             this.buttonOk.Clicked += new System.EventHandler(this.OnButtonOkClicked);
         }
     }
diff --git a/LongoMatch/gtk-gui/gui.stetic b/LongoMatch/gtk-gui/gui.stetic
index 5813ce3..8c12a03 100644
--- a/LongoMatch/gtk-gui/gui.stetic
+++ b/LongoMatch/gtk-gui/gui.stetic
@@ -881,7 +881,7 @@
       </widget>
     </child>
   </widget>
-  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.ProjectsManager" design-size="804 550">
+  <widget class="Gtk.Dialog" id="LongoMatch.Gui.Dialog.ProjectsManager" design-size="804 555">
     <property name="MemberName" />
     <property name="Title" translatable="yes">Projects Manager</property>
     <property name="Icon">stock:longomatch Dialog</property>
@@ -1000,6 +1000,24 @@
                             <property name="Fill">False</property>
                           </packing>
                         </child>
+                        <child>
+                          <widget class="Gtk.Button" id="exportbutton">
+                            <property name="MemberName" />
+                            <property name="Sensitive">False</property>
+                            <property name="CanFocus">True</property>
+                            <property name="Type">TextAndIcon</property>
+                            <property name="Icon">stock:stock_export Menu</property>
+                            <property name="Label" translatable="yes">_Export</property>
+                            <property name="UseUnderline">True</property>
+                            <signal name="Clicked" handler="OnExportbuttonClicked" />
+                          </widget>
+                          <packing>
+                            <property name="Position">3</property>
+                            <property name="AutoSize">True</property>
+                            <property name="Expand">False</property>
+                            <property name="Fill">False</property>
+                          </packing>
+                        </child>
                       </widget>
                     </child>
                   </widget>



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