ValaCAT. Some design aspects (Part 2).

por Marcos Chavarría Teijeiro

This is the second article I have write about some design aspects about ValaCAT application, the first one is here. I have started to write some code and you can see it in my GitHub repository.

These are some details I’m including into the new application. I’m really a newbie in most of this aspects so any kind of feedback is welcome.

FILTERS

Many parts of the core program and the plugins need to highlight some part of a message. In order to make this easy to developers and extensible I have create Filters. This design is a simple decorator pattern applied to message strings.

diagrama_filters

The code for get_string method in Filter class can be something similar to:

return filter(base_string.get_string());

Where filter is a template method that has to be implemented by the Filter subclasses. So the idea is that when some part of the program needs to highlight some part of an string then it adds a filter to that string. This filter has to implement the filter method so it modifies the input string adding the desired Pango markup.

It could be also a good idea to provide some useful filter methods such as a method that highlights the n occurrence of a substring inside a string.

USER INTERFACE

I have decide to make a Virtaal like user interface. Here you can see a mockup:

FileViewMockUp

As you can see I’m quite terrible with design 😉 but I think that the idea is clear. Have the edit boxes inside the message list. The part of having tabs inside the edit panel is just an idea and I don’t even know if GTK allows to do it so if there is a GTK expert out there a hint about this will be really appreciated.