Example #1
0
 void ConnectPlug()
 {
     socket = new Gtk.Socket();
     socket.Show();
     book.AppendPage(socket, null);
     OnCreatePlug(socket.Id);
 }
		public override void Resume ()
		{
			Console.WriteLine("Gtk socket being reconstructed");
			didInit = false;
			readyForInit = false;
			wantsInit = false;
			var oldSocket = socket;
			socket = new Gtk.Socket();
			socket.ModifyBg(Gtk.StateType.Active, new Gdk.Color(0, 0, 0));
			socket.ModifyBg(Gtk.StateType.Insensitive, new Gdk.Color(0, 0, 0));
			socket.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));
			socket.ModifyBg(Gtk.StateType.Prelight, new Gdk.Color(0, 0, 0));
			socket.ModifyBg(Gtk.StateType.Selected, new Gdk.Color(0, 0, 0));
			socket.ParentSet += this.OnParentChanged;
			socket.Realized += this.OnRealized;
			socket.ShowAll();
			if (socketParent == null)
			{
				socketParent = oldSocket.Parent;
			}
			foreach (var child in ((Gtk.VBox)socketParent).AllChildren)
			{
				((Gtk.VBox)socketParent).Remove((Gtk.Widget)child);
			}
			((Gtk.VBox)socketParent).Add(socket);
			Console.WriteLine("Gtk socket added to socket parent");
			readyForInit = true;
			if (wantsInit)
			{
				this.OnRealized(this, new EventArgs());
			}

			base.Resume ();
		}
Example #3
0
 void ConnectPlug()
 {
     socket = new Gtk.Socket ();
     socket.Show ();
     book.AppendPage (socket, null);
     OnCreatePlug (socket.Id);
 }
		public override void Suspend ()
		{
			openFile.SuspendedState = openFile.NetworkRequestLayer.Suspend();
			//SocketIDOnResume = null;
			IsSuspended = true;
			if (socket != null)
			{
				socket.ParentSet -= OnParentChanged;
				socket.Realized -= OnRealized;
				((Gtk.VBox)socketParent).Remove(socket);
				socket = null;
			}

			if (openFile.GtkPlugProcess != null)
			{
				Console.WriteLine("Killing GTK process for " + openFile.FileReference);
				try
				{
					openFile.GtkPlugProcess.Kill();
				}
				catch (InvalidOperationException)
				{
					// Process has already exited.
				}
				openFile.NetworkRequestLayer.Stop();
				openFile.GtkPlugProcess = null;
			}

			base.Suspend ();
		}