[Nautilus-list] Proposed mime/uri -> program mapping API



This is a very rough draft. Coments solicited. It will probably go
through a few rounds of revisions before I implement it.

Sorry if the gtk-style formatting sucks to read in email.

 - mjs

-------------------

/* Open issues:
 *
 * * error handling
 *
 * * do programs need to be represented by something more complicated
 *   than a char *? For instance, how do we represent uri or
 *   multi-open capability?
 *
 * * For component-related calls, may we impose requirements?
 *
 * * "program" or "application?
 *
 * * Do we get the user level from GConf in the short_list calls, or
 *   does it get passed explicitly, or what?
 *
 * * Allow passing of GnomeVFSURI * instead of char *uri?
 *
 * * Interface that works with a handle?
 *
 * * Can you specify if you want "slow" or "fast" checking?
 *
 * * _for_uri calls need to get/set metadata, is that OK?
 *
 */

enum GnomeVFSMimeActionType {
	GNOME_VFS_MIME_ACTION_TYPE_PROGRAM,
	GNOME_VFS_MIME_ACTION_TYPE_COMPONENT
};

typedef enum GnomeVFSMimeActionType GnomeVFSMimeActionType;

struct GnomeVFSMimeAction {
	GnomeVFSActionType action_type;
	
	union {
		OAF_ServerInfo *component;
		char           *program;
	} action;
}

typedef struct GnomeVFSMimeAction GnomeVFSMimeAction;


GnomeVFSMimeAction *gnome_vfs_mime_get_default_action                 (const char             *mime_type);
char               *gnome_vfs_mime_get_default_program                (const char             *mime_type);
OAF_ServerInfo     *gnome_vfs_mime_get_default_component              (const char             *mime_type);
GList              *gnome_vfs_mime_get_short_list_programs            (const char             *mime_type);
GList              *gnome_vfs_mime_get_short_list_components          (const char             *mime_type);
GList              *gnome_vfs_mime_get_all_programs                   (const char             *mime_type);
GList              *gnome_vfs_mime_get_all_components                 (const char             *mime_type);

GnomeVFSMimeAction *gnome_vfs_mime_get_default_action_for_uri         (const char             *uri);
char               *gnome_vfs_mime_get_default_program_for_uri        (const char             *uri);
OAF_ServerInfo     *gnome_vfs_mime_get_default_component_for_uri      (const char             *uri);
GList              *gnome_vfs_mime_get_short_list_programs_for_uri    (const char             *mime_type);
GList              *gnome_vfs_mime_get_short_list_components_for_uri  (const char             *mime_type);
GList              *gnome_vfs_mime_get_all_programs_for_uri           (const char             *mime_type);
GList              *gnome_vfs_mime_get_all_components_for_uri         (const char             *mime_type);



void                gnome_vfs_mime_set_default_action_type            (const char             *mime_type,
								       GnomeVFSMimeActionType  action_type);
void                gnome_vfs_mime_set_default_program                (const char             *mime_type,
								       const char             *program);
void                gnome_vfs_mime_set_default_component              (const char             *mime_type,
								       const char             *component_iid);
/* Stored as delta to current user level */
void                gnome_vfs_mime_set_short_list_programs            (const char             *mime_type,
								       GList                  *programs);
GList              *gnome_vfs_mime_get_short_list_components          (const char             *mime_type,
								       GList                  *components);
* No way to override system list; can only add. */
void                gnome_vfs_mime_extend_all_programs                (const char             *mime_type,
								       GList                  *programs);
/* Only "user" entries may be removed. */
void                gnome_vfs_mime_remove_from_all_programs           (const char             *mime_type,



void                gnome_vfs_mime_set_default_action_type_for_uri    (const char             *mime_type,
								       GnomeVFSMimeActionType  action_type);
void                gnome_vfs_mime_set_default_program_for_uri        (const char             *mime_type,
								       const char             *program);
void                gnome_vfs_mime_set_default_component_for_uri      (const char             *mime_type,
								       const char             *component_iid);
/* Stored as delta to current user level */
void                gnome_vfs_mime_set_short_list_programs_for_uri    (const char             *mime_type,
								       GList                  *programs);
GList              *gnome_vfs_mime_get_short_list_components_for_uri  (const char             *mime_type,
								       GList                  *components);
/* No way to override system list; can only add. */
void                gnome_vfs_mime_extend_all_programs_for_uri        (const char             *mime_type,
								       GList                  *programs);
/* Only "user" entries may be removed. */
void                gnome_vfs_mime_remove_from_all_programs_for_uri   (const char             *mime_type,
								       GList                  *programs);
/* No way to add to all components; oafinfo database assumed trusted in this regard. */



void                gnome_vfs_mime_action_free                        (GnomeVFSMimeAction *action);







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]