Port Linux UI to new controller logic
This commit is contained in:
parent
a381013801
commit
641a5680a6
|
@ -27,7 +27,7 @@ namespace SparkleShare {
|
|||
|
||||
public class SparkleAbout : Window {
|
||||
|
||||
public SparkleAboutController Controller;
|
||||
public SparkleAboutController Controller = new SparkleAboutController ();
|
||||
private Label updates;
|
||||
|
||||
|
||||
|
@ -41,10 +41,11 @@ namespace SparkleShare {
|
|||
public SparkleAbout () : base ("")
|
||||
{
|
||||
DeleteEvent += delegate (object o, DeleteEventArgs args) {
|
||||
HideAll ();
|
||||
Controller.WindowClosed ();
|
||||
args.RetVal = true;
|
||||
};
|
||||
|
||||
|
||||
DefaultSize = new Gdk.Size (600, 260);
|
||||
Resizable = false;
|
||||
BorderWidth = 0;
|
||||
|
@ -62,7 +63,19 @@ namespace SparkleShare {
|
|||
buf.RenderPixmapAndMask (out map, out map2, 255);
|
||||
GdkWindow.SetBackPixmap (map, false);
|
||||
|
||||
Controller = new SparkleAboutController ();
|
||||
|
||||
Controller.HideWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
HideAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.ShowWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
ShowAll ();
|
||||
Present ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.NewVersionEvent += delegate (string new_version) {
|
||||
Application.Invoke (delegate {
|
||||
|
|
|
@ -44,15 +44,7 @@ namespace SparkleShare {
|
|||
notification.IconName = "folder-sparkleshare";
|
||||
|
||||
notification.Closed += delegate {
|
||||
Application.Invoke (delegate {
|
||||
if (SparkleUI.EventLog == null)
|
||||
SparkleUI.EventLog = new SparkleEventLog ();
|
||||
|
||||
SparkleUI.EventLog.Controller.SelectedFolder = null;
|
||||
|
||||
SparkleUI.EventLog.ShowAll ();
|
||||
SparkleUI.EventLog.Present ();
|
||||
});
|
||||
Controller.BubbleClicked ();
|
||||
};
|
||||
|
||||
notification.Show ();
|
||||
|
|
|
@ -57,7 +57,10 @@ namespace SparkleShare {
|
|||
Title = _("Recent Events");
|
||||
IconName = "folder-sparkleshare";
|
||||
|
||||
DeleteEvent += Close;
|
||||
DeleteEvent += Close (object o, DeleteEventArgs args) {
|
||||
Controller.WindowClosed ();
|
||||
args.RetVal = true;
|
||||
};
|
||||
|
||||
this.size_label = new Label () {
|
||||
Markup = "<b>Size:</b> … <b>History:</b> …"
|
||||
|
@ -99,13 +102,25 @@ namespace SparkleShare {
|
|||
layout_vertical.PackStart (this.content_wrapper, true, true, 0);
|
||||
|
||||
Add (layout_vertical);
|
||||
ShowAll ();
|
||||
|
||||
UpdateChooser (null);
|
||||
UpdateContent (null);
|
||||
|
||||
|
||||
// Hook up the controller events
|
||||
Controller.HideWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
HideAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.ShowWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
ShowAll ();
|
||||
Present ();
|
||||
|
||||
UpdateChooser (null);
|
||||
UpdateContent (null);
|
||||
});
|
||||
};
|
||||
|
||||
Controller.UpdateChooserEvent += delegate (string [] folders) {
|
||||
Application.Invoke (delegate {
|
||||
UpdateChooser (folders);
|
||||
|
@ -236,13 +251,6 @@ namespace SparkleShare {
|
|||
}
|
||||
|
||||
|
||||
public void Close (object o, DeleteEventArgs args)
|
||||
{
|
||||
HideAll ();
|
||||
args.RetVal = true;
|
||||
}
|
||||
|
||||
|
||||
private MenuBar CreateShortcutsBar ()
|
||||
{
|
||||
// Adds a hidden menubar that contains to enable keyboard
|
||||
|
|
|
@ -56,6 +56,20 @@ namespace SparkleShare {
|
|||
)
|
||||
);
|
||||
|
||||
|
||||
Controller.HideWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
HideAll ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.ShowWindowEvent += delegate {
|
||||
Application.Invoke (delegate {
|
||||
ShowAll ();
|
||||
Present ();
|
||||
});
|
||||
};
|
||||
|
||||
Controller.ChangePageEvent += delegate (PageType type, string [] warnings) {
|
||||
Application.Invoke (delegate {
|
||||
Reset ();
|
||||
|
@ -621,9 +635,12 @@ namespace SparkleShare {
|
|||
private Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio)
|
||||
{
|
||||
return new Gdk.Color (
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + second_color.Red * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + second_color.Green * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + second_color.Blue * ratio))) / 65535)
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
|
||||
second_color.Red * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
|
||||
second_color.Green * ratio))) / 65535),
|
||||
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
|
||||
second_color.Blue * ratio))) / 65535)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -254,19 +254,7 @@ namespace SparkleShare {
|
|||
sync_item.Sensitive = false;
|
||||
|
||||
sync_item.Activated += delegate {
|
||||
Application.Invoke (delegate {
|
||||
|
||||
if (SparkleUI.Setup == null) {
|
||||
SparkleUI.Setup = new SparkleSetup ();
|
||||
SparkleUI.Setup.Controller.ShowAddPage ();
|
||||
}
|
||||
|
||||
if (!SparkleUI.Setup.Visible)
|
||||
SparkleUI.Setup.Controller.ShowAddPage ();
|
||||
|
||||
//SparkleUI.Intro.ShowAll ();
|
||||
//SparkleUI.Intro.Present ();
|
||||
});
|
||||
Controller.AddHostedProjectClicked ();
|
||||
};
|
||||
|
||||
this.menu.Add (sync_item);
|
||||
|
@ -277,13 +265,7 @@ namespace SparkleShare {
|
|||
recent_events_item.Sensitive = (Controller.Folders.Length > 0);
|
||||
|
||||
recent_events_item.Activated += delegate {
|
||||
Application.Invoke (delegate {
|
||||
if (SparkleUI.EventLog == null)
|
||||
SparkleUI.EventLog = new SparkleEventLog ();
|
||||
|
||||
SparkleUI.EventLog.ShowAll ();
|
||||
SparkleUI.EventLog.Present ();
|
||||
});
|
||||
Controller.OpenRecentEventsClicked ();
|
||||
};
|
||||
|
||||
this.menu.Add (recent_events_item);
|
||||
|
@ -307,13 +289,7 @@ namespace SparkleShare {
|
|||
MenuItem about_item = new MenuItem (_("About SparkleShare"));
|
||||
|
||||
about_item.Activated += delegate {
|
||||
Application.Invoke (delegate {
|
||||
if (SparkleUI.About == null)
|
||||
SparkleUI.About = new SparkleAbout ();
|
||||
|
||||
SparkleUI.About.ShowAll ();
|
||||
SparkleUI.About.Present ();
|
||||
});
|
||||
Controller.AboutClicked ();
|
||||
};
|
||||
|
||||
this.menu.Add (about_item);
|
||||
|
|
|
@ -37,6 +37,7 @@ namespace SparkleShare {
|
|||
public static SparkleBubbles Bubbles;
|
||||
public static SparkleSetup Setup;
|
||||
public static SparkleAbout About;
|
||||
|
||||
public static string AssetsPath =
|
||||
new string [] {Defines.PREFIX, "share", "sparkleshare"}.Combine ();
|
||||
|
||||
|
@ -56,13 +57,14 @@ namespace SparkleShare {
|
|||
// Use translations
|
||||
Catalog.Init (Defines.GETTEXT_PACKAGE, Defines.LOCALE_DIR);
|
||||
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
Setup = new SparkleSetup ();
|
||||
EventLog = new SparkleEventLog ();
|
||||
About = new SparkleAbout ();
|
||||
Bubbles = new SparkleBubbles ();
|
||||
|
||||
if (Program.Controller.FirstRun) {
|
||||
Setup = new SparkleSetup ();
|
||||
Setup.Controller.ShowSetupPage ();
|
||||
}
|
||||
StatusIcon = new SparkleStatusIcon ();
|
||||
|
||||
if (Program.Controller.FirstRun)
|
||||
Program.Controller.ShowSetupWindow (PageType.Setup)
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue