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


[Home] [TitleIndex] [WordIndex

Shared Applet Server

<!> If you stumble upon this you should note that this is not a finished document - merely a staging area for my thoughts.

This is a draft for my thoughts on a shared applet server for the Gnome desktop.

Breakdown

The abstract situation is this: We have an applet consumer and an applet provider. You can think of this as the panel and a standard Gnome applet, or a desktop widget layer and a widget inside it.

Design goals of the framework

Design

applet3-overview.png

The AppletConsumer talks to the AppletBroker to get a list of all known applets. Possibly a list of applets meeting some specific requirement. These requirements could be

The AppletProviders can then be implemented via DBus services, mapping some DBus interface, in-process libraries, or some other means of communication (web?).

The AppletProvider API could look something like this:

interface AppletProvider {

  /**
   * List all available UI types. These should be predefined namespaced strings. Allowed values could be
   *  - gnome-applet-ui:Reduced  (think "embedded in panel")
   *  - gnome-applet-ui:Full (think "widget on desktop")
   *  - gnome-applet-ui:Hidden (popup on activation like the Alt-F2 run dialog)
   *
   * Third parties can extend this list in another namespace.
   */
  List<String>   getUITypes ();

  /**
   * Get the names of all available GInterfaces provided by this applet.
   * 
   * The idea is that applets can request interfaces from each other via the AppletBroker.
   * We can't use dbus interfaces because interface providers can run in-process (fx. in 
   * the same panel process) and some situations might require the performance of direct method
   * calls.
   * 
   * Interface names should be qualified with proper namespacing.
   */
  List<String>   getInterfaces ();

  /**
   * Get a widget ready for embedding in the parent UI (panel, desktop, application).
   * Note that not all applets need to provide a UI.
   */
  GtkWidget      getUI (String uiType);

Crackpot Idea On Exposed Interfaces: An application can expose a ApplicationActions interface that can give you a GtkActionGroup (or something) of actions you can trigger on the application. These could be added to the popup you get when right clicking the application in the panel's window list. This should remove the need application developers have for exposing tray icons when they really shouldn't. For example Rhythmbox' context menu could look like:

FIXME

The AppletBroker

As noted elsewhere the broker is used to manage the applets. I imagine it be an abstract class with a static factory for instantiating the correct subclass. This way we can have alternative broker implementations easily:

abstract class AppletBroker {

  AppletBroker   getDefaultBroker();

  List<String>   listApplets ();

  List<String>   queryApplets (<query>);

  AppletProvider getApplet (String name);

  /* Possibly signals to notify when applets are installed/removed */
}

Helper Classes

Needless to say there are a few utility methods that would be handy - like for example connecting a ui definition given a connector description.

What is so Cool About This?

What is Uncool About This

Comments


2024-10-23 11:23