diff --git a/SparkleShare/SparklePreferencesDialog.cs b/SparkleShare/SparklePreferencesDialog.cs index 50aa8523..7e576825 100644 --- a/SparkleShare/SparklePreferencesDialog.cs +++ b/SparkleShare/SparklePreferencesDialog.cs @@ -26,48 +26,26 @@ namespace SparkleShare { // name and url to sync changes with public class SparklePreferencesDialog : Window { - private Button AddButton; - private ComboBoxEntry RemoteUrlCombo; - private Entry NameEntry; + public SparklePreferencesDialog (SparkleWindow SparkleWindow, + SparkleRepo SparkleRepo) : base ("") { - public SparklePreferencesDialog (SparkleRepo SparkleRepo) : base ("") { - - BorderWidth = 6; + BorderWidth = 12; IconName = "folder-sparkleshare"; - Modal = true; Resizable = false; SetPosition (WindowPosition.Center); Title = "Preferences"; + TransientFor = SparkleWindow; - // Create box layout for Remote Address - HBox RemoteUrlBox = new HBox (false, 0); + VBox LayoutVertical = new VBox (false, 0); - Label Property1 = new Label ("Remote address:"); - Property1.WidthRequest = 120; - Property1.Xalign = 0; + Label InfoLabel = new Label (); + InfoLabel.Text = "The folder" + + "" + SparkleRepo.LocalPath + "" + + "\nis linked to " + + "" + SparkleRepo.RemoteOriginUrl + ""; - Label Value1 = new Label - ("" + SparkleRepo.RemoteOriginUrl + ""); - - Value1.UseMarkup = true; - - RemoteUrlBox.PackStart (Property1, false, false, 0); - RemoteUrlBox.PackStart (Value1, false, false, 0); - - // Create box layout for repository path - HBox LocalPathBox = new HBox (false, 0); - - Label Property2 = new Label ("Local path:"); - Property2.WidthRequest = 120; - Property2.Xalign = 0; - - Label Value2 = new Label - ("" + SparkleRepo.LocalPath + ""); - - Value2.UseMarkup = true; - - LocalPathBox.PackStart (Property2, false, false, 0); - LocalPathBox.PackStart (Value2, false, false, 0); + InfoLabel.Xalign = 0; + InfoLabel.UseMarkup = true; CheckButton NotifyChangesCheckButton = new CheckButton ("Notify me when something changes"); @@ -109,19 +87,25 @@ namespace SparkleShare { } }; + HButtonBox DialogButtons = new HButtonBox (); + DialogButtons.Layout = ButtonBoxStyle.End; + DialogButtons.BorderWidth = 0; - Table Table = new Table(2, 2, true); - Table.RowSpacing = 3; - Table.ColumnSpacing = 12; - Table.BorderWidth = 9; - Table.Attach (RemoteUrlBox, 0, 1, 0, 1); - Table.Attach (LocalPathBox, 0, 1, 1, 2); - Table.Attach (NotifyChangesCheckButton, 1, 2, 0, 1); - Table.Attach (SyncChangesCheckButton, 1, 2, 1, 2); + Button CloseButton = new Button (Stock.Close); + CloseButton.Clicked += delegate (object o, EventArgs args) { + Destroy (); + }; + DialogButtons.Add (CloseButton); + SparkleWindow.Default = CloseButton; - Add (Table); + LayoutVertical.PackStart (InfoLabel, false, false, 0); + LayoutVertical.PackStart (new Label (), false, false, 0); + LayoutVertical.PackStart (NotifyChangesCheckButton, false, false, 0); + LayoutVertical.PackStart (SyncChangesCheckButton, false, false, 3); + LayoutVertical.PackStart (new Label (), false, false, 0); + LayoutVertical.PackStart (DialogButtons, false, false, 0); - ShowAll (); + Add (LayoutVertical); } diff --git a/SparkleShare/SparkleWindow.cs b/SparkleShare/SparkleWindow.cs index 5a282eb3..b07acdcb 100644 --- a/SparkleShare/SparkleWindow.cs +++ b/SparkleShare/SparkleWindow.cs @@ -63,7 +63,8 @@ namespace SparkleShare { Button PreferencesButton = new Button (Stock.Preferences); PreferencesButton.Clicked += delegate (object o, EventArgs args) { SparklePreferencesDialog SparklePreferencesDialog = - new SparklePreferencesDialog (SparkleRepo); + new SparklePreferencesDialog (this, SparkleRepo); + SparklePreferencesDialog.ShowAll (); }; DialogButtons.Add (PreferencesButton);