Re: getting the list of all gnome-vfs modules
- From: Seth Nickell <snickell stanford edu>
- To: Christophe Fergeau <teuf users sourceforge net>
- Cc: gnome-vfs-list gnome org, michael ximian com, gnome-vfs ximian com
- Subject: Re: getting the list of all gnome-vfs modules
- Date: 23 Aug 2002 01:50:33 -0500
FWIW, we need this publicly too, but lets make it a private API for the
first pass. We can introduce a public API for GNOME 2.2.
-Seth
On Thu, 2002-08-22 at 09:22, Christophe Fergeau wrote:
> Here is a first version of the patch made before receiving your answer. After some quick tests, it seems to work, to test it I added a .application file for gedit and added a uses_gnome_vfs=true to this file. Don't try it with a ftp uri though because it hangs (still don't know if it's a bug in eel or gnome-vfs since nobody answered my mail about that...). http locations work.
>
> >
> > I believe what you want to do is to find some private ( not installed )
> > header, and add the method prototype to that; so it's not adding public
> > API. And treat this feature as a bug fix to gnome-vfs-2.0 - since it
> > really is a bug that we can't specify "uses all vfs schemes" - really
> > broken ;-)
>
> I added a gnome_vfs_configuration_get_methods_list to gnome-vfs-configuration.h, and by chance it's a private header.
>
> > I'd switch the existing gboolean to a guint user_owned : 1; and add
> > another bit-field for your thing; it might also be worthwhile moving the
> > expect_uris into the 'ints' block, so we don't waste more space
> > mid-structure with pointer alignment requirements - or maybe I'm
> > paranoid.
>
> Actually I didn't add any member to the Application struct, it is stored in the keys HashTable with can_handle_multiple_files and runs_in_terminal. If you think some precious memory can be saved by reworking that storage a little, I can look into that.
>
>
> >
> > Sounds fine; for now.
>
> For now ? And later ?
>
> >
> > I think we need to treat that padding like gold dust ;-)
>
> Yeah, I agree with that, that's why I didn't modify GnomeVFSMimeApplication. It can be added later if it is really needed
>
> >
> > Sounds quite complicated - ultimately if it's has complex requirements
> > it gets to startup and fail - telling the user that it needs to open
> > R/W/Seekable but it can't because the thing's RO/linear.
> > The problem is that adding this sort of complex constraint in gnome-vfs
> > will only lead to more complexity - different formats need different
> > constraints etc. ;-) [ some are not mime-sniffable ] etc. etc.
>
> That was also my opinion.
>
>
> Any comments about the attached patches are obviously welcome. When these patches are ok, the next steps will be to fix the various gnome-vfs modules (apart from the file module, the various modules I tried weren't really working :( and to convince apps writers that they should use gnome-vfs. For example, gedit only support reading remote files, it can't edit them (I hacked gedit to be able to edit ftp files, but I still need to figure out how to test if an uri is writeable before submitting a patch). It would also be nice if file-roller and gthumb supported it....
>
>
> Christophe
>
> ----
>
> diff -ru gnome-vfs/doc/mime-data-specification.txt gnome-vfs-new/doc/mime-data-specification.txt
> --- gnome-vfs/doc/mime-data-specification.txt 2001-05-02 00:14:18.000000000 +0200
> +++ gnome-vfs-new/doc/mime-data-specification.txt 2002-08-21 23:56:13.000000000 +0200
> @@ -402,10 +402,11 @@
> for some known applications that support "http" scheme URIs and
> local file paths, but not "file" scheme URIs.)
>
> -5. [to be implemented] all_gnome_vfs_schemes_supported: If "true", all
> - gnome-vfs schemes should be included in the set of "supported
> - schemes". Other schemes can be added by also including a
> - supported_uri_schemes key as well.
> +5. uses_gnome_vfs: If "true", all gnome-vfs schemes should be included
> + in the set of "supported schemes". Other schemes can be added by
> + also including a supported_uri_schemes key as well. When this key
> + is "true", if expects_uris is "false", it is automatically set to
> + "true".
>
> [may want to discuss issue of using cover scripts to make programs
> easily invokable rather than teaching clients to pass command-line
> ----
>
> Seulement dans gnome-vfs-new/libgnomevfs: .deps
> diff -ru gnome-vfs/libgnomevfs/gnome-vfs-application-registry.c gnome-vfs-new/libgnomevfs/gnome-vfs-application-registry.c
> --- gnome-vfs/libgnomevfs/gnome-vfs-application-registry.c 2002-05-29 02:43:47.000000000 +0200
> +++ gnome-vfs-new/libgnomevfs/gnome-vfs-application-registry.c 2002-08-21 23:47:30.000000000 +0200
> @@ -705,7 +705,7 @@
> Application *application;
> char *key;
> char *lang;
> -
> +
> fp = fopen (filename, "r");
> if (fp == NULL)
> return;
> @@ -1594,7 +1594,8 @@
> const char *uri_scheme)
> {
> Application *application;
> -
> + gboolean uses_gnomevfs = FALSE;
> +
> g_return_val_if_fail (app_id != NULL, FALSE);
> g_return_val_if_fail (uri_scheme != NULL, FALSE);
>
> @@ -1604,7 +1605,10 @@
> if (application == NULL)
> return FALSE;
>
> + uses_gnomevfs = real_get_bool_value (application, GNOME_VFS_APPLICATION_REGISTRY_USES_GNOMEVFS, NULL);
> +
> if (strcmp (uri_scheme, "file") == 0 &&
> + uses_gnomevfs == NULL &&
> application->supported_uri_schemes == NULL &&
> application->user_application->supported_uri_schemes == NULL) {
> return TRUE;
> @@ -1624,6 +1628,21 @@
> (GCompareFunc) strcmp) != NULL)) {
> return TRUE;
> }
> + /* check in the list of uris supported by gnome-vfs if necessary */
> + else if (uses_gnomevfs == TRUE) {
> + GList *supported_uris = NULL;
> + gboolean res = FALSE;
> +
> + supported_uris = gnome_vfs_configuration_get_methods_list();
> + res = (g_list_find_custom(supported_uris,
> + /*glib is const incorrect*/(gpointer) uri_scheme,
> + (GCompareFunc) strcmp) != NULL);
> +
> + g_list_for_each(supported_uris, (GFunc) g_free, NULL);
> + g_list_free(supported_uris);
> +
> + return res;
> + }
>
> return FALSE;
> }
> @@ -1851,6 +1870,7 @@
> {
> Application *i_application;
> GnomeVFSMimeApplication *application;
> + gboolean uses_gnome_vfs = FALSE;
>
> g_return_val_if_fail (app_id != NULL, NULL);
>
> @@ -1889,6 +1909,28 @@
> GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL,
> NULL);
>
> + uses_gnome_vfs = real_get_bool_value (i_application, GNOME_VFS_APPLICATION_REGISTRY_USES_GNOMEVFS, NULL);
> +
> + if (uses_gnome_vfs == TRUE) {
> + GList *methods_list =
> + gnome_vfs_configuration_get_methods_list();
> + GList *tmp = methods_list;
> + if (application->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_PATHS) {
> + application->expects_uris = GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS;
> + }
> + while (tmp != NULL) {
> + if (g_list_find_custom (application->supported_uri_schemes,
> + /*glib is const incorrect*/(gpointer) tmp->data,
> + (GCompareFunc) strcmp) == NULL) {
> + application->supported_uri_schemes =
> + g_list_prepend(application->supported_uri_schemes,
> + tmp->data);
> + }
> + tmp = tmp->next;
> + }
> + g_list_free(methods_list);
> + }
> +
> return application;
> }
>
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-application-registry.c~
> diff -ru gnome-vfs/libgnomevfs/gnome-vfs-application-registry.h gnome-vfs-new/libgnomevfs/gnome-vfs-application-registry.h
> --- gnome-vfs/libgnomevfs/gnome-vfs-application-registry.h 2001-08-03 02:39:58.000000000 +0200
> +++ gnome-vfs-new/libgnomevfs/gnome-vfs-application-registry.h 2002-08-20 22:48:28.000000000 +0200
> @@ -39,6 +39,7 @@
> /* These are the standard boolean keys to get */
> #define GNOME_VFS_APPLICATION_REGISTRY_CAN_OPEN_MULTIPLE_FILES "can_open_multiple_files"
> #define GNOME_VFS_APPLICATION_REGISTRY_REQUIRES_TERMINAL "requires_terminal"
> +#define GNOME_VFS_APPLICATION_REGISTRY_USES_GNOMEVFS "uses_gnomevfs"
>
> /*
> * Existance check
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-application-registry.h~
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-application-registry.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-application-registry.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-async-job-map.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-async-job-map.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-async-ops.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-async-ops.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-cancellable-ops.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-cancellable-ops.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-cancellation.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-cancellation.o
> diff -ru gnome-vfs/libgnomevfs/gnome-vfs-configuration.c gnome-vfs-new/libgnomevfs/gnome-vfs-configuration.c
> --- gnome-vfs/libgnomevfs/gnome-vfs-configuration.c 2002-01-28 20:10:07.000000000 +0100
> +++ gnome-vfs-new/libgnomevfs/gnome-vfs-configuration.c 2002-08-21 23:48:58.000000000 +0200
> @@ -554,3 +554,29 @@
> *args = element->args;
> return element->path;
> }
> +
> +static void
> +add_method_to_list(const gchar *key, gpointer value, GList **methods_list)
> +{
> + *methods_list = g_list_append(*methods_list, g_strdup(key));
> +}
> +
> +GList *
> +gnome_vfs_configuration_get_methods_list (void)
> +{
> + GList *methods_list = NULL;
> +
> + G_LOCK (configuration);
> + if (configuration != NULL) {
> + maybe_reload ();
> + g_hash_table_foreach(configuration->method_to_module_path,
> + (GHFunc)add_method_to_list, &methods_list);
> + } else {
> + /* This should never happen. */
> + g_warning ("Internal error: the configuration system was not initialized. Did you call gnome_vfs_configuration_init?");
> + methods_list = NULL;
> + }
> +
> + G_UNLOCK (configuration);
> + return methods_list;
> +}
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-configuration.c~
> diff -ru gnome-vfs/libgnomevfs/gnome-vfs-configuration.h gnome-vfs-new/libgnomevfs/gnome-vfs-configuration.h
> --- gnome-vfs/libgnomevfs/gnome-vfs-configuration.h 2001-08-03 02:39:58.000000000 +0200
> +++ gnome-vfs-new/libgnomevfs/gnome-vfs-configuration.h 2002-08-20 22:32:18.000000000 +0200
> @@ -25,6 +25,7 @@
> #define GNOME_VFS_CONFIGURATION_H
>
> #include <glib/gtypes.h>
> +#include <glib/glist.h>
>
> G_BEGIN_DECLS
>
> @@ -32,6 +33,8 @@
> gboolean gnome_vfs_configuration_init (void);
> void gnome_vfs_configuration_uninit (void);
> const gchar *gnome_vfs_configuration_get_module_path (const gchar *method_name, const char ** args);
> +GList *gnome_vfs_configuration_get_methods_list(void);
> +
>
> G_END_DECLS
>
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-configuration.h~
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-configuration.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-configuration.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-context.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-context.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-directory.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-directory.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-file-info.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-file-info.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-file-size.h
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-find-directory.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-find-directory.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-handle.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-handle.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-i18n.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-i18n.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-inet-connection.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-inet-connection.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-init.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-init.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-iobuf.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-iobuf.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job-queue.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job-queue.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job-slave.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-job-slave.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-method.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-method.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-handlers.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-handlers.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-info.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-info.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-magic.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-magic.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-monitor.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-monitor.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-sniff-buffer.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-mime-sniff-buffer.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback-module-api.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback-module-api.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback-private.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-callback-private.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-shared.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-module-shared.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-monitor.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-monitor.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-ops.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-ops.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-parse-ls.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-parse-ls.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-private.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-private.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-private-utils.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-private-utils.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-process.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-process.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-result.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-result.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-socket-buffer.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-socket-buffer.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-socket.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-socket.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-ssl.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-ssl.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-thread-pool.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-thread-pool.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-transform.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-transform.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-uri.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-uri.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-utils.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-utils.o
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-xfer.lo
> Seulement dans gnome-vfs-new/libgnomevfs: gnome-vfs-xfer.o
> Seulement dans gnome-vfs-new/libgnomevfs: libgnomevfs-2.la
> Seulement dans gnome-vfs-new/libgnomevfs: .libs
> Seulement dans gnome-vfs-new/libgnomevfs: Makefile
> Seulement dans gnome-vfs-new/libgnomevfs: Makefile.in
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]