gnome-vfs mime api rework



Hi,

I'm working to fix the issues with the gnome-vfs mime api and to
deprecate the parts that are still depending on the old database.

PROBLEMS

1 We have two databases GnomeVFSApplicationRegistry and the new one
based on desktop files. They are somewhat interwined (the same
GNOMEVFSMimeApplication can be constructed from both databases) but also
incompatible (for example the Exec field of desktop files is very
different from the command of gnome-mime-data).

2 GnomeVFSMimeApplication is designed for the old database.
supported_uri_schemes doesnt make sense anymore. command in his current
form lose informations when created from the desktop file exec field. We
lack access to some desktop file bits that may be useful.

PROPOSAL

I discussed it a bit with Alex, but I'd like to check that it works for
everyone.

- Deprecate gnome-vfs-application-registry (gnome-vfs-mime-handlers will
cover all the usage cases that are still useful)
- Deprecate gnome-vfs-mime-info-cache (well, as public functions at
least)
- Deprecate parts of GnomeVFSApplication which doesnt play well with the
new desktop files implementation, extend it to replace gnome-vfs-
application-registry usage and add some bits that may be useful.

The attached header shows the new gnome-vfs-mime-handlers apis. I did
cut off all the deprecated bits for clarity but it's all doable keeping
ABI compatibilty.

My plan is:

- Implement this in gnome-vfs and move the deprecated stuff to gnome-
vfs-mime-deprecated.h. There are so many deprecated functions that it's
all very confusing at the moment.
- Fixup the desktop release modules to use the non deprecated api. I
want to make sure we have everything we need (I obviously checked
already but ... for a better proof).

Feedback very welcome :)

Marco
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */

/* gnome-vfs-mime-handlers.h - Mime type handlers for the GNOME Virtual
   File System.

   Copyright (C) 2000 Eazel, Inc.

   The Gnome Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public License as
   published by the Free Software Foundation; either version 2 of the
   License, or (at your option) any later version.

   The Gnome Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the GNU
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public
   License along with the Gnome Library; see the file COPYING.LIB.  If not,
   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
   Boston, MA 02111-1307, USA.

   Author: Maciej Stachowiak <mjs eazel com> */

#ifndef GNOME_VFS_MIME_HANDLERS_H
#define GNOME_VFS_MIME_HANDLERS_H

#include <libgnomevfs/gnome-vfs-result.h>
#include <libgnomevfs/gnome-vfs-uri.h>

G_BEGIN_DECLS

typedef struct {
	char *id; /* PRIVATE */

	char *name;
	gboolean requires_terminal;

	/* Padded to avoid future breaks in ABI compatibility */
	void *reserved1;

	GnomeVFSMimeApplicationPrivate *priv;
} GnomeVFSMimeApplication;

/* Database */

GList *                  gnome_vfs_mime_get_all_applications              (const char              *mime_type);
GnomeVFSMimeApplication *gnome_vfs_mime_get_default_application           (const char              *mime_type);
GList *                  gnome_vfs_mime_get_all_applications_for_uri      (const char              *uri);
GnomeVFSMimeApplication *gnome_vfs_mime_get_default_application_for_uri   (const char              *uri);
Bonobo_ServerInfo *      gnome_vfs_mime_get_default_component             (const char              *mime_type);
GList *                  gnome_vfs_mime_get_all_components                (const char              *mime_type);

/* Mime types */

const char  		*gnome_vfs_mime_get_icon 			  (const char 		   *mime_type);
const char 	        *gnome_vfs_mime_get_description   		  (const char              *mime_type);
gboolean 	         gnome_vfs_mime_can_be_executable   		  (const char              *mime_type);

/* Application */

GnomeVFSMimeApplication *gnome_vfs_mime_application_new_from_desktop_id   (const char              *id);
GnomeVFSResult           gnome_vfs_mime_application_launch                (GnomeVFSMimeApplication *app,
									   GList                   *uris);
GnomeVFSResult           gnome_vfs_mime_application_launch_with_env	  (GnomeVFSMimeApplication *app,
									   GList                   *uris,
									   char                   **envp);
const char		*gnome_vfs_mime_application_get_desktop_id	  (GnomeVFSMimeApplication *app);
const char		*gnome_vfs_mime_application_get_desktop_file_path (GnomeVFSMimeApplication *app);
const char		*gnome_vfs_mime_application_get_name              (GnomeVFSMimeApplication *app);
const char              *gnome_vfs_mime_application_get_generic_name      (GnomeVFSMimeApplication *app);
const char              *gnome_vfs_mime_application_get_icon              (GnomeVFSMimeApplication *app);
const char		*gnome_vfs_mime_application_get_exec		  (GnomeVFSMimeApplication *app);
gboolean		 gnome_vfs_mime_application_expects_uris	  (GnomeVFSMimeApplication *app);
gboolean		 gnome_vfs_mime_application_requires_terminal     (GnomeVFSMimeApplication *app);
gboolean		 gnome_vfs_mime_application_get_startup_notify    (GnomeVFSMimeApplication *app);
const char		*gnome_vfs_mime_application_get_startup_wm_class  (GnomeVFSMimeApplication *app);
GnomeVFSMimeApplication *gnome_vfs_mime_application_copy                  (GnomeVFSMimeApplication *app);
void                     gnome_vfs_mime_application_free                  (GnomeVFSMimeApplication *app);

/* Lists */

void			 gnome_vfs_mime_application_list_free		  (GList                   *list);
void			 gnome_vfs_mime_component_list_free		  (GList                   *list);

G_END_DECLS

#endif /* GNOME_VFS_MIME_HANDLERS_H */


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