2011-06-01 23:08:05 +00:00
|
|
|
// SparkleShare, a collaboration and sharing tool.
|
2010-07-04 18:11:41 +00:00
|
|
|
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
|
|
|
//
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2010-11-21 12:33:24 +00:00
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-07-04 18:11:41 +00:00
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
2010-07-24 21:31:24 +00:00
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
|
2010-07-04 18:11:41 +00:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Diagnostics;
|
|
|
|
using System.IO;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using System.Timers;
|
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
using Gtk;
|
|
|
|
using Mono.Unix;
|
|
|
|
using SparkleLib;
|
2011-03-15 14:47:46 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
namespace SparkleShare {
|
2011-03-15 14:47:46 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
public class SparkleWindow : Window {
|
2011-03-15 14:47:46 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
private HBox HBox;
|
|
|
|
private VBox VBox;
|
|
|
|
private VBox Wrapper;
|
|
|
|
private HButtonBox Buttons;
|
2011-03-15 14:47:46 +00:00
|
|
|
|
2010-08-14 14:08:04 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
public SparkleWindow () : base ("")
|
|
|
|
{
|
2011-05-28 16:24:17 +00:00
|
|
|
Title = Catalog.GetString ("SparkleShare Setup");
|
2011-05-13 23:41:53 +00:00
|
|
|
BorderWidth = 0;
|
|
|
|
IconName = "folder-sparkleshare";
|
|
|
|
Resizable = false;
|
|
|
|
WindowPosition = WindowPosition.Center;
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
SetSizeRequest (680, 440);
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
DeleteEvent += delegate (object o, DeleteEventArgs args) {
|
|
|
|
args.RetVal = true;
|
|
|
|
Close ();
|
|
|
|
};
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
HBox = new HBox (false, 6);
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
VBox = new VBox (false, 0);
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
Wrapper = new VBox (false, 0) {
|
|
|
|
BorderWidth = 30
|
|
|
|
};
|
2010-07-04 19:46:33 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
Buttons = CreateButtonBox ();
|
2010-07-04 19:46:33 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
VBox.PackStart (Wrapper, true, true, 0);
|
|
|
|
VBox.PackStart (Buttons, false, false, 0);
|
2010-07-04 19:46:33 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
EventBox box = new EventBox ();
|
|
|
|
Gdk.Color bg_color = new Gdk.Color ();
|
|
|
|
Gdk.Color.Parse ("#2e3336", ref bg_color);
|
|
|
|
box.ModifyBg (StateType.Normal, bg_color);
|
2010-07-04 19:46:33 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
string image_path = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare",
|
|
|
|
"pixmaps", "side-splash.png");
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
Image side_splash = new Image (image_path) {
|
|
|
|
Yalign = 1
|
|
|
|
};
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
box.Add (side_splash);
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
HBox.PackStart (box, false, false, 0);
|
|
|
|
HBox.PackStart (VBox, true, true, 0);
|
2010-07-23 00:01:01 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
base.Add (HBox);
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
|
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
private HButtonBox CreateButtonBox ()
|
|
|
|
{
|
|
|
|
return new HButtonBox () {
|
|
|
|
BorderWidth = 12,
|
|
|
|
Layout = ButtonBoxStyle.End,
|
|
|
|
Spacing = 6
|
|
|
|
};
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
|
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
public void AddButton (Button button)
|
|
|
|
{
|
|
|
|
Buttons.Add (button);
|
|
|
|
ShowAll ();
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
|
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
new public void Add (Widget widget)
|
|
|
|
{
|
|
|
|
Wrapper.PackStart (widget, true, true, 0);
|
|
|
|
ShowAll ();
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-03-16 00:01:20 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
public void Reset ()
|
|
|
|
{
|
|
|
|
if (Wrapper.Children.Length > 0)
|
|
|
|
Wrapper.Remove (Wrapper.Children [0]);
|
2011-03-16 00:01:20 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
foreach (Button button in Buttons)
|
|
|
|
Buttons.Remove (button);
|
2011-03-16 00:01:20 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
ShowAll ();
|
|
|
|
}
|
|
|
|
|
|
|
|
new public void ShowAll ()
|
|
|
|
{
|
|
|
|
Present ();
|
|
|
|
base.ShowAll ();
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
|
2011-05-13 23:41:53 +00:00
|
|
|
public void Close ()
|
|
|
|
{
|
|
|
|
HideAll ();
|
|
|
|
}
|
|
|
|
}
|
2010-07-04 18:11:41 +00:00
|
|
|
}
|