Chapter 4. Customizing MediaWarehouse

You can customize MediaWarehouse to suit your particular needs. For example, you can add new viewers. Topics covered include:

For information on starting MediaWarehouse, see Chapter 2, “Getting Started With MediaWarehouse.” For information on using MediaWarehouse menus, shelves, clipboard, and moving objects to and from MediaWarehouse, see Chapter 3, “Using MediaWarehouse.”

MediaWarehouse Reference Page

The MediaWarehouse reference page, mediaw(1), has additional information about MediaWarehouse. To view this page, click the word mediaw .

MediaWarehouse Command-Line Options

To start MediaWarehouse from the command line, type:


Table 4-1 lists the command-line option you can use with MediaWarehouse.

Table 4-1. MediaWarehouse Command-Line Options



–dbdir directory

Specifies the directory that MediaWarehouse uses for its database files. The default is $(HOME)/.mediaw.

In addition, MediaWarehouse accepts all of the standard X Toolkit command-line options. See the mediaw(1) reference page and the section titled “Command-Line Options” in Chapter 3 of X Toolkit Intrinsics Programming Manual for information about these options.

Media Warehouse Preferences

You can configure MediaWarehouse preferences. Pull down the File menu and select “Preferences.” Two tab panels appear:

Import Targets

The “Import Targets” panel displays the most recently received targets, and allows you to set up preferred and ignored targets. Figure 4-1 shows the “Import Targets” panel.

Figure 4-1. Import Targets Panel

In some cases, an application is able to export data in one of several data types to the MediaWarehouse. By default, the MediaWarehouse displays a dialog asking you which data type to use. You can change this setting with the “Import Targets Configuration” panel.

The “Last Received Targets” rectangle at the top of the panel lists the most recently received targets. The panel does not list icons that you drag and drop from the desktop.

You can drag and drop a target type (using the middle mouse button) to the “Preferred Targets” or “Targets to Ignore” list.

The two rectangles at the bottom of the panel allow you to specify which target types to use or ignore. If an import type appears on the “Preferred” list, it is selected (items at the top of the list have precedence). The default order of prefered targets appears when you first open the “Import Targets” panel.

If the imported type does not appear on the list, the default selection dialog box appears, and the “Targets to Ignore” are not shown.

New Objects

The “New Objects” panel allows you to set up the way you name imported objects. By default, MediaWarehouse tries to determine the name of a data object by examining its data.

Figure 4-2 shows the “New Objects” panel.

Figure 4-2. New Objects Panel

Table 4-2 lists the New Objects panel functions.

Table 4-2. New Objects Functions



When unknown

Tries to determine the name of a data object by examining the data. If MediaWarehouse can't determine a name, it prompts you to specify a name and keyword(s).


Always prompts you for a name.


Determines a default name without prompting you.

To change the setting, click the left mouse button in the appropriate diamond. Press OK to save your preferences. Press Cancel to ignore any changes and reset the preferences to the last saved values.

Adding New Data Types

By default, MediaWarehouse can import and export data objects of any data type. Currently, MediaWarehouse provides viewers and type-specific icons for many data types. You can, however, add additional icons and viewers.

Configure new icons and viewers in the /usr/lib/mediaw/mediawrc file. The mediawrc file specifies icons and viewers for numerous data types. To view this file, click the word mediawrc .

The information that follows describes:

Adding Icons

To add an icon for a new data type, just specify the icon in the mediawrc file. Use this format:

target_type.iconPanelType: icon_type

The target_type is the X Window System ICCCM selection target type used by X application to identify this data type. You can usually find this value in your application's documentation.

The icon_type is the name of a File Typing Rules (FTR) file type. The icon associated with that file type will be displayed. For instructions on adding new FTR rules, see the ftr(1) reference page.

For example, by default, MediaWarehouse uses the following specification to associate the AsciiTextFile icon with the STRING target type:

STRING.iconPanelType: AsciiTextFile

Adding Viewers

To add a viewer for a new data type, just specify the viewer in the mediawrc file. Use this format:

target_type.viewer: viewer_DSO_name 

The target_type is the target type. The viewer_DSO_name is the name of the DSO containing the viewer procedures.

The DSO should provide these functions:

extern “C” {
   void *create(Widget);
   void view(void* handle,
      Atom type, void* data, unsigned long length);
   void hide(void* handle);
   void destroy(void* handle);

For information about DSOs, see the DSO(5) reference page.

The create function should create the viewer using the specified widget as its parent and return a handle to the viewer. The handle is passed as the first argument to the other three functions.

The view function maps and views the data. It is called with an X atom representing the selection target type, a pointer to the data, and the length of the data.

The hide and destroy functions are optional. If provided, they are called when the viewer is unmapped and destroyed, respectively.