Exemple #1
0
		public MainWindow() : base(Gtk.WindowType.Toplevel)
		{
			this.Build();
			Title = "C# Shell";

			// This is the page with no pane
			notebook1.Page = 1;
			gtkpane.Toggled += delegate {
				SetDisplayPane (gtkpane.Active);
			};

			Shell = new Shell (this);
			LoadSettings (Shell);

			gtkpane.Active = panevisible;

			Shell.QuitRequested += OnQuitActionActivated;
			
			Shell.ShowAll ();
			
			sw.Add (Shell);
			Focus = Shell;

			KeyPressEvent += HandleKeyPressEvent;
		}
Exemple #2
0
		public void LoadSettings (Shell shell)
		{
			if (settings == null){
				shell.LoadHistory (null);
				return;
			}

			XDocument doc;
			try {
				doc = XDocument.Load (settings);
			} catch {
				shell.LoadHistory (null);
				return;
			}

			int width = -1;
			int height = -1;
			int position = -1;
			
			try {
				foreach (var e in doc.Root.Elements ()){
					switch (e.Name.LocalName){
					case "history":
						shell.LoadHistory (e.Elements ());
						break;
					case "Width":
						width = Int32.Parse (e.Value);
						break;
					case "Height":
						height = Int32.Parse (e.Value);
						break;
					case "PaneVisible":
						panevisible = Int32.Parse (e.Value) == 1;
						break;
					case "PanePosition":
						position = Int32.Parse (e.Value);
						break;
					}
				}
			} catch {
			}

			width = System.Math.Max (width, 200);
			height = System.Math.Max (height, 120);
			
			Resize (width, height);
			if (position >= 0)
				hpaned.Position = position;
		}