Major API changes about the saving of mime parts



Saving the mime part (saving an attachment or a message) isn't
implemented in the gtk+ default types anymore.

That simply because the ui for saving it is obviously going to be
specific per E-mail client.

Mine used a popup-menu, but that doesn't mean that for example Modest
should be forced to also use the same popup or reimplement its own
message view component.

So I completed the strategy pattern by introducing a client or a
strategy caller: like the IFlyable and IFlyStrategy of Duck, Plane and
Bird which would have FlyWithAnimalWingsStrategy, CantFlyStrategy and
FlyWithMetalWingsStrategy and whatever.

I created that IFlyable type: TnyMimePartSaver

What one could do to create a viewer that can alos save a mime part,
like what the original TnyGtkMsgView did, would be to (for example)
inherit the TnyGtkMsgView and implement the TnyMimePartSaver interface.


class MyOwnMsgView extends TnyGtkMsgView implements TnyMimePartSaver
{
	private Button save_button;
	private Tny.SaveStrategy saver;

	public MyOwnMsgView ()
	{
		this.save_button = new Button ();

		this.save_button.Clicked ... = on_save_button_clicked;
	}

	public Tny.SaveStrategy get_save_strategy ()
	{
		if (this.saver == null)
			this.saver = new TnyGtk.SaveStrategy ();

		return this.saver;
	}

	public void set_save_strategy (Tny.SaveStrategy s)
	{
		this.saver = s;
	}

	public void perform_save (Tny.MimePart part)
	{
		this.get_save_strategy ().save (part);
	}


	public void on_save_button_clicked (object sender, ...)
	{
		this.perform_save (super.get_msg());
	}
}



-- 
Philip Van Hoof, software developer at x-tend 
home: me at pvanhoof dot be 
gnome: pvanhoof at gnome dot org 
work: vanhoof at x-tend dot be 
http://www.pvanhoof.be - http://www.x-tend.be




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]