Hi, I've read a little all the code, and most of it can be reused easily. In some files there is just the strings "gedit" or "org.gnome.gedit" (for GSettings) which must be moved in functions (e.g. in GeditApp). GeditWindow is quite big and a lot of things are specific to Gedit there, so it will involve more work. For GeditApp and its subclasses (GeditAppX11 etc), some work must also be done to be able to subclass GeditApp independently of the implementation. For doing this we can use a bridge [1]. And since GeditApp is a singleton, GeditApp must be instantiated with the subclass. For this I've thought adding a static function in GeditApp like gedit_app_set_instance (). We call gedit_sub_app_get_default () first, which call gedit_app_set_instance () with the instance of GeditSubApp. It works but there is maybe a better approach. For creating objects, an abstract factory [2] is a good choice I think. If an application wants to override a method in a subclass, this method has to be declared virtual in the parent class. Therefore all (or just for some classes) public methods should be virtual. There are some other things to handle, for example: - which names will we give to subclasses? Or we rename all Gedit* classes to LibGedit* or whatever? - libpeas and plugins support should be optional. - the preferences dialog can not be reused, but the majority of its sentences can be reused (so translators have less work). - what to do with config.h? - how to reuse gedit-ui.h? - and a lot of other little things... What do you think? The first thing I want to do is the bridge for GeditApp and resolve the problem of subclassing the singleton. [1] http://en.wikipedia.org/wiki/Bridge_pattern [2] http://en.wikipedia.org/wiki/Abstract_factory_pattern On Sun, Jan 02, 2011 at 01:05:28AM +0100, Nacho wrote: > Hey, > cool then, but I feel like this is going to be quite a lot of work :) also > I suggest you to drop > by irc and discuss about the ways to do it. > Regards and thanks for caring about doing this. > > On Sun, Jan 2, 2011 at 1:00 AM, S*bastien Wilmet > <[1]sebastien wilmet gmail com> wrote: > > Hello, > > I don't know if you remember, in August I had a discussion on IRC about > libgedit, i.e. creating a framework based on the source code of Gedit > for creating new IDEs easily. > > You agreed with the idea and you said that the API could change from > versions to versions, so the applications must follow the development > and make some changes if needed. There is also the possibility to stay > with a particular version, either by copying all the source code, or by > having several versions of the libgedit installed (different *.so), but > it will annoy packagers I think, especially if it's only for one or two > apps. > > I'll do all this work during the next months as part of my studies, as > Steve Fr*cinaux already knows*. > > This framework will be integrated to Gedit itself obviously, but also to > LaTeXila, an Integrated LaTeX Environment written in Vala. The "text > editor" part is inspired from Gedit, so the port won't be so difficult I > think. > > I hope it will be useful for other projects too. For some tasks an > independent application is easier for the user than plugins. Although > the profile feature would make the life easier too. > > Best regards, > S*bastien > > PS: Happy new year! > > * I'll do an internship where he works :) But the Gedit stuff is not > part of the internship.
Attachment:
pgpQRRQACmOr7.pgp
Description: PGP signature