This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

Approach to Refactoring Tomboy for Platform Independence

Motivation

Tomboy is awesome. So awesome in fact, that people on Windows, Maemo, and other platforms are dying to run it. As a Mono program, it is inherently portable, yet we restrict ourselves to running on GNOME through dependencies on gnome-sharp, gconf-sharp, X11, etc.

My goal is to do some fairly simple refactoring to make it easier to bring Tomboy to platforms that already have Mono and gtk-sharp.

Disclaimer: I'm really trying to have a stable and supported Windows port, so the refactoring is biased towards that end.

General Approach

Assume it's only OK to depend on cross-platform Mono stuff and gtk-sharp. Any code that doesn't fit that definition is refactored. "Platform-specific" code gets moved into the Tomboy.Platform namespace. When a piece of code in the Tomboy namespace (eg Preferences) needs something platform-specific (eg a native IPreferencesClient), it calls a factory method in a class that resides in Tomboy.Platform. It is a general goal to encapsulate all #ifdef statements related to platform dependence in the factory class (eg #ifdef ENABLE_GCONF return new GConfPreferencesClient(); #else return new XmlPreferencesClient(); #endif).

Offending Code

1. Panel Applet

1.1. Refactoring

2. libtomboy

3. Preferences (checked in to branch)

3.1. Refactoring

3.2. Alternatives

4. Keybindings (checked in to branch)

4.1. Refactoring

5. ForcedPresentWindow

5.1. Refactoring

6. Process Management (checked in to branch)

6.1. Refactoring

7. Remote Control

7.1. Refactoring

8. Spell Checking

9. Other Plugins

Considerations

Unfortunately, gtk-sharp-2.10 is not readily available on all platforms. (situation may be better now in 2008)


2024-10-23 10:58