mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
Make g_io_modules_load_all_in_directory not unuse loaded modules so that
2007-12-19 Alexander Larsson <alexl@redhat.com> * giomodule.c: Make g_io_modules_load_all_in_directory not unuse loaded modules so that users of it can do stuff before unloading. Init internal "module" types. Initialize static prio and name for types so that we don't have to load modules to get it. * gnativevolumemonitor.h: * gvolumemonitor.h: Move is_supported to parent class so that non-native monitors can avoid being initialized too. (For instance GDaemonVolumeMonitor if we're not using GDaemonVfs.) * glocaldirectorymonitor.[ch]: * glocalfilemonitor.[ch]: * gunionvolumemonitor.c: * gunixvolumemonitor.c: * gvfs.c: Find plugins using the static prio+name to avoid unnecessarily loading the modules. svn path=/trunk/; revision=6159
This commit is contained in:
committed by
Alexander Larsson
parent
de9c37dd91
commit
28d1c8e0ad
44
gio/gvfs.c
44
gio/gvfs.c
@@ -175,32 +175,38 @@ compare_vfs_type (gconstpointer a,
|
||||
gconstpointer b,
|
||||
gpointer user_data)
|
||||
{
|
||||
GVfsClass *class_a, *class_b;
|
||||
GType a_type, b_type;
|
||||
char *a_name, *b_name;
|
||||
int a_prio, b_prio;
|
||||
gint res;
|
||||
const char *use_this_vfs;
|
||||
|
||||
class_a = g_type_class_ref (*(GType *)a);
|
||||
class_b = g_type_class_ref (*(GType *)b);
|
||||
use_this_vfs = user_data;
|
||||
const char *use_this_monitor;
|
||||
GQuark private_q, name_q;
|
||||
|
||||
if (class_a == class_b)
|
||||
private_q = g_quark_from_static_string ("gio-prio");
|
||||
name_q = g_quark_from_static_string ("gio-name");
|
||||
|
||||
use_this_monitor = user_data;
|
||||
a_type = *(GType *)a;
|
||||
b_type = *(GType *)b;
|
||||
a_prio = GPOINTER_TO_INT (g_type_get_qdata (a_type, private_q));
|
||||
a_name = g_type_get_qdata (a_type, name_q);
|
||||
b_prio = GPOINTER_TO_INT (g_type_get_qdata (b_type, private_q));
|
||||
b_name = g_type_get_qdata (b_type, name_q);
|
||||
|
||||
if (a_type == b_type)
|
||||
res = 0;
|
||||
else if (use_this_vfs != NULL &&
|
||||
strcmp (class_a->name, use_this_vfs) == 0)
|
||||
else if (use_this_monitor != NULL &&
|
||||
strcmp (a_name, use_this_monitor) == 0)
|
||||
res = -1;
|
||||
else if (use_this_vfs != NULL &&
|
||||
strcmp (class_b->name, use_this_vfs) == 0)
|
||||
else if (use_this_monitor != NULL &&
|
||||
strcmp (b_name, use_this_monitor) == 0)
|
||||
res = 1;
|
||||
else
|
||||
res = class_b->priority - class_a->priority;
|
||||
|
||||
g_type_class_unref (class_a);
|
||||
g_type_class_unref (class_b);
|
||||
res = b_prio - a_prio;
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static gpointer
|
||||
get_default_vfs (gpointer arg)
|
||||
{
|
||||
@@ -210,15 +216,9 @@ get_default_vfs (gpointer arg)
|
||||
guint n_vfs_impls;
|
||||
const char *use_this;
|
||||
GVfs *vfs;
|
||||
GType (*casted_get_type)(void);
|
||||
|
||||
use_this = g_getenv ("GIO_USE_VFS");
|
||||
|
||||
/* Ensure GLocalVfs type is available
|
||||
the cast is required to avoid any G_GNUC_CONST optimizations */
|
||||
casted_get_type = _g_local_vfs_get_type;
|
||||
local_type = casted_get_type ();
|
||||
|
||||
/* Ensure vfs in modules loaded */
|
||||
_g_io_modules_ensure_loaded ();
|
||||
|
||||
|
Reference in New Issue
Block a user