예제 #1
0
int
posix_monitor_add(evfs_client * client, evfs_command * command)
{
   Ecore_List *mon_list =
      ecore_hash_get(posix_monitor_hash, evfs_command_first_file_get(command)->path);
   evfs_file_monitor *mon;
   evfs_file_monitor *old;

   mon = calloc(1, sizeof(evfs_file_monitor));
   mon->client = client;
   mon->monitor_path = strdup(evfs_command_first_file_get(command)->path);

   /*Check if we are already monitoring, if not, make a new list of monitors.. */
   if (!mon_list)
     {
        /*printf("No previous instance, making a new list, monitoring..\n"); */

        mon_list = ecore_list_new();
        ecore_hash_set(posix_monitor_hash, mon->monitor_path, mon_list);

        printf("Adding monitor on path '%s'\n", mon->monitor_path);
        if (!
            (mon->em =
             ecore_file_monitor_add(mon->monitor_path,
                                    &evfs_file_monitor_fam_handler,
                                    mon->monitor_path)))
          {
             fprintf(stderr, "EVFS: Error monitoring '%s'\n",
                     mon->monitor_path);
          }

        ecore_list_append(mon_list, mon);
     }
   else
     {
        if (!client_already_monitoring(client, mon_list))
          {
             /*We assume there is something already in the list.  This is probably bad a bad assumption */
             ecore_list_first_goto(mon_list);
             old = ecore_list_current(mon_list);

             /*Make sure we have the ecore ref, so the last monitor can nuke it */
             mon->em = old->em;
             ecore_list_append(mon_list, mon);
          }
        else
          {
             printf("Oi, dufus, you're already monitoring this object\n");
          }

     }

   return 0;

}
예제 #2
0
Eina_List* evfs_file_meta_retrieve(evfs_client* client, evfs_command* command)
{
	Eina_List* ret_list = NULL;
	EvfsMetaObject* obj;
	char* key;
	EvfsFilereference* ref;

	ref = evfs_command_first_file_get(command);

	keywords=EXTRACTOR_getKeywords(_extractors, ref->path);
	keywords=EXTRACTOR_removeDuplicateKeywords(keywords,0);

	while(keywords) {

		key=EXTRACTOR_getKeywordTypeAsString(keywords->keywordType);
		
		obj = calloc(1,sizeof(EvfsMetaObject));
		obj->key = strdup(key);
		obj->value = strdup(keywords->keyword);
		ret_list = eina_list_append(ret_list, obj);

		keywords = keywords->next;
	}
	EXTRACTOR_freeKeywords(keywords);

	return ret_list;
}
예제 #3
0
int
evfs_monitor_stop(evfs_client * client, evfs_command * command)
{
   evfs_posix_monitor_remove(client, evfs_command_first_file_get(command)->path);
   return 0;
}