Index: nautilus-sendto-command.c
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/nautilus-sendto-command.c,v
retrieving revision 1.8
diff -u -p -r1.8 nautilus-sendto-command.c
--- nautilus-sendto-command.c	28 Dec 2005 10:17:10 -0000	1.8
+++ nautilus-sendto-command.c	14 Mar 2006 23:10:04 -0000
@@ -313,75 +313,48 @@ nautilus_sendto_create_ui ()
 
 }
 
-static gboolean
-str_has_suffix (const char *haystack, const char *needle)
-{
-        const char *h, *n;
-
-        if (needle == NULL) {
-                return TRUE;
-        }
-        if (haystack == NULL) {
-                return needle[0] == '\0';
-        }
-
-        /* Eat one character at a time. */
-        h = haystack + strlen(haystack);
-        n = needle + strlen(needle);
-        do {
-                if (n == needle) {
-                        return TRUE;
-                }
-                if (h == haystack) {
-                        return FALSE;
-                }
-        } while (*--h == *--n);
-        return FALSE;
-}
-
-void
+static void
 nautilus_sendto_plugin_init (void)
 {
-	DIR *dir;
-	struct dirent *ep;
+	GDir *dir;
+	const char *item;
 	NstPlugin *p = NULL;
 	gboolean (*nst_init_plugin)(NstPlugin *p);
-	
-	dir = opendir (PLUGINDIR);
+	GError *err = NULL;
+
+	dir = g_dir_open (PLUGINDIR, 0, &err);
 	if (dir == NULL){
-		g_error ("Can't open the plugins dir");
+		g_error ("Can't open the plugins dir: %s", err ? err->message : "No reason");
+		if (err)
+			g_error_free (err);
 	}else{		
-		while (ep = readdir(dir)){
-			gchar *file;
-			if ((strcmp (ep->d_name,".")==0)   ||
-			(strcmp (ep->d_name, "..")==0))
-                        	continue ;
-			if (str_has_suffix (ep->d_name, SOEXT)){
-				GString *str = g_string_new (ep->d_name);
+		while (item = g_dir_read_name(dir)){
+			if (g_str_has_suffix (item, SOEXT)){
 				gchar *module_path;
-				
-				str = g_string_truncate (str, str->len - SOEXT_LEN);
+
 				p = g_new0(NstPlugin, 1);
-				module_path = g_module_build_path (PLUGINDIR, str->str);
+				module_path = g_module_build_path (PLUGINDIR, item);
 				p->module = g_module_open (module_path, G_MODULE_BIND_LAZY);
 			        if (!p->module)
-                			g_error ("error: %s", g_module_error ());
+                			g_error ("error opening %s: %s", module_path, g_module_error ());
 				if (!g_module_symbol (p->module, "nst_init_plugin", (gpointer *)&nst_init_plugin))
 			                g_error ("error: %s", g_module_error ());	
 				nst_init_plugin (p);
 				if (p->info->init(p)){
 					plugin_list = g_list_append (plugin_list, p);
 				}else{
-					g_module_close (p->module);
+					if (!p->info->never_unload)
+						g_module_close (p->module);
+					g_free (p);
 				}
 				g_free (module_path);
-				g_string_free (str, TRUE);				
 			}
 		}
+		g_dir_close (dir);
 	}	
 }
 
-void
+static void
 nautilus_sendto_init (GnomeProgram *program, int argc, char **argv)
 {
 	poptContext pctx;
Index: nautilus-sendto-plugin.h
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/nautilus-sendto-plugin.h,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 nautilus-sendto-plugin.h
--- nautilus-sendto-plugin.h	30 Oct 2004 11:35:13 -0000	1.1.1.1
+++ nautilus-sendto-plugin.h	14 Mar 2006 23:10:04 -0000
@@ -35,6 +35,7 @@ struct _NstPluginInfo 
 {
 	gchar *icon;
 	gchar *description;
+	gboolean never_unload;
 	gboolean (*init)(NstPlugin *plugin);
 	GtkWidget* (*get_contacts_widget)(NstPlugin *plugin);
 	gboolean (*send_files)(NstPlugin *plugin, GtkWidget *contact_widget,
Index: plugins/Makefile.am
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/plugins/Makefile.am,v
retrieving revision 1.5
diff -u -p -r1.5 Makefile.am
--- plugins/Makefile.am	28 Dec 2005 10:17:11 -0000	1.5
+++ plugins/Makefile.am	14 Mar 2006 23:10:04 -0000
@@ -12,34 +12,34 @@ INCLUDES =                              
 	$(BLUETOOTH_CFLAGS)
 
 if HAVE_GAIM
-GAIM_PLUGIN = libgaim.la
+GAIM_PLUGIN = libnstgaim.la
 else
 GAIM_PLUGIN =
 endif
 
 if HAVE_BLUETOOTH
-BLUETOOTH_PLUGIN = libbluetooth.la
+BLUETOOTH_PLUGIN = libnstbluetooth.la
 else
 BLUETOOTH_PLUGIN = 
 endif
 
 if HAVE_EVOLUTION
-EVOLUTION_PLUGIN = libevolution.la
+EVOLUTION_PLUGIN = libnstevolution.la
 else
 EVOLUTION_PLUGIN =
 endif
 
 plugin_LTLIBRARIES = $(EVOLUTION_PLUGIN) $(GAIM_PLUGIN) $(BLUETOOTH_PLUGIN)
 
-libevolution_la_SOURCES = evolution.c
-libevolution_la_LDFLAGS = -module -avoid-version
-libevolution_la_LIBADD = $(NST_EBOOK_LIBS)
-
-libgaim_la_SOURCES = gaim.c
-libgaim_la_LDFLAGS = -module -avoid-version
-libgaim_la_LIBADD = $(GAIM_LIBS)
-
-libbluetooth_la_SOURCES = bluetooth.c
-libbluetooth_la_LDFLAGS = -module -avoid-version
-libbluetooth_la_LIBADD = $(BLUETOOTH_LIBS)
+libnstevolution_la_SOURCES = evolution.c
+libnstevolution_la_LDFLAGS = -module -avoid-version
+libnstevolution_la_LIBADD = $(NST_EBOOK_LIBS)
+
+libnstgaim_la_SOURCES = gaim.c
+libnstgaim_la_LDFLAGS = -module -avoid-version
+libnstgaim_la_LIBADD = $(GAIM_LIBS)
+
+libnstbluetooth_la_SOURCES = bluetooth.c
+libnstbluetooth_la_LDFLAGS = -module -avoid-version
+libnstbluetooth_la_LIBADD = $(BLUETOOTH_LIBS)
 
Index: plugins/bluetooth.c
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/plugins/bluetooth.c,v
retrieving revision 1.3
diff -u -p -r1.3 bluetooth.c
--- plugins/bluetooth.c	28 Dec 2005 10:17:11 -0000	1.3
+++ plugins/bluetooth.c	14 Mar 2006 23:10:04 -0000
@@ -47,14 +47,16 @@ init (NstPlugin *plugin)
 	g_print ("Init bluetooth plugin\n");
 
 	btctl = gnomebt_controller_new ();
-	GError* e = g_new(GError, 1);
+	GError* e = NULL;
+
 	if (btctl_controller_is_initialised (BTCTL_CONTROLLER (btctl), &e) == FALSE) {
 		g_object_unref (btctl);
-		g_free(e);
+		g_print ("Couldn't init bluetooth plugin: %s\n", e ? e->message : "No reason");
+		if (e)
+			g_error_free (e);
 		return FALSE;
 	}
-	
-	g_free(e);
+
 	discovered = 0;
 	id = -1;
 
@@ -256,6 +258,7 @@ static 
 NstPluginInfo plugin_info = {
 	"stock_bluetooth",
 	N_("Bluetooth (OBEX)"),
+	TRUE,
 	init,
 	get_contacts_widget,
 	send_files,
Index: plugins/evolution.c
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/plugins/evolution.c,v
retrieving revision 1.8
diff -u -p -r1.8 evolution.c
--- plugins/evolution.c	28 Dec 2005 10:17:11 -0000	1.8
+++ plugins/evolution.c	14 Mar 2006 23:10:05 -0000
@@ -77,8 +77,8 @@ add_evolution_contacts_to_model (GtkWidg
 
 	for (c = cards; c; c = c->next) {
 		EContact *contact = E_CONTACT (c->data);		
-		gchar *family_name = e_contact_get_const (contact, E_CONTACT_FAMILY_NAME);
-		gchar *given_name = e_contact_get_const (contact, E_CONTACT_GIVEN_NAME);
+		const char *family_name = e_contact_get_const (contact, E_CONTACT_FAMILY_NAME);
+		const char *given_name = e_contact_get_const (contact, E_CONTACT_GIVEN_NAME);
 		GList *emails, *e;
 		
 		emails = e_contact_get (contact, E_CONTACT_EMAIL);
@@ -224,6 +224,7 @@ static 
 NstPluginInfo plugin_info = {
 	"stock_mail",
 	N_("Email (Evolution)"),
+	FALSE,
 	init,
 	get_contacts_widget,
 	send_files,
Index: plugins/gaim.c
===================================================================
RCS file: /cvs/gnome/nautilus-sendto/src/plugins/gaim.c,v
retrieving revision 1.4
diff -u -p -r1.4 gaim.c
--- plugins/gaim.c	31 Jul 2005 21:39:03 -0000	1.4
+++ plugins/gaim.c	14 Mar 2006 23:10:05 -0000
@@ -217,6 +217,7 @@ static 
 NstPluginInfo plugin_info = {
 	"im",
 	N_("Instant Message (Gaim)"),
+	FALSE,
 	init,
 	get_contacts_widget,
 	send_files,
