clean up dialog and fix warnings

This commit is contained in:
Hylke Bons 2010-05-18 10:13:24 +01:00
parent 61a46f8626
commit 4456abe84e
2 changed files with 30 additions and 45 deletions

View file

@ -26,48 +26,26 @@ namespace SparkleShare {
// name and url to sync changes with // name and url to sync changes with
public class SparklePreferencesDialog : Window { public class SparklePreferencesDialog : Window {
private Button AddButton; public SparklePreferencesDialog (SparkleWindow SparkleWindow,
private ComboBoxEntry RemoteUrlCombo; SparkleRepo SparkleRepo) : base ("") {
private Entry NameEntry;
public SparklePreferencesDialog (SparkleRepo SparkleRepo) : base ("") { BorderWidth = 12;
BorderWidth = 6;
IconName = "folder-sparkleshare"; IconName = "folder-sparkleshare";
Modal = true;
Resizable = false; Resizable = false;
SetPosition (WindowPosition.Center); SetPosition (WindowPosition.Center);
Title = "Preferences"; Title = "Preferences";
TransientFor = SparkleWindow;
// Create box layout for Remote Address VBox LayoutVertical = new VBox (false, 0);
HBox RemoteUrlBox = new HBox (false, 0);
Label Property1 = new Label ("Remote address:"); Label InfoLabel = new Label ();
Property1.WidthRequest = 120; InfoLabel.Text = "The folder" +
Property1.Xalign = 0; "<b>" + SparkleRepo.LocalPath + "</b>" +
"\nis linked to " +
"<b>" + SparkleRepo.RemoteOriginUrl + "</b>";
Label Value1 = new Label InfoLabel.Xalign = 0;
("<b>" + SparkleRepo.RemoteOriginUrl + "</b>"); InfoLabel.UseMarkup = true;
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
("<b>" + SparkleRepo.LocalPath + "</b>");
Value2.UseMarkup = true;
LocalPathBox.PackStart (Property2, false, false, 0);
LocalPathBox.PackStart (Value2, false, false, 0);
CheckButton NotifyChangesCheckButton = CheckButton NotifyChangesCheckButton =
new CheckButton ("Notify me when something changes"); 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); Button CloseButton = new Button (Stock.Close);
Table.RowSpacing = 3; CloseButton.Clicked += delegate (object o, EventArgs args) {
Table.ColumnSpacing = 12; Destroy ();
Table.BorderWidth = 9; };
Table.Attach (RemoteUrlBox, 0, 1, 0, 1); DialogButtons.Add (CloseButton);
Table.Attach (LocalPathBox, 0, 1, 1, 2); SparkleWindow.Default = CloseButton;
Table.Attach (NotifyChangesCheckButton, 1, 2, 0, 1);
Table.Attach (SyncChangesCheckButton, 1, 2, 1, 2);
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);
} }

View file

@ -63,7 +63,8 @@ namespace SparkleShare {
Button PreferencesButton = new Button (Stock.Preferences); Button PreferencesButton = new Button (Stock.Preferences);
PreferencesButton.Clicked += delegate (object o, EventArgs args) { PreferencesButton.Clicked += delegate (object o, EventArgs args) {
SparklePreferencesDialog SparklePreferencesDialog = SparklePreferencesDialog SparklePreferencesDialog =
new SparklePreferencesDialog (SparkleRepo); new SparklePreferencesDialog (this, SparkleRepo);
SparklePreferencesDialog.ShowAll ();
}; };
DialogButtons.Add (PreferencesButton); DialogButtons.Add (PreferencesButton);