problem extracting data from GtkSourceView using Gtkd

Chris Bare chris at bareflix.com
Wed Jan 16 23:31:01 UTC 2019


Weird, the code does work in my program during startup, but when 
I call the same function from Application.onShutdown it gets the 
0 results.

Are the widgets destroyed before onShutdown?

Here's a stripped down version my Application subclass:


int
main (string[] args)
{
	auto application = new SpiralApp();
	application.run(args);
	return(0);
}

class SpiralApp: Application
{
	MainWin win;

	this ()
	{
		super("com.bareflix.spiral", ApplicationFlags.NON_UNIQUE);

		addOnActivate(&onActivate);
         addOnStartup(&onStartup);
		addOnShutdown(&onShutdown);
	}

	void onActivate(GioApplication application)
	{
		win = new MainWin();
		this.addWindow (win.spiral);
		win.spiral.showAll();

		notepadList = new NotepadList (dir);
		activePad = notepadList.front ();
		activePad.activate ();	// this sets the text in the 
GtkSourceView
		win.getMainTxt ();	// this retrieves the text correctly
	}

	void onShutdown(GioApplication application)
	{
		// this returns a blank string. I don't do anything in the UI, 
just
		// start it up and then exit with the window manager
		win.getMainTxt ();
		notepadList.write ();
		activePad.save ();
		info ("on shutdown here");
	}
}

Any ideas?


More information about the Digitalmars-d-learn mailing list