linux: Implement note feature
This commit is contained in:
parent
36db11b14a
commit
502d5b4a75
|
@ -25,15 +25,16 @@ namespace SparkleShare {
|
|||
public SparkleNoteController Controller = new SparkleNoteController ();
|
||||
|
||||
|
||||
public SparkleNote () : base ("Sync")
|
||||
public SparkleNote () : base ("Add Note")
|
||||
{
|
||||
SetWmclass ("SparkleShare", "SparkleShare");
|
||||
|
||||
IconName = "sparkleshare";
|
||||
Resizable = false;
|
||||
WindowPosition = WindowPosition.Center;
|
||||
BorderWidth = 16;
|
||||
|
||||
SetSizeRequest (480, 240);
|
||||
SetSizeRequest (480, 120);
|
||||
|
||||
|
||||
DeleteEvent += delegate (object o, DeleteEventArgs args) {
|
||||
|
@ -61,13 +62,80 @@ namespace SparkleShare {
|
|||
});
|
||||
};
|
||||
|
||||
Controller.UpdateTitleEvent += delegate (string title) {
|
||||
Application.Invoke (delegate { Title = title; });
|
||||
};
|
||||
|
||||
CreateNote ();
|
||||
}
|
||||
|
||||
|
||||
private void CreateNote ()
|
||||
{
|
||||
// TODO
|
||||
Image user_image = new Image (Controller.AvatarFilePath);
|
||||
|
||||
/* TODO: Style the entry neatly, multiple lines, and add placeholder text
|
||||
string balloon_image_path = new string [] { SparkleUI.AssetsPath, "pixmaps", "text-balloon.png" }.Combine ();
|
||||
Image balloon_image = new Image (balloon_image_path);
|
||||
CssProvider balloon_css_provider = new CssProvider ();
|
||||
|
||||
balloon_css_provider.LoadFromData ("GtkEntry {" +
|
||||
"background-image: url('" + balloon_image_path + "');" +
|
||||
"background-repeat: no-repeat;" +
|
||||
"background-position: left top;" +
|
||||
"}");
|
||||
|
||||
balloon.StyleContext.AddProvider (balloon_css_provider, 800);
|
||||
*/
|
||||
|
||||
Label balloon_label = new Label ("<b>Anything to add?</b>") {
|
||||
Xalign = 0,
|
||||
UseMarkup = true
|
||||
};
|
||||
|
||||
Entry balloon = new Entry () { MaxLength = 144 };
|
||||
|
||||
|
||||
Button cancel_button = new Button ("Cancel");
|
||||
Button sync_button = new Button ("Sync"); // TODO: Make default button
|
||||
|
||||
cancel_button.Clicked += delegate { Controller.CancelClicked (); };
|
||||
sync_button.Clicked += delegate { Controller.SyncClicked (balloon.Buffer.Text); };
|
||||
|
||||
|
||||
VBox layout_vertical = new VBox (false, 16);
|
||||
HBox layout_horizontal = new HBox (false, 16);
|
||||
|
||||
HBox buttons = new HBox () {
|
||||
Homogeneous = false,
|
||||
Spacing = 6
|
||||
};
|
||||
|
||||
Label user_label = new Label () {
|
||||
Markup = "<b>" + Program.Controller.CurrentUser.Name + "</b>\n" +
|
||||
"<span fgcolor=\"" + Program.UI.SecondaryTextColor + "\">" + Program.Controller.CurrentUser.Email +
|
||||
"</span>"
|
||||
};
|
||||
|
||||
|
||||
layout_horizontal.PackStart (user_image, false, false, 0);
|
||||
layout_horizontal.PackStart (user_label, false, false, 0);
|
||||
|
||||
buttons.PackStart (new Label (""), true, true, 0);
|
||||
buttons.PackStart (cancel_button, false, false, 0);
|
||||
buttons.PackStart (sync_button, false, false, 0);
|
||||
|
||||
layout_vertical.PackStart (layout_horizontal, false, false, 0);
|
||||
layout_vertical.PackStart (balloon_label, false, false, 0);
|
||||
layout_vertical.PackStart (balloon, false, false, 0);
|
||||
layout_vertical.PackStart (buttons, false, false, 0);
|
||||
|
||||
// FIXME: Doesn't work
|
||||
CanDefault = true;
|
||||
Default = sync_button;
|
||||
|
||||
Add (layout_vertical);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue