diff --git a/osrepodbmgr/ChangeLog b/osrepodbmgr/ChangeLog index 7ce64da..f631dd1 100644 --- a/osrepodbmgr/ChangeLog +++ b/osrepodbmgr/ChangeLog @@ -1,3 +1,11 @@ +2017-05-11 Natalia Portillo + + * frmAdd.cs: + * gtk-gui/frmAdd.cs: + * gtk-gui/gui.stetic: + Do not allow to add to the database without adding to the + repository, to prevent inconsistencies between them. + 2017-05-11 Natalia Portillo * frmAdd.cs: diff --git a/osrepodbmgr/frmAdd.cs b/osrepodbmgr/frmAdd.cs index 31cc8a5..ed6fba5 100644 --- a/osrepodbmgr/frmAdd.cs +++ b/osrepodbmgr/frmAdd.cs @@ -288,7 +288,6 @@ public partial class frmAdd : Dialog Workers.UpdateProgress2 += UpdateProgress2; Workers.AddFile += AddFile; Workers.AddOS += AddOS; - btnAdd.Sensitive = false; thdCheckFiles.Start(); }); } @@ -349,7 +348,6 @@ public partial class frmAdd : Dialog btnStop.Visible = false; btnClose.Visible = true; btnExit.Sensitive = true; - btnAdd.Visible = true; btnPack.Visible = true; btnPack.Sensitive = true; btnRemoveFile.Visible = true; @@ -430,7 +428,7 @@ public partial class frmAdd : Dialog { string color = known ? "green" : "red"; fileView.AppendValues(filename, hash, known, color, "black"); - btnAdd.Sensitive |= !known; + btnPack.Sensitive |= !known; }); } @@ -462,7 +460,6 @@ public partial class frmAdd : Dialog Context.files = null; Context.hashes = null; btnStop.Visible = false; - btnAdd.Visible = false; btnPack.Visible = false; btnClose.Visible = false; btnRemoveFile.Visible = false; @@ -709,9 +706,8 @@ public partial class frmAdd : Dialog }); } - protected void OnBtnAddClicked(object sender, EventArgs e) + void AddToDatabase() { - btnAdd.Sensitive = false; btnPack.Sensitive = false; btnClose.Sensitive = false; prgProgress.Visible = true; @@ -827,7 +823,6 @@ public partial class frmAdd : Dialog protected void OnBtnPackClicked(object sender, EventArgs e) { - btnAdd.Sensitive = false; btnPack.Sensitive = false; btnClose.Sensitive = false; prgProgress.Visible = true; @@ -913,7 +908,7 @@ public partial class frmAdd : Dialog prgProgress2.Visible = false; lblProgress2.Visible = false; - btnAdd.Click(); + AddToDatabase(); MessageDialog dlgMsg = new MessageDialog(this, DialogFlags.Modal, MessageType.Info, ButtonsType.Ok, "Correctly packed to " + text); dlgMsg.Run(); @@ -942,7 +937,6 @@ public partial class frmAdd : Dialog Workers.FinishedWithText -= PackFilesFinished; Workers.Failed -= PackFilesFailed; - btnAdd.Sensitive = true; btnPack.Sensitive = true; btnClose.Sensitive = true; prgProgress.Visible = false; diff --git a/osrepodbmgr/gtk-gui/frmAdd.cs b/osrepodbmgr/gtk-gui/frmAdd.cs index 6105282..74c21d8 100644 --- a/osrepodbmgr/gtk-gui/frmAdd.cs +++ b/osrepodbmgr/gtk-gui/frmAdd.cs @@ -103,8 +103,6 @@ public partial class frmAdd private global::Gtk.Button btnPack; - private global::Gtk.Button btnAdd; - private global::Gtk.Button btnArchive; private global::Gtk.Button btnFolder; @@ -574,7 +572,7 @@ public partial class frmAdd this.btnPack.CanFocus = true; this.btnPack.Name = "btnPack"; this.btnPack.UseUnderline = true; - this.btnPack.Label = global::Mono.Unix.Catalog.GetString("_Pack..."); + this.btnPack.Label = global::Mono.Unix.Catalog.GetString("_Add to repository..."); global::Gtk.Image w49 = new global::Gtk.Image(); w49.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-save", global::Gtk.IconSize.Menu); this.btnPack.Image = w49; @@ -585,50 +583,35 @@ public partial class frmAdd w50.Expand = false; w50.Fill = false; // Container child hbox1.Gtk.Box+BoxChild - this.btnAdd = new global::Gtk.Button(); - this.btnAdd.CanFocus = true; - this.btnAdd.Name = "btnAdd"; - this.btnAdd.UseUnderline = true; - this.btnAdd.Label = global::Mono.Unix.Catalog.GetString("Add to _DB"); - global::Gtk.Image w51 = new global::Gtk.Image(); - w51.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-add", global::Gtk.IconSize.Menu); - this.btnAdd.Image = w51; - this.hbox1.Add(this.btnAdd); - global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnAdd])); - w52.PackType = ((global::Gtk.PackType)(1)); - w52.Position = 3; - w52.Expand = false; - w52.Fill = false; - // Container child hbox1.Gtk.Box+BoxChild this.btnArchive = new global::Gtk.Button(); this.btnArchive.CanFocus = true; this.btnArchive.Name = "btnArchive"; this.btnArchive.UseUnderline = true; this.btnArchive.Label = global::Mono.Unix.Catalog.GetString("Open _archive"); - global::Gtk.Image w53 = new global::Gtk.Image(); - w53.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu); - this.btnArchive.Image = w53; + global::Gtk.Image w51 = new global::Gtk.Image(); + w51.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu); + this.btnArchive.Image = w51; this.hbox1.Add(this.btnArchive); - global::Gtk.Box.BoxChild w54 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnArchive])); - w54.PackType = ((global::Gtk.PackType)(1)); - w54.Position = 4; - w54.Expand = false; - w54.Fill = false; + global::Gtk.Box.BoxChild w52 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnArchive])); + w52.PackType = ((global::Gtk.PackType)(1)); + w52.Position = 3; + w52.Expand = false; + w52.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnFolder = new global::Gtk.Button(); this.btnFolder.CanFocus = true; this.btnFolder.Name = "btnFolder"; this.btnFolder.UseUnderline = true; this.btnFolder.Label = global::Mono.Unix.Catalog.GetString("Open _folder"); - global::Gtk.Image w55 = new global::Gtk.Image(); - w55.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu); - this.btnFolder.Image = w55; + global::Gtk.Image w53 = new global::Gtk.Image(); + w53.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-open", global::Gtk.IconSize.Menu); + this.btnFolder.Image = w53; this.hbox1.Add(this.btnFolder); - global::Gtk.Box.BoxChild w56 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnFolder])); - w56.PackType = ((global::Gtk.PackType)(1)); - w56.Position = 5; - w56.Expand = false; - w56.Fill = false; + global::Gtk.Box.BoxChild w54 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnFolder])); + w54.PackType = ((global::Gtk.PackType)(1)); + w54.Position = 4; + w54.Expand = false; + w54.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnStop = new global::Gtk.Button(); this.btnStop.CanFocus = true; @@ -637,26 +620,26 @@ public partial class frmAdd this.btnStop.UseUnderline = true; this.btnStop.Label = "gtk-stop"; this.hbox1.Add(this.btnStop); - global::Gtk.Box.BoxChild w57 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnStop])); - w57.PackType = ((global::Gtk.PackType)(1)); - w57.Position = 6; - w57.Expand = false; - w57.Fill = false; + global::Gtk.Box.BoxChild w55 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnStop])); + w55.PackType = ((global::Gtk.PackType)(1)); + w55.Position = 5; + w55.Expand = false; + w55.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnMetadata = new global::Gtk.Button(); this.btnMetadata.CanFocus = true; this.btnMetadata.Name = "btnMetadata"; this.btnMetadata.UseUnderline = true; this.btnMetadata.Label = global::Mono.Unix.Catalog.GetString("Metadata"); - global::Gtk.Image w58 = new global::Gtk.Image(); - w58.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-properties", global::Gtk.IconSize.Menu); - this.btnMetadata.Image = w58; + global::Gtk.Image w56 = new global::Gtk.Image(); + w56.Pixbuf = global::Stetic.IconLoader.LoadIcon(this, "gtk-properties", global::Gtk.IconSize.Menu); + this.btnMetadata.Image = w56; this.hbox1.Add(this.btnMetadata); - global::Gtk.Box.BoxChild w59 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnMetadata])); - w59.PackType = ((global::Gtk.PackType)(1)); - w59.Position = 7; - w59.Expand = false; - w59.Fill = false; + global::Gtk.Box.BoxChild w57 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnMetadata])); + w57.PackType = ((global::Gtk.PackType)(1)); + w57.Position = 6; + w57.Expand = false; + w57.Fill = false; // Container child hbox1.Gtk.Box+BoxChild this.btnRemoveFile = new global::Gtk.Button(); this.btnRemoveFile.CanFocus = true; @@ -665,19 +648,19 @@ public partial class frmAdd this.btnRemoveFile.UseUnderline = true; this.btnRemoveFile.Label = "gtk-remove"; this.hbox1.Add(this.btnRemoveFile); - global::Gtk.Box.BoxChild w60 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnRemoveFile])); - w60.PackType = ((global::Gtk.PackType)(1)); - w60.Position = 8; - w60.Expand = false; - w60.Fill = false; + global::Gtk.Box.BoxChild w58 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.btnRemoveFile])); + w58.PackType = ((global::Gtk.PackType)(1)); + w58.Position = 7; + w58.Expand = false; + w58.Fill = false; w1.Add(this.hbox1); - global::Gtk.Box.BoxChild w61 = ((global::Gtk.Box.BoxChild)(w1[this.hbox1])); - w61.Position = 12; - w61.Expand = false; - w61.Fill = false; + global::Gtk.Box.BoxChild w59 = ((global::Gtk.Box.BoxChild)(w1[this.hbox1])); + w59.Position = 12; + w59.Expand = false; + w59.Fill = false; // Internal child frmAdd.ActionArea - global::Gtk.HButtonBox w62 = this.ActionArea; - w62.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea"; + global::Gtk.HButtonBox w60 = this.ActionArea; + w60.Name = "__gtksharp_108_Stetic_TopLevelDialog_ActionArea"; // Container child __gtksharp_108_Stetic_TopLevelDialog_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.btnDialog = new global::Gtk.Button(); this.btnDialog.CanFocus = true; @@ -685,9 +668,9 @@ public partial class frmAdd this.btnDialog.UseUnderline = true; this.btnDialog.Label = global::Mono.Unix.Catalog.GetString("GtkButton"); this.AddActionWidget(this.btnDialog, 0); - global::Gtk.ButtonBox.ButtonBoxChild w63 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w62[this.btnDialog])); - w63.Expand = false; - w63.Fill = false; + global::Gtk.ButtonBox.ButtonBoxChild w61 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w60[this.btnDialog])); + w61.Expand = false; + w61.Fill = false; if((this.Child != null)) { this.Child.ShowAll(); @@ -700,11 +683,10 @@ public partial class frmAdd this.prgProgress2.Hide(); this.btnClose.Hide(); this.btnPack.Hide(); - this.btnAdd.Hide(); this.btnStop.Hide(); this.btnMetadata.Hide(); this.btnRemoveFile.Hide(); - w62.Hide(); + w60.Hide(); this.Show(); this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent); this.btnRemoveFile.Clicked += new global::System.EventHandler(this.OnBtnRemoveFileClicked); @@ -712,7 +694,6 @@ public partial class frmAdd this.btnStop.Clicked += new global::System.EventHandler(this.OnBtnStopClicked); this.btnFolder.Clicked += new global::System.EventHandler(this.OnBtnFolderClicked); this.btnArchive.Clicked += new global::System.EventHandler(this.OnBtnArchiveClicked); - this.btnAdd.Clicked += new global::System.EventHandler(this.OnBtnAddClicked); this.btnPack.Clicked += new global::System.EventHandler(this.OnBtnPackClicked); this.btnClose.Clicked += new global::System.EventHandler(this.OnBtnCloseClicked); this.btnExit.Clicked += new global::System.EventHandler(this.OnBtnExitClicked); diff --git a/osrepodbmgr/gtk-gui/gui.stetic b/osrepodbmgr/gtk-gui/gui.stetic index 37474a0..b966b43 100644 --- a/osrepodbmgr/gtk-gui/gui.stetic +++ b/osrepodbmgr/gtk-gui/gui.stetic @@ -618,7 +618,7 @@ True TextAndIcon stock:gtk-save Menu - _Pack... + _Add to repository... True @@ -630,25 +630,6 @@ False - - - - False - True - TextAndIcon - stock:gtk-add Menu - Add to _DB - True - - - - End - 3 - True - False - False - - @@ -661,7 +642,7 @@ End - 4 + 3 True False False @@ -679,7 +660,7 @@ End - 5 + 4 True False False @@ -698,7 +679,7 @@ End - 6 + 5 True False False @@ -717,7 +698,7 @@ End - 7 + 6 True False False @@ -736,7 +717,7 @@ End - 8 + 7 True False False